This commit is contained in:
WeeXnes 2022-06-28 18:31:43 +02:00
parent 5d14cdd185
commit 2f9add84ef
2 changed files with 30 additions and 0 deletions

View file

@ -139,6 +139,13 @@
</CheckBox>
<Button Name="InstallCSGORPC"
Style="{StaticResource UniversalMaterialButton}"
Content="Install Required File for CSGO DiscordRPC"
Background="#2f313b"
Height="25"
Click="InstallCSGORPC_OnClick"
Margin="4,10,4,0"/>
<Label Content="Default RPC ClientID:"
Margin="0,0,0,0"

View file

@ -20,6 +20,7 @@ using Nocksoft.IO.ConfigFiles;
using WeeXnes.Core;
using WeeXnes.Misc;
using Application = System.Windows.Forms.Application;
using Message = WeeXnes.Misc.Message;
using MessageBox = System.Windows.MessageBox;
using Path = System.IO.Path;
using UserControl = System.Windows.Controls.UserControl;
@ -355,5 +356,27 @@ namespace WeeXnes.MVVM.View
{
Globals.settings_builtInCSGORpc.Value = false;
}
private void InstallCSGORPC_OnClick(object sender, RoutedEventArgs e)
{
using(var fbd = new FolderBrowserDialog())
{
DialogResult result = fbd.ShowDialog();
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
{
string subDir = @"csgo\cfg";
string filepath = Path.Combine(fbd.SelectedPath, subDir) + "\\gamestate_integration_jrpc.cfg";
string content = "\"CSGSI\" { \"uri\" \"http://localhost:4169\" \"timeout\" \"5.0\" \"data\" { \"provider\" \"1\" \"map\" \"1\" \"round\" \"1\" \"player_id\" \"1\" \"player_weapons\" \"1\" \"player_match_stats\" \"1\" \"player_state\" \"1\" } }";
if (!File.Exists(filepath))
{
using (StreamWriter sw = File.CreateText(filepath))
{
sw.WriteLine(content);
}
}
}
}
}
}
}