Skip to content

Commit

Permalink
split into sdk and service close #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Legion2 committed Apr 14, 2021
1 parent 0390555 commit 46c882c
Show file tree
Hide file tree
Showing 29 changed files with 159 additions and 57 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
48 changes: 48 additions & 0 deletions OpenCue.sln
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
File renamed without changes.
35 changes: 35 additions & 0 deletions open-cue-sdk/open-cue-sdk.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Title>Open CUE SDK</Title>
<Version>0.5.0</Version>
<Authors>Legion2</Authors>
<Description>Wrapper of the Corsair Game SDK</Description>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<RepositoryUrl>https://github.com/Legion2/open-cue-service</RepositoryUrl>
<OutputType>Library</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>OpenCue.Sdk</RootNamespace>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<IsPackable>true</IsPackable>
<PackageId>OpenCUE.SDK</PackageId>

<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>None</DebugType>
</PropertyGroup>

<!--<ItemGroup>
<Content Update="lib/CgSDK.x64_2015.dll">
<Pack>true</Pack>
<PackagePath>lib/$(TargetFramework)</PackagePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>-->
<ItemGroup>
<Reference Include="MyAssembly">
<HintPath>lib/CgSDK.x64_2015.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
28 changes: 28 additions & 0 deletions open-cue-sdk/src/CgSdkInterop.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace OpenCueService.CgSdk
namespace OpenCue.Sdk
{
public class CorsairGameSdk
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System;
using System.Runtime.InteropServices;

namespace OpenCueService.CgSdk
namespace OpenCue.Sdk
{
[StructLayout(LayoutKind.Sequential)]
internal struct _CorsairProtocolDetails
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RepositoryUrl>https://github.com/Legion2/open-cue-service</RepositoryUrl>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>OpenCueService</RootNamespace>
<RootNamespace>OpenCue.Service</RootNamespace>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
Expand All @@ -24,10 +24,20 @@
<PackageReference Include="NSwag.AspNetCore" Version="13.10.8" />
</ItemGroup>
<ItemGroup>
<Content Include="CgSDK.x64_2015.dll" CopyToPublishDirectory="Always" />
<Content Remove="nswag.json" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release'">
<Content Remove="appsettings.*.json" />
</ItemGroup>
<ItemGroup>
<Content Update="lib/CgSDK.x64_2015.dll">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\open-cue-sdk\open-cue-sdk.csproj">
<IncludeAssets>all</IncludeAssets>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</ProjectReference>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Config.cs → open-cue-service/src/Config.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenCueService
namespace OpenCue.Service
{
public class Config
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace OpenCueService
namespace OpenCue.Service
{
public class ApiError : Exception
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

using Microsoft.AspNetCore.Mvc;

namespace OpenCueService
namespace OpenCue.Service
{
[ApiExplorerSettings(IgnoreApi = true)]
public class DefaultController : Controller
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;

namespace OpenCueService.Controllers
namespace OpenCue.Service.Controllers
{
[ApiController]
[Route("api/profiles")]
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Profile.cs → open-cue-service/src/Profile.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenCueService
namespace OpenCue.Service
{
public class Profile
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/Program.cs → open-cue-service/src/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

namespace OpenCueService
namespace OpenCue.Service
{
public class Program
{
Expand Down
10 changes: 5 additions & 5 deletions src/SdkHandler.cs → open-cue-service/src/SdkHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -14,7 +13,8 @@ public SdkHandler(IOptions<Config> config)
ProfilesDirectoryName = config.Value.ProfilesDirectoryName;
CorsairGameSdk = new CorsairGameSdk(ProfilesDirectoryName);
}
public void Reconnect() {
public void Reconnect()
{
CorsairGameSdk = new CorsairGameSdk(ProfilesDirectoryName);
}
public CorsairProtocolDetails GetCorsairProtocolDetails()
Expand Down
2 changes: 1 addition & 1 deletion src/Startup.cs → open-cue-service/src/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace OpenCueService
namespace OpenCue.Service
{
using Controllers;
public class Startup
Expand Down
5 changes: 2 additions & 3 deletions src/SyncService.cs → open-cue-service/src/SyncService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 0 additions & 28 deletions src/CgSdk/CgSdkInterop.cs

This file was deleted.

0 comments on commit 46c882c

Please sign in to comment.