Skip to content

Commit e47d1b9

Browse files
committed
Readd discord-rpc-csharp
We need to use our version which uses System.Text.Json, allowing more of the application to be trimmed (and at some point, be built for AOT). Also fixed Setting page not loading correctly
1 parent 4019b26 commit e47d1b9

File tree

6 files changed

+27
-8
lines changed

6 files changed

+27
-8
lines changed

.gitmodules

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "ext/avalonia.gif"]
22
path = ext/avalonia.gif
3-
url = https://github.com/Azyyyyyy/Avalonia.GIF
3+
url = https://github.com/Azyyyyyy/Avalonia.GIF
4+
[submodule "ext/discord-rpc-csharp"]
5+
path = ext/discord-rpc-csharp
6+
url = https://github.com/Azyyyyyy/discord-rpc-csharp

MultiRPC.sln

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ext", "ext", "{B7AAF9E7-1C1
1111
EndProject
1212
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiRPC.SourceGen", "src\MultiRPC.SourceGen\MultiRPC.SourceGen.csproj", "{3369169D-31C0-4A74-A5A9-F2BB1EA80705}"
1313
EndProject
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscordRPC", "ext\discord-rpc-csharp\DiscordRPC\DiscordRPC.csproj", "{46073C54-E149-457D-9E6B-993A780E6AE8}"
15+
EndProject
1416
Global
1517
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1618
Debug|Any CPU = Debug|Any CPU
@@ -29,6 +31,10 @@ Global
2931
{3369169D-31C0-4A74-A5A9-F2BB1EA80705}.Debug|Any CPU.Build.0 = Debug|Any CPU
3032
{3369169D-31C0-4A74-A5A9-F2BB1EA80705}.Release|Any CPU.ActiveCfg = Release|Any CPU
3133
{3369169D-31C0-4A74-A5A9-F2BB1EA80705}.Release|Any CPU.Build.0 = Release|Any CPU
34+
{46073C54-E149-457D-9E6B-993A780E6AE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35+
{46073C54-E149-457D-9E6B-993A780E6AE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
36+
{46073C54-E149-457D-9E6B-993A780E6AE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
37+
{46073C54-E149-457D-9E6B-993A780E6AE8}.Release|Any CPU.Build.0 = Release|Any CPU
3238
EndGlobalSection
3339
GlobalSection(SolutionProperties) = preSolution
3440
HideSolutionNode = FALSE
@@ -38,5 +44,6 @@ Global
3844
EndGlobalSection
3945
GlobalSection(NestedProjects) = preSolution
4046
{D4EBB986-EDAC-4C0B-AB58-70E4A5C7D2A4} = {B7AAF9E7-1C1E-4376-BAF6-D2FCA8B39CDF}
47+
{46073C54-E149-457D-9E6B-993A780E6AE8} = {B7AAF9E7-1C1E-4376-BAF6-D2FCA8B39CDF}
4148
EndGlobalSection
4249
EndGlobal

ext/discord-rpc-csharp

Submodule discord-rpc-csharp added at dcfbcd6

src/MultiRPC/JsonSerializerContexts.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ namespace MultiRPC;
1010
#pragma warning disable SYSLIB0020
1111

1212
//TODO: Find a way which will let us be able to use Metadata as well on these which have Serialization (Trying to access state and details)
13-
[JsonSerializable(typeof(Presence), GenerationMode = JsonSourceGenerationMode.Serialization)]
13+
[JsonSerializable(typeof(Presence))]
1414
public partial class RichPresenceContext : JsonSerializerContext { }
1515

16-
[JsonSerializable(typeof(ProfilesSettings), GenerationMode = JsonSourceGenerationMode.Serialization)]
16+
[JsonSerializable(typeof(ProfilesSettings))]
1717
public partial class ProfilesSettingsContext : JsonSerializerContext { }
1818

19-
[JsonSerializable(typeof(MultiRPCSettings), GenerationMode = JsonSourceGenerationMode.Serialization)]
19+
[JsonSerializable(typeof(MultiRPCSettings))]
2020
public partial class MultiRPCSettingsContext : JsonSerializerContext { }
2121

2222
[JsonSerializable(typeof(DisableSettings))]

src/MultiRPC/MultiRPC.csproj

+6
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@
66
<PublishAot>true</PublishAot>
77
<WarningsAsErrors>$(TreatWarningsAsErrors);IL3050;IL2026;IL3000</WarningsAsErrors>
88
</PropertyGroup>
9+
<ItemGroup>
10+
<PackageReference Remove="DiscordRichPresence" />
11+
</ItemGroup>
12+
<ItemGroup>
13+
<ProjectReference Include="..\..\ext\discord-rpc-csharp\DiscordRPC\DiscordRPC.csproj" />
14+
</ItemGroup>
915
</Project>

src/MultiRPC/UI/Pages/Settings/SettingsPage.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ public override void Initialize(bool loadXaml)
7171
continue;
7272
}
7373

74+
var tabName = setting.GetType().GetProperty("Name", BindingFlags.Static | BindingFlags.Public)?.GetValue(null);
7475
settingPage ??= new SettingsTab
7576
{
76-
TabName = setting.GetType().GetProperty("Name", BindingFlags.Static)?.Name!,
77+
TabName = tabName?.ToString(),
7778
Margin = new Thickness(10)
7879
};
7980

@@ -99,8 +100,9 @@ public override void Initialize(bool loadXaml)
99100
}
100101
else
101102
{
102-
//TODO: Readd
103-
/*var settingDropdownType = typeof(SettingDropdown<>).MakeGenericType(settingProperty.PropertyType);
103+
#pragma warning disable IL3050
104+
var settingDropdownType = typeof(SettingDropdown<>).MakeGenericType(settingProperty.PropertyType);
105+
#pragma warning restore IL3050
104106
var settingDropdown = (SettingItem?)Activator.CreateInstance(settingDropdownType, name, setting, getMethod,
105107
setMethod, sourceAttribute, languageSourceAttribute, settingProperty.GetCustomAttribute<NoneLocalizableAttribute>() == null);
106108

@@ -109,7 +111,7 @@ public override void Initialize(bool loadXaml)
109111
settingDropdown.IsEnabled = isEditable;
110112
settingPage.Add(settingDropdown);
111113
continue;
112-
}*/
114+
}
113115
//TODO: Log
114116
}
115117
}

0 commit comments

Comments
 (0)