added missing RPC log (will be beautified in next update)

This commit is contained in:
WeeXnes 2023-01-04 18:13:23 +01:00
parent cc50b3861a
commit cac9f1d491
6 changed files with 48 additions and 10 deletions

View file

@ -3,4 +3,12 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View file

@ -6,7 +6,7 @@ namespace WeeXnes.Core
{
public class Information
{
public const string Version = "4.0.8";
public const string Version = "4.0.9";
public const string EncryptionHash = "8zf5#RdyQ]$4x4_";
public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
}

View file

@ -87,7 +87,8 @@ namespace WeeXnes.Views.DiscordRPC
public void Start()
{
this.IsRunning = true;
Console.WriteLine("Process started");
//Console.WriteLine("Process started");
RunRPCView.Data.LogCache.Value = this.ProcessName + " is running";
if (!this.PresenceClient.IsInitialized)
{
@ -112,7 +113,8 @@ namespace WeeXnes.Views.DiscordRPC
public void Stop()
{
this.IsRunning = false;
Console.WriteLine("Process stopped");
//Console.WriteLine("Process stopped");
RunRPCView.Data.LogCache.Value = this.ProcessName + " stopped running";
if (this.PresenceClient.IsInitialized)
{
this.PresenceClient.ClearPresence();
@ -123,12 +125,14 @@ namespace WeeXnes.Views.DiscordRPC
}
private void PresenceClientOnOnPresenceUpdate(object sender, PresenceMessage args)
{
Console.WriteLine("[" + this.ProcessName + ".exe] ➜ Received Update on " + args.Name);
//Console.WriteLine("[" + this.ProcessName + ".exe] ➜ Received Update on " + args.Name);
RunRPCView.Data.LogCache.Value = "[" + this.ProcessName + ".exe] ➜ Received Update on " + args.Name;
}
private void PresenceClientOnOnReady(object sender, ReadyMessage args)
{
Console.WriteLine("[" + this.ProcessName + ".exe] ➜ Received Ready from user " + args.User.Username);
//Console.WriteLine("[" + this.ProcessName + ".exe] ➜ Received Ready from user " + args.User.Username);
RunRPCView.Data.LogCache.Value = "[" + this.ProcessName + ".exe] ➜ Received Ready from user " + args.User.Username;
}
public void CheckState(Process[] processes)
{

View file

@ -4,18 +4,43 @@ using System.Diagnostics;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using WeeXnes.Core;
namespace WeeXnes.Views.DiscordRPC
{
public partial class RunRPCView : Page
{
public static class Data
{
public static UpdateVar<string> LogCache = new UpdateVar<string>();
}
BackgroundWorker backgroundWorker = new BackgroundWorker();
public RunRPCView()
{
InitializeComponent();
SetupLogListener();
SetupBackgroundWorker();
}
public void SetupLogListener()
{
Data.LogCache.ValueChanged += LogChanged;
}
public void RemoveListener()
{
Data.LogCache.ValueChanged -= LogChanged;
}
private void LogChanged()
{
Console.WriteLine("Log Write Data: " + Data.LogCache.Value);
this.Dispatcher.Invoke(() =>
{
RichTextBoxRPCLog.AppendText(Data.LogCache.Value + "\n");
});
}
private void SetupBackgroundWorker()
{
backgroundWorker.WorkerReportsProgress = true;
@ -78,6 +103,7 @@ namespace WeeXnes.Views.DiscordRPC
private void RunRPCView_OnUnloaded(object sender, RoutedEventArgs e)
{
StopBackgroundWorker();
RemoveListener();
}
private void ButtonRPCStop_OnClick(object sender, RoutedEventArgs e)

View file

@ -4,7 +4,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<Version>4.0.8</Version>
<Version>4.0.9</Version>
<ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>WeeXnes</RootNamespace>
@ -39,8 +39,8 @@
<Reference Include="DiscordRPC, Version=1.0.175.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DiscordRichPresence.1.0.175\lib\net35\DiscordRPC.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DiscordRichPresence" version="1.0.175" targetFramework="net48" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net48" />
<package id="System.Drawing.Common" version="6.0.0" targetFramework="net48" />
<package id="WPF-UI" version="2.0.3" targetFramework="net48" />
</packages>