Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
maniglia committed Oct 19, 2023
1 parent 1cd07c1 commit e7ca229
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@
<Link>dll\x86\%(FileName)%(Extension)</Link>
<Visible>false</Visible>
</Content>
<!--<Content Include="$(MSBuildThisFileDirectory)native\x86\STLinkUSBDriver.dll">
<Content Include="$(MSBuildThisFileDirectory)native\x86\STLinkUSBDriver.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>dll\x86\%(FileName)%(Extension)</Link>
<Visible>false</Visible>
</Content>-->
</Content>
</ItemGroup>
<ItemGroup Condition=" '$(OS)' == 'WINDOWS_NT' ">
<Content Include="$(MSBuildThisFileDirectory)native\x64\Programmer\*.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>dll\x64\%(FileName)%(Extension)</Link>
<Visible>false</Visible>
</Content>
<!--<Content Include="$(MSBuildThisFileDirectory)native\x64\STLinkUSBDriver.dll">
<Content Include="$(MSBuildThisFileDirectory)native\x64\STLinkUSBDriver.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>dll\x64\%(FileName)%(Extension)</Link>
<Visible>false</Visible>
</Content>-->
</Content>
</ItemGroup>
<ItemGroup>
<StFlashLoaderFiles Include="$(MSBuildThisFileDirectory)/../contentFiles/FlashLoader/*.*" />
Expand Down
20 changes: 20 additions & 0 deletions src/01/KSociety.SharpCubeProgrammer/CubeProgrammerApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace KSociety.SharpCubeProgrammer
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using DeviceDataStructure;
using Enum;
Expand Down Expand Up @@ -49,6 +50,25 @@ public CubeProgrammerApi(IWmiManager wmiManager, ILogger<CubeProgrammerApi>? log
this._logger = logger;

this._logger?.LogTrace("CubeProgrammerApi IntPtr size: {0}", IntPtr.Size);

try
{


if (Environment.Is64BitProcess)
{
Assembly.LoadFrom(@".\dll\x64\STLinkUSBDriver.dll");
}
else
{
Assembly.LoadFrom(@".\dll\x86\STLinkUSBDriver.dll");
}
}
catch (Exception ex)
{
this._logger?.LogError(ex, "CubeProgrammerApi: ");
}

}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
<None Include="..\..\..\Programmer\x86\STLinkUSBDriver.dll" Pack="true" PackagePath="runtimes\win-x86\native" Visible="false" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />
<None Include="..\..\..\Win32\Release\*.dll" Pack="true" PackagePath="runtimes\win-x86\native\Programmer" Visible="false" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />-->
<None Include="..\..\..\Programmer\x64\*.dll" Pack="true" PackagePath="build\native\x64\Programmer" Visible="false" Exclude="**\STLinkUSBDriver.dll" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />
<None Include="..\..\..\Programmer\x64\STLinkUSBDriver.dll" Pack="true" PackagePath="runtimes\win-x64\native" Visible="false" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />
<None Include="..\..\..\Programmer\x64\STLinkUSBDriver.dll" Pack="true" PackagePath="build\native\x64\native" Visible="false" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />
<None Include="..\..\..\x64\Release\*.dll" Pack="true" PackagePath="build\native\x64\Programmer" Visible="false" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />
<None Include="..\..\..\Programmer\x86\*.dll" Pack="true" PackagePath="build\native\x86\Programmer" Visible="false" Exclude="**\STLinkUSBDriver.dll" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />
<None Include="..\..\..\Programmer\x86\STLinkUSBDriver.dll" Pack="true" PackagePath="runtimes\win-x86\native" Visible="false" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />
<None Include="..\..\..\Programmer\x86\STLinkUSBDriver.dll" Pack="true" PackagePath="build\native\x86\native" Visible="false" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />
<None Include="..\..\..\Win32\Release\*.dll" Pack="true" PackagePath="build\native\x86\Programmer" Visible="false" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />
<None Include="..\..\..\Data_Base\*.*" Pack="true" PackagePath="contentFiles\Data_Base" Visible="false" />
<None Include="..\..\..\Programmer\FlashLoader\*.*" Pack="true" PackagePath="contentFiles\FlashLoader" Visible="false" />
Expand Down
2 changes: 1 addition & 1 deletion src/01/Samples/Programming/Programming.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="KSociety.SharpCubeProgrammer" Version="0.0.67" />
<PackageReference Include="KSociety.SharpCubeProgrammer" Version="0.0.69" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.1" />
Expand Down

0 comments on commit e7ca229

Please sign in to comment.