mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-10 20:46:24 +00:00
48 files changed
+118
-1838
No files matched your search
@@ -1,10 +1,10 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace RGB.NET.Devices.SteelSeries.API.Model
|
||||
{
|
||||
internal class CoreProps
|
||||
{
|
||||
[JsonProperty(PropertyName = "address")]
|
||||
[JsonPropertyName("address")]
|
||||
public string Address { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace RGB.NET.Devices.SteelSeries.API.Model
|
||||
{
|
||||
@@ -7,13 +7,13 @@ namespace RGB.NET.Devices.SteelSeries.API.Model
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
[JsonProperty("game")]
|
||||
[JsonPropertyName("game")]
|
||||
public string Game { get; set; }
|
||||
|
||||
[JsonProperty("event")]
|
||||
[JsonPropertyName("event")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("data")]
|
||||
[JsonPropertyName("data")]
|
||||
public Dictionary<string, object> Data { get; } = new Dictionary<string, object>();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace RGB.NET.Devices.SteelSeries.API.Model
|
||||
{
|
||||
@@ -6,10 +6,10 @@ namespace RGB.NET.Devices.SteelSeries.API.Model
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
[JsonProperty("game")]
|
||||
[JsonPropertyName("game")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("game_display_name")]
|
||||
[JsonPropertyName("game_display_name")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace RGB.NET.Devices.SteelSeries.API.Model
|
||||
{
|
||||
@@ -6,10 +6,10 @@ namespace RGB.NET.Devices.SteelSeries.API.Model
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
[JsonProperty("game")]
|
||||
[JsonPropertyName("game")]
|
||||
public string Game { get; set; }
|
||||
|
||||
[JsonProperty("golisp")]
|
||||
[JsonPropertyName("golisp")]
|
||||
public string Handler { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -5,7 +5,8 @@ using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using RGB.NET.Devices.SteelSeries.API.Model;
|
||||
|
||||
namespace RGB.NET.Devices.SteelSeries.API
|
||||
@@ -73,13 +74,16 @@ namespace RGB.NET.Devices.SteelSeries.API
|
||||
string corePropsPath = GetCorePropsPath();
|
||||
if (!string.IsNullOrWhiteSpace(corePropsPath) && File.Exists(corePropsPath))
|
||||
{
|
||||
CoreProps coreProps = JsonConvert.DeserializeObject<CoreProps>(File.ReadAllText(corePropsPath));
|
||||
_baseUrl = coreProps.Address;
|
||||
if (!_baseUrl.StartsWith("http://", StringComparison.Ordinal))
|
||||
_baseUrl = "http://" + _baseUrl;
|
||||
CoreProps coreProps = JsonSerializer.Deserialize<CoreProps>(File.ReadAllText(corePropsPath));
|
||||
_baseUrl = coreProps?.Address;
|
||||
if (_baseUrl != null)
|
||||
{
|
||||
if (!_baseUrl.StartsWith("http://", StringComparison.Ordinal))
|
||||
_baseUrl = "http://" + _baseUrl;
|
||||
|
||||
RegisterGame(_game);
|
||||
RegisterGoLispHandler(new GoLispHandler(_game, HANDLER));
|
||||
RegisterGame(_game);
|
||||
RegisterGoLispHandler(new GoLispHandler(_game, HANDLER));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
@@ -122,7 +126,7 @@ namespace RGB.NET.Devices.SteelSeries.API
|
||||
|
||||
private static string PostJson(string urlSuffix, object o)
|
||||
{
|
||||
string payload = JsonConvert.SerializeObject(o);
|
||||
string payload = JsonSerializer.Serialize(o);
|
||||
return _client.PostAsync(_baseUrl + urlSuffix, new StringContent(payload, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
|
||||
<TargetFrameworks>net5.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<Authors>Darth Affe</Authors>
|
||||
<Company>Wyrez</Company>
|
||||
@@ -33,11 +34,6 @@
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<IncludeSource>True</IncludeSource>
|
||||
<IncludeSymbols>True</IncludeSymbols>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
|
||||
<DefineConstants>NETCORE;NETSTANDARD;NETSTANDARD2_0</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
@@ -56,7 +52,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RGB.NET.Core\RGB.NET.Core.csproj" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="HidSharp" Version="2.1.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in new issue
Block a user