mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-12 17:48:31 +00:00
Fixed Corsair-Devices to be actually usable
This commit is contained in:
parent
654450be3f
commit
d64f019d89
@ -13,12 +13,17 @@
|
||||
<releaseNotes></releaseNotes>
|
||||
<summary>Corsair-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals</summary>
|
||||
<copyright>Copyright © Wyrez 2017</copyright>
|
||||
<language>en-US</language>
|
||||
<language>en-US</language>
|
||||
<dependencies>
|
||||
<dependency id="RGB.NET.Core" version="1.0" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="..\bin\RGB.NET.Devices.Corsair.dll" target="lib\net45\RGB.NET.Devices.Corsair.dll" />
|
||||
<file src="..\bin\RGB.NET.Devices.Corsair.pdb" target="lib\net45\RGB.NET.Devices.Corsair.pdb" />
|
||||
<file src="..\bin\RGB.NET.Devices.Corsair.xml" target="lib\net45\RGB.NET.Devices.Corsair.xml" />
|
||||
<file src="..\RGB.NET.Devices.Corsair\**\*.cs" target="src" exclude="..\RGB.NET.Devices.Corsair\obj\**\*.*" />
|
||||
<file src="..\RGB.NET.Devices.Corsair\libs\**\*.*" target="build\net45\libs\" />
|
||||
<file src="..\RGB.NET.Devices.Corsair\targets\*.targets" target="build\net45\" />
|
||||
</files>
|
||||
</package>
|
||||
@ -51,7 +51,19 @@ namespace RGB.NET.Devices.Corsair
|
||||
/// <exception cref="CUEException">Thrown if the CUE-SDK provides an error.</exception>
|
||||
public bool Initialize(bool exclusiveAccessIfPossible = false, bool throwExceptions = false)
|
||||
{
|
||||
_CUESDK.Reload();
|
||||
IsInitialized = false;
|
||||
|
||||
try
|
||||
{
|
||||
_CUESDK.Reload();
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (throwExceptions)
|
||||
throw;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
ProtocolDetails = new CorsairProtocolDetails(_CUESDK.CorsairPerformProtocolHandshake());
|
||||
|
||||
@ -160,7 +172,14 @@ namespace RGB.NET.Devices.Corsair
|
||||
public void ResetDevices()
|
||||
{
|
||||
if (IsInitialized)
|
||||
_CUESDK.Reload();
|
||||
try
|
||||
{
|
||||
_CUESDK.Reload();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// shit happens ...
|
||||
}
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
|
||||
@ -41,9 +41,7 @@ namespace RGB.NET.Devices.Corsair
|
||||
protected override void InitializeLeds()
|
||||
{
|
||||
_CorsairLedPositions nativeLedPositions =
|
||||
(_CorsairLedPositions)
|
||||
Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(KeyboardDeviceInfo.CorsairDeviceIndex),
|
||||
typeof(_CorsairLedPositions));
|
||||
(_CorsairLedPositions)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositions(), typeof(_CorsairLedPositions));
|
||||
|
||||
int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition));
|
||||
IntPtr ptr = nativeLedPositions.pLedPosition;
|
||||
|
||||
@ -77,8 +77,12 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="targets\RGB.NET.Devices.Corsair.targets" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="libs\x64\CUESDK_2015.dll" />
|
||||
<None Include="libs\x86\CUESDK_2015.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- 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.
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=libs/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=native/@EntryIndexedValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mousmat/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mouse/@EntryIndexedValue">True</s:Boolean>
|
||||
@ -6,4 +7,5 @@
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=keyboard/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=generic/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=exceptions/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=enum/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=enum/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=targets/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
BIN
RGB.NET.Devices.Corsair/libs/x64/CUESDK_2015.dll
Normal file
BIN
RGB.NET.Devices.Corsair/libs/x64/CUESDK_2015.dll
Normal file
Binary file not shown.
BIN
RGB.NET.Devices.Corsair/libs/x86/CUESDK_2015.dll
Normal file
BIN
RGB.NET.Devices.Corsair/libs/x86/CUESDK_2015.dll
Normal file
Binary file not shown.
150
RGB.NET.Devices.Corsair/targets/RGB.NET.Devices.Corsair.targets
Normal file
150
RGB.NET.Devices.Corsair/targets/RGB.NET.Devices.Corsair.targets
Normal file
@ -0,0 +1,150 @@
|
||||
<!--
|
||||
* Build targets hacked from SQLite (thanks!)
|
||||
* System.Data.SQLite.Core.targets -
|
||||
-->
|
||||
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<!--
|
||||
******************************************************************************
|
||||
** Build Items **
|
||||
******************************************************************************
|
||||
-->
|
||||
|
||||
<ItemGroup>
|
||||
<CueSDKFiles Condition="'$(MSBuildThisFileDirectory)' != '' And
|
||||
HasTrailingSlash('$(MSBuildThisFileDirectory)')"
|
||||
Include="$(MSBuildThisFileDirectory)libs\**\*.dll" />
|
||||
|
||||
<AdditionalPublishFilex86 Include="$(MSBuildThisFileDirectory)libs\x86\*.dll">
|
||||
<Visible>False</Visible>
|
||||
</AdditionalPublishFilex86>
|
||||
<AdditionalPublishFilex64 Include="$(MSBuildThisFileDirectory)libs\x64\*.dll">
|
||||
<Visible>False</Visible>
|
||||
</AdditionalPublishFilex64>
|
||||
</ItemGroup>
|
||||
|
||||
<!--
|
||||
******************************************************************************
|
||||
** Content Items **
|
||||
******************************************************************************
|
||||
-->
|
||||
|
||||
<ItemGroup Condition="'$(ContentCueSDKFiles)' != '' And
|
||||
'$(ContentCueSDKFiles)' != 'false' And
|
||||
'@(CueSDKFiles)' != ''">
|
||||
<Content Include="@(CueSDKFiles)">
|
||||
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<!--
|
||||
******************************************************************************
|
||||
** Build Targets* **
|
||||
******************************************************************************
|
||||
-->
|
||||
|
||||
<Target Name="CopyCueSDKFiles"
|
||||
Condition="'$(CopyCueSDKFiles)' != 'false' And
|
||||
'$(OutDir)' != '' And
|
||||
HasTrailingSlash('$(OutDir)') And
|
||||
Exists('$(OutDir)')"
|
||||
Inputs="@(CueSDKFiles)"
|
||||
Outputs="@(CueSDKFiles -> '$(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="@(CueSDKFiles)"
|
||||
DestinationFiles="@(CueSDKFiles -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
******************************************************************************
|
||||
-->
|
||||
|
||||
<Target Name="CleanCueSDKFiles"
|
||||
Condition="'$(CleanCueSDKFiles)' != '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="@(CueSDKFiles -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
******************************************************************************
|
||||
-->
|
||||
|
||||
<Target Name="CollectCueSDKFiles"
|
||||
Condition="'$(CollectCueSDKFiles)' != 'false'">
|
||||
<Message Text="Collecting SDK files..." Importance="high" />
|
||||
<ItemGroup>
|
||||
<FilesForPackagingFromProject Include="@(CueSDKFiles)">
|
||||
<DestinationRelativePath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
|
||||
</FilesForPackagingFromProject>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
******************************************************************************
|
||||
-->
|
||||
|
||||
<Target Name="BeforePublish">
|
||||
<Touch Files="@(IntermediateAssembly)" />
|
||||
</Target>
|
||||
<Target Name="BeforeBuild">
|
||||
<CreateItem Include="@(AdditionalPublishFilex86)" AdditionalMetadata="TargetPath=x86\%(FileName)%(Extension);IsDataFile=false">
|
||||
<Output TaskParameter="Include" ItemName="_DeploymentManifestFiles" />
|
||||
</CreateItem>
|
||||
<CreateItem Include="@(AdditionalPublishFilex64)" AdditionalMetadata="TargetPath=x64\%(FileName)%(Extension);IsDataFile=false">
|
||||
<Output TaskParameter="Include" ItemName="_DeploymentManifestFiles" />
|
||||
</CreateItem>
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
******************************************************************************
|
||||
** Build Properties **
|
||||
******************************************************************************
|
||||
-->
|
||||
|
||||
<PropertyGroup>
|
||||
<PostBuildEventDependsOn>
|
||||
$(PostBuildEventDependsOn);
|
||||
CopyCueSDKFiles;
|
||||
</PostBuildEventDependsOn>
|
||||
<BuildDependsOn>
|
||||
$(BuildDependsOn);
|
||||
CopyCueSDKFiles;
|
||||
</BuildDependsOn>
|
||||
<CleanDependsOn>
|
||||
$(CleanDependsOn);
|
||||
CleanCueSDKFiles;
|
||||
</CleanDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--
|
||||
******************************************************************************
|
||||
** Publish Properties for Visual Studio 201x **
|
||||
******************************************************************************
|
||||
-->
|
||||
|
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' Or
|
||||
'$(VisualStudioVersion)' == '10.0' Or
|
||||
'$(VisualStudioVersion)' == '11.0' Or
|
||||
'$(VisualStudioVersion)' == '12.0'">
|
||||
<PipelineCollectFilesPhaseDependsOn>
|
||||
CollectCueSDKFiles;
|
||||
$(PipelineCollectFilesPhaseDependsOn);
|
||||
</PipelineCollectFilesPhaseDependsOn>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Loading…
x
Reference in New Issue
Block a user