From e7ca2294f5db3aad699fb654556380c4c38d7dd6 Mon Sep 17 00:00:00 2001 From: maniglia Date: Thu, 19 Oct 2023 10:58:59 +0200 Subject: [PATCH] Testing --- .../KSociety.SharpCubeProgrammer.targets | 8 ++++---- .../CubeProgrammerApi.cs | 20 +++++++++++++++++++ .../KSociety.SharpCubeProgrammer.csproj | 4 ++-- src/01/Samples/Programming/Programming.csproj | 2 +- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/01/KSociety.SharpCubeProgrammer/Build/KSociety.SharpCubeProgrammer.targets b/src/01/KSociety.SharpCubeProgrammer/Build/KSociety.SharpCubeProgrammer.targets index 84b1cd7..07a78c1 100644 --- a/src/01/KSociety.SharpCubeProgrammer/Build/KSociety.SharpCubeProgrammer.targets +++ b/src/01/KSociety.SharpCubeProgrammer/Build/KSociety.SharpCubeProgrammer.targets @@ -32,11 +32,11 @@ dll\x86\%(FileName)%(Extension) false - + @@ -44,11 +44,11 @@ dll\x64\%(FileName)%(Extension) false - + diff --git a/src/01/KSociety.SharpCubeProgrammer/CubeProgrammerApi.cs b/src/01/KSociety.SharpCubeProgrammer/CubeProgrammerApi.cs index 36e8f38..b33e524 100644 --- a/src/01/KSociety.SharpCubeProgrammer/CubeProgrammerApi.cs +++ b/src/01/KSociety.SharpCubeProgrammer/CubeProgrammerApi.cs @@ -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; @@ -49,6 +50,25 @@ public CubeProgrammerApi(IWmiManager wmiManager, ILogger? 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 diff --git a/src/01/KSociety.SharpCubeProgrammer/KSociety.SharpCubeProgrammer.csproj b/src/01/KSociety.SharpCubeProgrammer/KSociety.SharpCubeProgrammer.csproj index e294a19..194e280 100644 --- a/src/01/KSociety.SharpCubeProgrammer/KSociety.SharpCubeProgrammer.csproj +++ b/src/01/KSociety.SharpCubeProgrammer/KSociety.SharpCubeProgrammer.csproj @@ -24,10 +24,10 @@ --> - + - + diff --git a/src/01/Samples/Programming/Programming.csproj b/src/01/Samples/Programming/Programming.csproj index 8aa29ac..d28204b 100644 --- a/src/01/Samples/Programming/Programming.csproj +++ b/src/01/Samples/Programming/Programming.csproj @@ -7,7 +7,7 @@ - +