1
0
mirror of https://github.com/DarthAffe/CUE.NET.git synced 2025-12-12 16:58:29 +00:00

Merge pull request #8 from DarthAffe/Development

NuGet seems to work now
This commit is contained in:
DarthAffe 2015-09-26 13:11:56 +02:00
commit f1fc73fc2e
11 changed files with 205 additions and 130 deletions

View File

@ -12,39 +12,21 @@
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\</OutputPath> <OutputPath>bin\</OutputPath>
<DefineConstants>TRACE;DEBUG;WIN64</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\</OutputPath>
<DefineConstants>TRACE;WIN64</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\</OutputPath>
<DefineConstants>TRACE;DEBUG;WIN32</DefineConstants> <DefineConstants>TRACE;DEBUG;WIN32</DefineConstants>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\x86\</OutputPath> <OutputPath>bin\</OutputPath>
<DefineConstants>TRACE;WIN32</DefineConstants> <DefineConstants>TRACE;WIN32</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
@ -107,23 +89,7 @@
<Compile Include="CueSDK.cs" /> <Compile Include="CueSDK.cs" />
<Compile Include="Devices\ICueDevice.cs" /> <Compile Include="Devices\ICueDevice.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="libs\CUESDK.x64_2013.dll" />
</ItemGroup>
<ItemGroup>
<None Include="libs\CUESDK_2013.dll" />
</ItemGroup>
<ItemGroup /> <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <Import Project="$(MSBuildProjectDirectory)\CUE.NET.targets" />
<PostBuildEvent>if $(PlatformName) == x86 copy "$(SolutionDir)libs\CUESDK_2013.dll" "$(TargetDir)CUESDK_2013.dll"
if $(PlatformName) == x64 copy "$(SolutionDir)libs\CUESDK.x64_2013.dll" "$(TargetDir)CUESDK.x64_2013.dll"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project> </Project>

View File

@ -2,21 +2,22 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>CUE.NET</id> <id>CUE.NET</id>
<title>CUE.NET</title>
<version>0.1.0</version> <version>0.1.0</version>
<title>C# Wrapper library around the Corsair CUE SDK</title> <authors>Darth Affe</authors>
<authors>DarthAffe</authors> <owners>Darth Affe</owners>
<owners>DarthAffe</owners> <projectUrl>https://github.com/DarthAffe/CUE.NET</projectUrl>
<licenseUrl>https://raw.githubusercontent.com/DarthAffe/CUE.NET/master/LICENSE</licenseUrl> <licenseUrl>https://raw.githubusercontent.com/DarthAffe/CUE.NET/master/LICENSE</licenseUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance> <requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Corsair HID SDK Wrapper</description> <description>Corsair HID SDK Wrapper</description>
<summary>C# (.NET) Wrapper library around the Corsair CUE-SDK <summary>C# (.NET) Wrapper library around the Corsair CUE-SDK</summary>
<copyright>Copyright © Wyrez 2015</copyright>
I'm currently working on this library and it's far from being finished. Please be patient (or drop me a message) if something is missing, behave</summary>
<copyright>2015 DarthAffe</copyright>
<language>en-US</language> <language>en-US</language>
</metadata> </metadata>
<files> <files>
<file src="bin\x64\CUE.NET.dll" target="lib\net46\CUE.NET.dll" /> <file src="bin\CUE.NET.dll" target="lib\net46\CUE.NET.dll" />
<file src="bin\x64\CUESDK.x64_2013.dll" target="build\net46\x64" /> <file src="bin\x64\" target="build\net46\libs\x64" />
<file src="bin\x86\" target="build\net46\libs\x86" />
<file src="CUE.NET.targets" target="build\net46\CUE.NET.targets" />
</files> </files>
</package> </package>

View File

@ -9,35 +9,47 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{1F
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleDevTest", "Examples\SimpleDevTest\SimpleDevTest.csproj", "{7FD88256-5E14-4D7C-862B-7BC2CD04081A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleDevTest", "Examples\SimpleDevTest\SimpleDevTest.csproj", "{7FD88256-5E14-4D7C-862B-7BC2CD04081A}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FF50AF6A-D2AC-4772-B013-C10D127DBE29}"
ProjectSection(SolutionItems) = preProject
CUE.NET.nuspec = CUE.NET.nuspec
CUE.NET.targets = CUE.NET.targets
nuget.exe = nuget.exe
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{D69EF6D8-68FF-4C56-B5CB-253971B1DF91}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "x86", "x86", "{0525D895-E706-4920-8733-DABD9194BFB1}"
ProjectSection(SolutionItems) = preProject
libs\x86\CUESDK_2013.dll = libs\x86\CUESDK_2013.dll
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "x64", "x64", "{2F99124B-FAED-432D-B797-45566D373411}"
ProjectSection(SolutionItems) = preProject
libs\x64\CUESDK_2013.dll = libs\x64\CUESDK_2013.dll
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64 Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{70A266B5-E9D4-4EAA-A91A-947C0039FFB6}.Debug|x64.ActiveCfg = Release|x64 {70A266B5-E9D4-4EAA-A91A-947C0039FFB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{70A266B5-E9D4-4EAA-A91A-947C0039FFB6}.Debug|x64.Build.0 = Release|x64 {70A266B5-E9D4-4EAA-A91A-947C0039FFB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70A266B5-E9D4-4EAA-A91A-947C0039FFB6}.Debug|x86.ActiveCfg = Release|x86 {70A266B5-E9D4-4EAA-A91A-947C0039FFB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70A266B5-E9D4-4EAA-A91A-947C0039FFB6}.Debug|x86.Build.0 = Release|x86 {70A266B5-E9D4-4EAA-A91A-947C0039FFB6}.Release|Any CPU.Build.0 = Release|Any CPU
{70A266B5-E9D4-4EAA-A91A-947C0039FFB6}.Release|x64.ActiveCfg = Release|x64 {7FD88256-5E14-4D7C-862B-7BC2CD04081A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{70A266B5-E9D4-4EAA-A91A-947C0039FFB6}.Release|x64.Build.0 = Release|x64 {7FD88256-5E14-4D7C-862B-7BC2CD04081A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70A266B5-E9D4-4EAA-A91A-947C0039FFB6}.Release|x86.ActiveCfg = Release|x86 {7FD88256-5E14-4D7C-862B-7BC2CD04081A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70A266B5-E9D4-4EAA-A91A-947C0039FFB6}.Release|x86.Build.0 = Release|x86 {7FD88256-5E14-4D7C-862B-7BC2CD04081A}.Release|Any CPU.Build.0 = Release|Any CPU
{7FD88256-5E14-4D7C-862B-7BC2CD04081A}.Debug|x64.ActiveCfg = Debug|x64
{7FD88256-5E14-4D7C-862B-7BC2CD04081A}.Debug|x64.Build.0 = Debug|x64
{7FD88256-5E14-4D7C-862B-7BC2CD04081A}.Debug|x86.ActiveCfg = Debug|x86
{7FD88256-5E14-4D7C-862B-7BC2CD04081A}.Debug|x86.Build.0 = Debug|x86
{7FD88256-5E14-4D7C-862B-7BC2CD04081A}.Release|x64.ActiveCfg = Release|x64
{7FD88256-5E14-4D7C-862B-7BC2CD04081A}.Release|x64.Build.0 = Release|x64
{7FD88256-5E14-4D7C-862B-7BC2CD04081A}.Release|x86.ActiveCfg = Release|x86
{7FD88256-5E14-4D7C-862B-7BC2CD04081A}.Release|x86.Build.0 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{7FD88256-5E14-4D7C-862B-7BC2CD04081A} = {1F52DDC9-E9D0-4A7B-8E78-930528203EE6} {7FD88256-5E14-4D7C-862B-7BC2CD04081A} = {1F52DDC9-E9D0-4A7B-8E78-930528203EE6}
{D69EF6D8-68FF-4C56-B5CB-253971B1DF91} = {FF50AF6A-D2AC-4772-B013-C10D127DBE29}
{0525D895-E706-4920-8733-DABD9194BFB1} = {D69EF6D8-68FF-4C56-B5CB-253971B1DF91}
{2F99124B-FAED-432D-B797-45566D373411} = {D69EF6D8-68FF-4C56-B5CB-253971B1DF91}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

127
CUE.NET.targets Normal file
View File

@ -0,0 +1,127 @@
<!--
* Build targets hacked from SQLite (thanks!)
* System.Data.SQLite.Core.targets -
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
******************************************************************************
** Build Items **
******************************************************************************
-->
<ItemGroup>
<CueNETSDKFiles Condition="'$(MSBuildThisFileDirectory)' != '' And
HasTrailingSlash('$(MSBuildThisFileDirectory)')"
Include="$(MSBuildThisFileDirectory)libs\**\*.dll" />
</ItemGroup>
<!--
******************************************************************************
** Content Items **
******************************************************************************
-->
<ItemGroup Condition="'$(ContentCueNETSDKFiles)' != '' And
'$(ContentCueNETSDKFiles)' != 'false' And
'@(CueNETSDKFiles)' != ''">
<Content Include="@(CueNETSDKFiles)">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<!--
******************************************************************************
** Build Targets* **
******************************************************************************
-->
<Target Name="CopyCueNETSDKFiles"
Condition="'$(CopyCueNETSDKFiles)' != 'false' And
'$(OutDir)' != '' And
HasTrailingSlash('$(OutDir)') And
Exists('$(OutDir)')"
Inputs="@(CueNETSDKFiles)"
Outputs="@(CueNETSDKFiles -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')">
<!--
NOTE: Copy "CUESDK*.dll" and all related files, for every
architecture that we support, to the build output directory.
-->
<Message Text="Copying SDK files..." Importance="high" />
<Copy SourceFiles="@(CueNETSDKFiles)"
DestinationFiles="@(CueNETSDKFiles -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<!--
******************************************************************************
-->
<Target Name="CleanCueNETSDKFiles"
Condition="'$(CleanCueNETSDKFiles)' != 'false' And
'$(OutDir)' != '' And
HasTrailingSlash('$(OutDir)') And
Exists('$(OutDir)')">
<!--
NOTE: Delete "CUESDK*.dll" and all related files, for every
architecture that we support, from the build output directory.
-->
<Message Text="this file $(MSBuildThisFileDirectory)" Importance="high"/>
<Message Text="Cleaning SDK files..." Importance="high" />
<Delete Files="@(CueNETSDKFiles -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<!--
******************************************************************************
-->
<Target Name="CollectCueNETSDKFiles"
Condition="'$(CollectCueNETSDKFiles)' != 'false'">
<Message Text="Collecting SDK files..." Importance="high" />
<ItemGroup>
<FilesForPackagingFromProject Include="@(CueNETSDKFiles)">
<DestinationRelativePath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<!--
******************************************************************************
** Build Properties **
******************************************************************************
-->
<PropertyGroup>
<PostBuildEventDependsOn>
$(PostBuildEventDependsOn);
CopyCueNETSDKFiles;
</PostBuildEventDependsOn>
<BuildDependsOn>
$(BuildDependsOn);
CopyCueNETSDKFiles;
</BuildDependsOn>
<CleanDependsOn>
$(CleanDependsOn);
CleanCueNETSDKFiles;
</CleanDependsOn>
</PropertyGroup>
<!--
******************************************************************************
** Publish Properties for Visual Studio 201x **
******************************************************************************
-->
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' Or
'$(VisualStudioVersion)' == '10.0' Or
'$(VisualStudioVersion)' == '11.0' Or
'$(VisualStudioVersion)' == '12.0'">
<PipelineCollectFilesPhaseDependsOn>
CollectCueNETSDKFiles;
$(PipelineCollectFilesPhaseDependsOn);
</PipelineCollectFilesPhaseDependsOn>
</PropertyGroup>
</Project>

View File

@ -17,6 +17,7 @@ namespace CUE.NET
// ReSharper disable UnusedAutoPropertyAccessor.Global // ReSharper disable UnusedAutoPropertyAccessor.Global
public static string LoadedArchitecture => _CUESDK.LoadedArchitecture;
public static CorsairProtocolDetails ProtocolDetails { get; private set; } public static CorsairProtocolDetails ProtocolDetails { get; private set; }
public static bool HasExclusiveAccess { get; private set; } public static bool HasExclusiveAccess { get; private set; }
public static CorsairError LastError => _CUESDK.CorsairGetLastError(); public static CorsairError LastError => _CUESDK.CorsairGetLastError();

View File

@ -30,6 +30,7 @@ namespace SimpleDevTest
{ {
// Initialize CUE-SDK // Initialize CUE-SDK
CueSDK.Initialize(); CueSDK.Initialize();
Console.WriteLine("Initialized with " + CueSDK.LoadedArchitecture + "-SDK");
// Get connected keyboard or throw exception if there is no light controllable keyboard connected // Get connected keyboard or throw exception if there is no light controllable keyboard connected
CorsairKeyboard keyboard = CueSDK.KeyboardSDK; CorsairKeyboard keyboard = CueSDK.KeyboardSDK;

View File

@ -13,42 +13,22 @@
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\</OutputPath> <OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\x64\</OutputPath> <OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
@ -79,8 +59,8 @@
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>if $(PlatformName) == x86 copy "$(SolutionDir)libs\CUESDK_2013.dll" "$(TargetDir)CUESDK_2013.dll" <PostBuildEvent>xcopy "$(SolutionDir)libs\x64\CUESDK_2013.dll" "$(TargetDir)x64\" /y
if $(PlatformName) == x64 copy "$(SolutionDir)libs\CUESDK.x64_2013.dll" "$(TargetDir)CUESDK.x64_2013.dll"</PostBuildEvent> xcopy "$(SolutionDir)libs\x86\CUESDK_2013.dll" "$(TargetDir)x86\" /y</PostBuildEvent>
</PropertyGroup> </PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -8,11 +8,24 @@ namespace CUE.NET.Native
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
internal static class _CUESDK internal static class _CUESDK
{ {
#if WIN64 #region Libary Management
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#else internal static string LoadedArchitecture { get; private set; }
static _CUESDK()
{
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
LoadLibrary((LoadedArchitecture = Environment.Is64BitProcess ? "x64" : "x86") + "/CUESDK_2013.dll");
}
[DllImport("kernel32.dll")]
private static extern IntPtr LoadLibrary(string dllToLoad);
#endregion
#region SDK-IMPORTS
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#endif
// set specified leds to some colors. The color is retained until changed by successive calls. This function does not take logical layout into account // set specified leds to some colors. The color is retained until changed by successive calls. This function does not take logical layout into account
internal static extern bool CorsairSetLedsColors(int size, IntPtr ledsColors); internal static extern bool CorsairSetLedsColors(int size, IntPtr ledsColors);
@ -23,60 +36,34 @@ namespace CUE.NET.Native
//#endif //#endif
//internal static extern bool CorsairSetLedsColorsAsync(int size, CorsairLedColor* ledsColors, void(*CallbackType)(void*, bool, CorsairError), void* context); //internal static extern bool CorsairSetLedsColorsAsync(int size, CorsairLedColor* ledsColors, void(*CallbackType)(void*, bool, CorsairError), void* context);
#if WIN64
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#else
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#endif
// returns number of connected Corsair devices that support lighting control. // returns number of connected Corsair devices that support lighting control.
internal static extern int CorsairGetDeviceCount(); internal static extern int CorsairGetDeviceCount();
#if WIN64
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#else
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#endif
// returns information about device at provided index // returns information about device at provided index
internal static extern IntPtr CorsairGetDeviceInfo(int deviceIndex); internal static extern IntPtr CorsairGetDeviceInfo(int deviceIndex);
#if WIN64
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#else
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#endif
// provides list of keyboard LEDs with their physical positions. // provides list of keyboard LEDs with their physical positions.
internal static extern IntPtr CorsairGetLedPositions(); internal static extern IntPtr CorsairGetLedPositions();
#if WIN64
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#else
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#endif
// retrieves led id for key name taking logical layout into account. // retrieves led id for key name taking logical layout into account.
internal static extern CorsairKeyboardKeyId CorsairGetLedIdForKeyName(char keyName); internal static extern CorsairKeyboardKeyId CorsairGetLedIdForKeyName(char keyName);
#if WIN64
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#else
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#endif
// requestes control using specified access mode. By default client has shared control over lighting so there is no need to call CorsairRequestControl unless client requires exclusive control // requestes control using specified access mode. By default client has shared control over lighting so there is no need to call CorsairRequestControl unless client requires exclusive control
internal static extern bool CorsairRequestControl(CorsairAccessMode accessMode); internal static extern bool CorsairRequestControl(CorsairAccessMode accessMode);
#if WIN64
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#else
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#endif
// checks file and protocol version of CUE to understand which of SDK functions can be used with this version of CUE // checks file and protocol version of CUE to understand which of SDK functions can be used with this version of CUE
internal static extern _CorsairProtocolDetails CorsairPerformProtocolHandshake(); internal static extern _CorsairProtocolDetails CorsairPerformProtocolHandshake();
#if WIN64
[DllImport("CUESDK.x64_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#else
[DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)]
#endif
// returns last error that occured while using any of Corsair* functions // returns last error that occured while using any of Corsair* functions
internal static extern CorsairError CorsairGetLastError(); internal static extern CorsairError CorsairGetLastError();
#endregion
} }
} }

Binary file not shown.

Binary file not shown.

BIN
nuget.exe Normal file

Binary file not shown.