diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 8bd9c68..ce4ce9d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -5,6 +5,9 @@ on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
+ defaults:
+ run:
+ working-directory: open-cue-service
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index d116e64..535be20 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -8,9 +8,10 @@ on:
jobs:
CodeQL-Build:
-
runs-on: ubuntu-latest
-
+ defaults:
+ run:
+ working-directory: open-cue-service
steps:
- name: Checkout repository
uses: actions/checkout@v2
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
index 91faff4..99df5ff 100644
--- a/.github/workflows/pages.yml
+++ b/.github/workflows/pages.yml
@@ -8,6 +8,9 @@ on:
jobs:
generate-openapi-spec:
runs-on: windows-latest
+ defaults:
+ run:
+ working-directory: open-cue-service
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
@@ -28,6 +31,9 @@ jobs:
deploy:
needs: generate-openapi-spec
runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: open-cue-service
steps:
- name: Download openapi.json
uses: actions/download-artifact@v2
diff --git a/OpenCue.sln b/OpenCue.sln
new file mode 100644
index 0000000..1211d72
--- /dev/null
+++ b/OpenCue.sln
@@ -0,0 +1,48 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26124.0
+MinimumVisualStudioVersion = 15.0.26124.0
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "open-cue-sdk", "open-cue-sdk\open-cue-sdk.csproj", "{CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "open-cue-service", "open-cue-service\open-cue-service.csproj", "{881E44AF-8A08-4748-8CD2-16905CD10D7F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}.Debug|x64.Build.0 = Debug|Any CPU
+ {CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}.Debug|x86.Build.0 = Debug|Any CPU
+ {CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}.Release|x64.ActiveCfg = Release|Any CPU
+ {CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}.Release|x64.Build.0 = Release|Any CPU
+ {CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}.Release|x86.ActiveCfg = Release|Any CPU
+ {CCA93F9E-75D1-45C9-BD63-4C0D2FBDA225}.Release|x86.Build.0 = Release|Any CPU
+ {881E44AF-8A08-4748-8CD2-16905CD10D7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {881E44AF-8A08-4748-8CD2-16905CD10D7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {881E44AF-8A08-4748-8CD2-16905CD10D7F}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {881E44AF-8A08-4748-8CD2-16905CD10D7F}.Debug|x64.Build.0 = Debug|Any CPU
+ {881E44AF-8A08-4748-8CD2-16905CD10D7F}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {881E44AF-8A08-4748-8CD2-16905CD10D7F}.Debug|x86.Build.0 = Debug|Any CPU
+ {881E44AF-8A08-4748-8CD2-16905CD10D7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {881E44AF-8A08-4748-8CD2-16905CD10D7F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {881E44AF-8A08-4748-8CD2-16905CD10D7F}.Release|x64.ActiveCfg = Release|Any CPU
+ {881E44AF-8A08-4748-8CD2-16905CD10D7F}.Release|x64.Build.0 = Release|Any CPU
+ {881E44AF-8A08-4748-8CD2-16905CD10D7F}.Release|x86.ActiveCfg = Release|Any CPU
+ {881E44AF-8A08-4748-8CD2-16905CD10D7F}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/README.md b/README.md
index 7afe9aa..495cf2b 100644
--- a/README.md
+++ b/README.md
@@ -51,5 +51,5 @@ Restart iCUE and Open CUE Service after you have changed any file.
## License
This project is distributed under [Apache License, Version 2.0](LICENSE).
-The software iCUE and the file CgSDK.x64_2015.dll are supplied by Corsair Components, Inc. and distributed under different terms.
+The software iCUE and the file `lib/CgSDK.x64_2015.dll` are supplied by Corsair Components, Inc. and distributed under different terms.
For more information, contact Corsair Components, Inc.
diff --git a/CgSDK.x64_2015.dll b/open-cue-sdk/lib/CgSDK.x64_2015.dll
similarity index 100%
rename from CgSDK.x64_2015.dll
rename to open-cue-sdk/lib/CgSDK.x64_2015.dll
diff --git a/open-cue-sdk/open-cue-sdk.csproj b/open-cue-sdk/open-cue-sdk.csproj
new file mode 100644
index 0000000..35e84d2
--- /dev/null
+++ b/open-cue-sdk/open-cue-sdk.csproj
@@ -0,0 +1,35 @@
+
+
+ Open CUE SDK
+ 0.5.0
+ Legion2
+ Wrapper of the Corsair Game SDK
+ Apache-2.0
+ https://github.com/Legion2/open-cue-service
+ Library
+ net5.0
+ OpenCue.Sdk
+ win-x64
+ true
+ OpenCUE.SDK
+
+ 9.0
+ enable
+
+
+ None
+
+
+
+
+
+ lib/CgSDK.x64_2015.dll
+
+
+
diff --git a/open-cue-sdk/src/CgSdkInterop.cs b/open-cue-sdk/src/CgSdkInterop.cs
new file mode 100644
index 0000000..9374150
--- /dev/null
+++ b/open-cue-sdk/src/CgSdkInterop.cs
@@ -0,0 +1,28 @@
+using System.Runtime.InteropServices;
+
+namespace OpenCue.Sdk
+{
+ internal class CgSdkInterop
+ {
+ [DllImport("lib/CgSDK.x64_2015.dll", EntryPoint="CgSdkClearAllEvents", CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool ClearAllEvents();
+ [DllImport("lib/CgSDK.x64_2015.dll", EntryPoint="CgSdkClearAllStates", CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool ClearAllStates();
+ [DllImport("lib/CgSDK.x64_2015.dll", EntryPoint="CgSdkClearState", CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool ClearState(string gameName);
+ [DllImport("lib/CgSDK.x64_2015.dll", EntryPoint="CgSdkGetLastError", CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int GetLastError();
+ [DllImport("lib/CgSDK.x64_2015.dll", EntryPoint="CgSdkPerformProtocolHandshake", CallingConvention=CallingConvention.Cdecl)]
+ internal static extern _CorsairProtocolDetails PerformProtocolHandshake();
+ [DllImport("lib/CgSDK.x64_2015.dll", EntryPoint="CgSdkReleaseControl", CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool ReleaseControl();
+ [DllImport("lib/CgSDK.x64_2015.dll", EntryPoint="CgSdkRequestControl", CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool RequestControl();
+ [DllImport("lib/CgSDK.x64_2015.dll", EntryPoint="CgSdkSetEvent", CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool SetEvent(string gameName);
+ [DllImport("lib/CgSDK.x64_2015.dll", EntryPoint="CgSdkSetGame", CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool SetGame(string gameName);
+ [DllImport("lib/CgSDK.x64_2015.dll", EntryPoint="CgSdkSetState", CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool SetState(string gameName);
+ }
+}
\ No newline at end of file
diff --git a/src/CgSdk/CorsairGameSdk.cs b/open-cue-sdk/src/CorsairGameSdk.cs
similarity index 99%
rename from src/CgSdk/CorsairGameSdk.cs
rename to open-cue-sdk/src/CorsairGameSdk.cs
index 0cc47b0..d142045 100644
--- a/src/CgSdk/CorsairGameSdk.cs
+++ b/open-cue-sdk/src/CorsairGameSdk.cs
@@ -1,6 +1,6 @@
using System;
-namespace OpenCueService.CgSdk
+namespace OpenCue.Sdk
{
public class CorsairGameSdk
{
diff --git a/src/CgSdk/CorsairProtocolDetails.cs b/open-cue-sdk/src/CorsairProtocolDetails.cs
similarity index 98%
rename from src/CgSdk/CorsairProtocolDetails.cs
rename to open-cue-sdk/src/CorsairProtocolDetails.cs
index 0f158a7..881e0a1 100644
--- a/src/CgSdk/CorsairProtocolDetails.cs
+++ b/open-cue-sdk/src/CorsairProtocolDetails.cs
@@ -2,7 +2,7 @@
using System;
using System.Runtime.InteropServices;
-namespace OpenCueService.CgSdk
+namespace OpenCue.Sdk
{
[StructLayout(LayoutKind.Sequential)]
internal struct _CorsairProtocolDetails
diff --git a/.config/dotnet-tools.json b/open-cue-service/.config/dotnet-tools.json
similarity index 100%
rename from .config/dotnet-tools.json
rename to open-cue-service/.config/dotnet-tools.json
diff --git a/appsettings.Development.json b/open-cue-service/appsettings.Development.json
similarity index 100%
rename from appsettings.Development.json
rename to open-cue-service/appsettings.Development.json
diff --git a/appsettings.json b/open-cue-service/appsettings.json
similarity index 100%
rename from appsettings.json
rename to open-cue-service/appsettings.json
diff --git a/nswag.json b/open-cue-service/nswag.json
similarity index 100%
rename from nswag.json
rename to open-cue-service/nswag.json
diff --git a/open-cue-service.csproj b/open-cue-service/open-cue-service.csproj
similarity index 72%
rename from open-cue-service.csproj
rename to open-cue-service/open-cue-service.csproj
index 23d07f9..3d15692 100644
--- a/open-cue-service.csproj
+++ b/open-cue-service/open-cue-service.csproj
@@ -8,7 +8,7 @@
https://github.com/Legion2/open-cue-service
Exe
net5.0
- OpenCueService
+ OpenCue.Service
win-x64
true
true
@@ -24,10 +24,20 @@
-
+
+
+ PreserveNewest
+
+
+
+
+ all
+ Always
+
+
diff --git a/src/Config.cs b/open-cue-service/src/Config.cs
similarity index 96%
rename from src/Config.cs
rename to open-cue-service/src/Config.cs
index 38a80ed..9399152 100644
--- a/src/Config.cs
+++ b/open-cue-service/src/Config.cs
@@ -1,4 +1,4 @@
-namespace OpenCueService
+namespace OpenCue.Service
{
public class Config
{
diff --git a/src/Controllers/ApiError.cs b/open-cue-service/src/Controllers/ApiError.cs
similarity index 92%
rename from src/Controllers/ApiError.cs
rename to open-cue-service/src/Controllers/ApiError.cs
index 210d768..95c381d 100644
--- a/src/Controllers/ApiError.cs
+++ b/open-cue-service/src/Controllers/ApiError.cs
@@ -1,6 +1,6 @@
using System;
-namespace OpenCueService
+namespace OpenCue.Service
{
public class ApiError : Exception
{
diff --git a/src/Controllers/ApiErrorFilter.cs b/open-cue-service/src/Controllers/ApiErrorFilter.cs
similarity index 94%
rename from src/Controllers/ApiErrorFilter.cs
rename to open-cue-service/src/Controllers/ApiErrorFilter.cs
index ce3ce0f..3203a61 100644
--- a/src/Controllers/ApiErrorFilter.cs
+++ b/open-cue-service/src/Controllers/ApiErrorFilter.cs
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
-namespace OpenCueService.Controllers
+namespace OpenCue.Service.Controllers
{
public class ApiErrorFilter : IActionFilter, IOrderedFilter
{
diff --git a/src/Controllers/DefaultController.cs b/open-cue-service/src/Controllers/DefaultController.cs
similarity index 92%
rename from src/Controllers/DefaultController.cs
rename to open-cue-service/src/Controllers/DefaultController.cs
index d653676..42b9320 100644
--- a/src/Controllers/DefaultController.cs
+++ b/open-cue-service/src/Controllers/DefaultController.cs
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Mvc;
-namespace OpenCueService
+namespace OpenCue.Service
{
[ApiExplorerSettings(IgnoreApi = true)]
public class DefaultController : Controller
diff --git a/src/Controllers/ProfilesController.cs b/open-cue-service/src/Controllers/ProfilesController.cs
similarity index 97%
rename from src/Controllers/ProfilesController.cs
rename to open-cue-service/src/Controllers/ProfilesController.cs
index 3c790c0..92eafc6 100644
--- a/src/Controllers/ProfilesController.cs
+++ b/open-cue-service/src/Controllers/ProfilesController.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
-namespace OpenCueService.Controllers
+namespace OpenCue.Service.Controllers
{
[ApiController]
[Route("api/profiles")]
diff --git a/src/Controllers/SdkController.cs b/open-cue-service/src/Controllers/SdkController.cs
similarity index 96%
rename from src/Controllers/SdkController.cs
rename to open-cue-service/src/Controllers/SdkController.cs
index ae247c2..09c34bb 100644
--- a/src/Controllers/SdkController.cs
+++ b/open-cue-service/src/Controllers/SdkController.cs
@@ -1,8 +1,8 @@
using Microsoft.AspNetCore.Mvc;
+using OpenCue.Sdk;
-namespace OpenCueService.Controllers
+namespace OpenCue.Service.Controllers
{
- using CgSdk;
[ApiController]
[Route("api/sdk")]
public class SdkController : ControllerBase
diff --git a/src/Controllers/SdkExceptionFilter.cs b/open-cue-service/src/Controllers/SdkExceptionFilter.cs
similarity index 92%
rename from src/Controllers/SdkExceptionFilter.cs
rename to open-cue-service/src/Controllers/SdkExceptionFilter.cs
index 85da720..f6dacf0 100644
--- a/src/Controllers/SdkExceptionFilter.cs
+++ b/open-cue-service/src/Controllers/SdkExceptionFilter.cs
@@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
+using OpenCue.Sdk;
-namespace OpenCueService.Controllers
+namespace OpenCue.Service.Controllers
{
- using CgSdk;
public class SdkExceptionFilter : IActionFilter, IOrderedFilter
{
public int Order { get; set; } = int.MaxValue - 10;
diff --git a/src/Profile.cs b/open-cue-service/src/Profile.cs
similarity index 86%
rename from src/Profile.cs
rename to open-cue-service/src/Profile.cs
index ace36c2..004c643 100644
--- a/src/Profile.cs
+++ b/open-cue-service/src/Profile.cs
@@ -1,4 +1,4 @@
-namespace OpenCueService
+namespace OpenCue.Service
{
public class Profile
{
diff --git a/src/ProfileManager.cs b/open-cue-service/src/ProfileManager.cs
similarity index 99%
rename from src/ProfileManager.cs
rename to open-cue-service/src/ProfileManager.cs
index ac47324..b2f4da6 100644
--- a/src/ProfileManager.cs
+++ b/open-cue-service/src/ProfileManager.cs
@@ -3,10 +3,10 @@
using System.Collections.Generic;
using System.IO;
using Microsoft.Extensions.Options;
+using OpenCue.Sdk;
-namespace OpenCueService
+namespace OpenCue.Service
{
- using CgSdk;
public class ProfileManager
{
private static readonly string GameSkdEffectsPath = @"c:\ProgramData\Corsair\CUE\GameSdkEffects";
diff --git a/src/Program.cs b/open-cue-service/src/Program.cs
similarity index 95%
rename from src/Program.cs
rename to open-cue-service/src/Program.cs
index 2690327..43c8254 100644
--- a/src/Program.cs
+++ b/open-cue-service/src/Program.cs
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
-namespace OpenCueService
+namespace OpenCue.Service
{
public class Program
{
diff --git a/src/SdkHandler.cs b/open-cue-service/src/SdkHandler.cs
similarity index 92%
rename from src/SdkHandler.cs
rename to open-cue-service/src/SdkHandler.cs
index 0293c2d..7e2b44e 100644
--- a/src/SdkHandler.cs
+++ b/open-cue-service/src/SdkHandler.cs
@@ -1,9 +1,8 @@
-using System;
-using Microsoft.Extensions.Options;
+using Microsoft.Extensions.Options;
+using OpenCue.Sdk;
-namespace OpenCueService
+namespace OpenCue.Service
{
- using CgSdk;
public class SdkHandler
{
private CorsairGameSdk CorsairGameSdk;
@@ -14,7 +13,8 @@ public SdkHandler(IOptions config)
ProfilesDirectoryName = config.Value.ProfilesDirectoryName;
CorsairGameSdk = new CorsairGameSdk(ProfilesDirectoryName);
}
- public void Reconnect() {
+ public void Reconnect()
+ {
CorsairGameSdk = new CorsairGameSdk(ProfilesDirectoryName);
}
public CorsairProtocolDetails GetCorsairProtocolDetails()
diff --git a/src/Startup.cs b/open-cue-service/src/Startup.cs
similarity index 98%
rename from src/Startup.cs
rename to open-cue-service/src/Startup.cs
index 3c7e358..82d40b7 100644
--- a/src/Startup.cs
+++ b/open-cue-service/src/Startup.cs
@@ -4,7 +4,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-namespace OpenCueService
+namespace OpenCue.Service
{
using Controllers;
public class Startup
diff --git a/src/SyncService.cs b/open-cue-service/src/SyncService.cs
similarity index 97%
rename from src/SyncService.cs
rename to open-cue-service/src/SyncService.cs
index 3f13c54..55af87e 100644
--- a/src/SyncService.cs
+++ b/open-cue-service/src/SyncService.cs
@@ -4,11 +4,10 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
+using OpenCue.Sdk;
-namespace OpenCueService
+namespace OpenCue.Service
{
- using CgSdk;
-
public class SyncService : IHostedService, IDisposable
{
private readonly ILogger _logger;
diff --git a/src/CgSdk/CgSdkInterop.cs b/src/CgSdk/CgSdkInterop.cs
deleted file mode 100644
index a0e26ac..0000000
--- a/src/CgSdk/CgSdkInterop.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace OpenCueService.CgSdk
-{
- internal class CgSdkInterop
- {
- [DllImport("CgSDK.x64_2015.dll", EntryPoint="CgSdkClearAllEvents", CallingConvention=CallingConvention.Cdecl)]
- internal static extern bool ClearAllEvents();
- [DllImport("CgSDK.x64_2015.dll", EntryPoint="CgSdkClearAllStates", CallingConvention=CallingConvention.Cdecl)]
- internal static extern bool ClearAllStates();
- [DllImport("CgSDK.x64_2015.dll", EntryPoint="CgSdkClearState", CallingConvention=CallingConvention.Cdecl)]
- internal static extern bool ClearState(string gameName);
- [DllImport("CgSDK.x64_2015.dll", EntryPoint="CgSdkGetLastError", CallingConvention=CallingConvention.Cdecl)]
- internal static extern int GetLastError();
- [DllImport("CgSDK.x64_2015.dll", EntryPoint="CgSdkPerformProtocolHandshake", CallingConvention=CallingConvention.Cdecl)]
- internal static extern _CorsairProtocolDetails PerformProtocolHandshake();
- [DllImport("CgSDK.x64_2015.dll", EntryPoint="CgSdkReleaseControl", CallingConvention=CallingConvention.Cdecl)]
- internal static extern bool ReleaseControl();
- [DllImport("CgSDK.x64_2015.dll", EntryPoint="CgSdkRequestControl", CallingConvention=CallingConvention.Cdecl)]
- internal static extern bool RequestControl();
- [DllImport("CgSDK.x64_2015.dll", EntryPoint="CgSdkSetEvent", CallingConvention=CallingConvention.Cdecl)]
- internal static extern bool SetEvent(string gameName);
- [DllImport("CgSDK.x64_2015.dll", EntryPoint="CgSdkSetGame", CallingConvention=CallingConvention.Cdecl)]
- internal static extern bool SetGame(string gameName);
- [DllImport("CgSDK.x64_2015.dll", EntryPoint="CgSdkSetState", CallingConvention=CallingConvention.Cdecl)]
- internal static extern bool SetState(string gameName);
- }
-}
\ No newline at end of file