Skip to content

Commit

Permalink
Fix profile management for later OpenRGB versions
Browse files Browse the repository at this point in the history
  • Loading branch information
w-enterprises committed Jul 25, 2021
1 parent 80d67e8 commit c910d89
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions AllMyLights.Test/Connectors/OpenRGBSinkTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public void Should_load_a_profile()
var openRGBClientMock = new Mock<IOpenRGBClient>();
openRGBClientMock.Setup(it => it.Connected).Returns(true).Verifiable();

openRGBClientMock.Setup(it => it.GetProfiles()).Returns(new string[] { "Blue.orp" }).Verifiable();
openRGBClientMock.Setup(it => it.LoadProfile("Blue.orp")).Verifiable();
openRGBClientMock.Setup(it => it.GetProfiles()).Returns(new string[] { "Blue" }).Verifiable();
openRGBClientMock.Setup(it => it.LoadProfile("Blue")).Verifiable();

var sink = new OpenRGBSink(Options, openRGBClientMock.Object);
sink.Consume("Blue.orp");
Expand All @@ -82,7 +82,7 @@ public void Should_not_try_to_load_a_non_existing_profile()
var openRGBClientMock = new Mock<IOpenRGBClient>();
openRGBClientMock.Setup(it => it.Connected).Returns(true).Verifiable();

openRGBClientMock.Setup(it => it.GetProfiles()).Returns(new string[] { "Blue.orp" }).Verifiable();
openRGBClientMock.Setup(it => it.GetProfiles()).Returns(new string[] { "Blue" }).Verifiable();

var sink = new OpenRGBSink(Options, openRGBClientMock.Object);
sink.Consume("Pink.orp");
Expand Down
2 changes: 1 addition & 1 deletion AllMyLights/AllMyLights.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<LangVersion>8</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenRGB.NET" Version="1.6.0" />
<PackageReference Include="OpenRGB.NET" Version="1.7.0" />
<PackageReference Include="RzChromaBroadcastAPI.NET" Version="1.1.2" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" />
<PackageReference Include="System.CommandLine.DragonFruit" Version="0.3.0-alpha.20574.7" />
Expand Down
7 changes: 4 additions & 3 deletions AllMyLights/Connectors/Sinks/OpenRGB/OpenRGBSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ public override object GetInfo() => Client.RequestCatching(() => {

private Unit LoadProfile(string profile) => Client.RequestCatching(() =>
{
var profileName = profile[0..^4];
var profiles = Client.GetProfiles();

if (!profiles.Contains(profile))
if (!profiles.Contains(profileName))
{
Logger.Error($"Profile {profile} does not exist on the server.");
Logger.Error($"Profile {profileName} does not exist on the server.");
return Unit.Default;
}

Client.LoadProfile(profile);
Client.LoadProfile(profileName);


return Unit.Default;
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [v9]

### Sinks
- Fix profile loading for later OpenRGB versions

## [v8]

### Routes
Expand Down Expand Up @@ -72,7 +77,7 @@ via JsonPath or color conversions reusable across different source and sink type
- Add option to override the channel layout of a device
- Add option to override the channel layout of a zone

[v8]: https://github.com/sparten11740/allmylights/compare/v7...v8
[v9]: https://github.com/sparten11740/allmylights/compare/v7...v9
[v7]: https://github.com/sparten11740/allmylights/compare/v6...v7
[v6]: https://github.com/sparten11740/allmylights/compare/v5...v6
[v5]: https://github.com/sparten11740/allmylights/compare/v4...v5
Expand Down

0 comments on commit c910d89

Please sign in to comment.