improved rpc toggle

This commit is contained in:
iAmAsval 2020-05-15 02:11:43 +02:00
parent 8fdff9e32d
commit ebd3663ec4
11 changed files with 369 additions and 356 deletions

View File

@ -1,6 +1,5 @@
using FModel.Discord;
using FModel.Logger;
using FModel.Properties;
using FModel.Utils;
using FModel.ViewModels.StatusBar;
using FModel.Windows.DarkMessageBox;
@ -38,11 +37,8 @@ namespace FModel
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Culture]", Thread.CurrentThread.CurrentUICulture);
StatusBarVm.statusBarViewModel.Set(FModel.Properties.Resources.Initializing, FModel.Properties.Resources.Loading);
if (FModel.Properties.Settings.Default.EnableDiscordRPC)
{
if (FModel.Properties.Settings.Default.UseDiscordRpc)
DiscordIntegration.StartClient();
}
base.OnStartup(e);
}

View File

@ -21,6 +21,7 @@ namespace FModel.Discord
private static RichPresence _presence;
public static void Dispose() => _client.Dispose();
public static void Deinitialize() => _client.Deinitialize();
private static void Initialize()
{
_client.Logger = new ConsoleLogger() { Level = LogLevel.Warning };

File diff suppressed because it is too large Load Diff

View File

@ -840,4 +840,7 @@ Jetzt ist es die am häufigsten genutzte freie Software um mit Fortnite zu leake
<data name="YesShowChangelog" xml:space="preserve">
<value>Ja (Änderungsprotokoll Anzeigen)</value>
</data>
<data name="UseDiscordRpc" xml:space="preserve">
<value>Verwende Discord RPC</value>
</data>
</root>

View File

@ -847,4 +847,7 @@ C'est maintenant le logiciel gratuit le plus utilisé pour leak sur Fortnite.</v
<data name="YesShowChangelog" xml:space="preserve">
<value>Oui (Voir le Changelog)</value>
</data>
<data name="UseDiscordRpc" xml:space="preserve">
<value>Utiliser Discord RPC</value>
</data>
</root>

View File

@ -805,4 +805,7 @@ Col tempo sono state aggiunte nuove funzioni e molti altri utenti hanno comincia
<data name="CaseSensitive" xml:space="preserve">
<value>Sensibile alle maiuscole e minuscole</value>
</data>
<data name="UseDiscordRpc" xml:space="preserve">
<value>Usa Discord RPC</value>
</data>
</root>

View File

@ -1081,8 +1081,8 @@ It's now the most used free software to leak on Fortnite.</value>
<data name="UpdateAvailableConfirm" xml:space="preserve">
<value>FModel {0} is available. You are using version {1}. Do you want to update the application now?</value>
</data>
<data name="EnableDiscordRPC" xml:space="preserve">
<value>Enable Discord RPC</value>
<data name="UseDiscordRpc" xml:space="preserve">
<value>Use Discord RPC</value>
<comment>Should Discord Rich Presence be enabled?</comment>
</data>
</root>

View File

@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// </auto-generated>
//------------------------------------------------------------------------------
@ -86,24 +86,12 @@ namespace FModel.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool EnableDiscordRPC {
public bool UseDiscordRpc {
get {
return ((bool)(this["EnableDiscordRPC"]));
return ((bool)(this["UseDiscordRpc"]));
}
set {
this["EnableDiscordRPC"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string AudioPlayerDevice {
get {
return ((string)(this["AudioPlayerDevice"]));
}
set {
this["AudioPlayerDevice"] = value;
this["UseDiscordRpc"] = value;
}
}
@ -227,6 +215,18 @@ namespace FModel.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string AudioPlayerDevice {
get {
return ((string)(this["AudioPlayerDevice"]));
}
set {
this["AudioPlayerDevice"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]

View File

@ -17,12 +17,9 @@
<Setting Name="AutoOpenSounds" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="EnableDiscordRPC" Type="System.Boolean" Scope="User">
<Setting Name="UseDiscordRpc" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="AudioPlayerDevice" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="StaticAesKeys" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
@ -53,6 +50,9 @@
<Setting Name="GridChildBottomRight" Type="System.String" Scope="User">
<Value Profile="(Default)">6*</Value>
</Setting>
<Setting Name="AudioPlayerDevice" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="AutoExport" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>

View File

@ -119,6 +119,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<CheckBox Grid.Row="0" Margin="5"
@ -127,9 +128,9 @@
<CheckBox Grid.Row="1" Margin="5"
Content="{x:Static properties:Resources.AutoOpenSounds}"
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=AutoOpenSounds, Mode=TwoWay}"/>
<CheckBox Grid.Row="1" Margin="5,29,5,-19"
Content="{x:Static properties:Resources.EnableDiscordRPC}"
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=EnableDiscordRPC, Mode=TwoWay}"/>
<CheckBox Grid.Row="2" Margin="5"
Content="{x:Static properties:Resources.UseDiscordRpc}"
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=UseDiscordRpc, Mode=TwoWay}"/>
</Grid>
</Grid>
</GroupBox>

View File

@ -1,4 +1,5 @@
using FModel.Logger;
using FModel.Discord;
using FModel.Logger;
using FModel.Utils;
using FModel.ViewModels.ComboBox;
using FModel.Windows.DarkMessageBox;
@ -18,6 +19,7 @@ namespace FModel.Windows.Settings
{
private string _inputPath;
private string _outputPath;
private bool _useDiscordRpc;
public General()
{
@ -33,12 +35,16 @@ namespace FModel.Windows.Settings
{
_inputPath = Properties.Settings.Default.PakPath;
_outputPath = Properties.Settings.Default.OutputPath;
_useDiscordRpc = Properties.Settings.Default.UseDiscordRpc;
Languages_CbBox.ItemsSource = ComboBoxVm.languageCbViewModel;
Languages_CbBox.SelectedItem = ComboBoxVm.languageCbViewModel.Where(x => x.Id == Properties.Settings.Default.AssetsLanguage).FirstOrDefault();
}
private async Task SaveAndExit()
{
if (_useDiscordRpc && !Properties.Settings.Default.UseDiscordRpc) // previously enabled
DiscordIntegration.Deinitialize();
if (Properties.Settings.Default.AssetsLanguage != Languages_CbBox.SelectedIndex)
{
Properties.Settings.Default.AssetsLanguage = Languages_CbBox.SelectedIndex;