diff --git a/WeeXnes/Core/Global.cs b/WeeXnes/Core/Global.cs index 42303e5..60efcdd 100644 --- a/WeeXnes/Core/Global.cs +++ b/WeeXnes/Core/Global.cs @@ -8,7 +8,7 @@ namespace WeeXnes.Core { public class Information { - public const string Version = "4.2.3"; + public const string Version = "4.2.5"; public const string EncryptionHash = "8zf5#RdyQ]$4x4_"; public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest"; } diff --git a/WeeXnes/Core/RpcLogEvents.cs b/WeeXnes/Core/RpcLogEvents.cs new file mode 100644 index 0000000..6345ce3 --- /dev/null +++ b/WeeXnes/Core/RpcLogEvents.cs @@ -0,0 +1,50 @@ +namespace WeeXnes.Core +{ + public enum EventType + { + ProcessStartedEvent, + ProcessStoppedEvent, + RPCUpdateEvent, + RPCReadyEvent + } + public class customEvent + { + + public string Content { get; set; } + public EventType Type { get; set; } + + public string GradientColor1 { get; set; } + public string GradientColor2 { get; set; } + public customEvent(string content, EventType type) + { + this.Content = content; + this.Type = type; + if (this.Type == EventType.ProcessStartedEvent) + { + this.GradientColor1 = "#46db69"; + this.GradientColor2 = "#33a34d"; + } + else if (this.Type == EventType.ProcessStoppedEvent) + { + this.GradientColor1 = "#d1415d"; + this.GradientColor2 = "#a33349"; + } + else if (this.Type == EventType.RPCUpdateEvent) + { + this.GradientColor1 = "#3e65c9"; + this.GradientColor2 = "#3352a3"; + } + else if (this.Type == EventType.RPCReadyEvent) + { + this.GradientColor1 = "#c93eb4"; + this.GradientColor2 = "#a33389"; + } + } + + + public override string ToString() + { + return this.Content; + } + } +} \ No newline at end of file diff --git a/WeeXnes/Views/DiscordRPC/Game.cs b/WeeXnes/Views/DiscordRPC/Game.cs index 6ec293b..d09b845 100644 --- a/WeeXnes/Views/DiscordRPC/Game.cs +++ b/WeeXnes/Views/DiscordRPC/Game.cs @@ -6,6 +6,7 @@ using DiscordRPC.Message; using Nocksoft.IO.ConfigFiles; using WeeXnes.Core; using WeeXnes.Views.Settings; +using EventType = WeeXnes.Core.EventType; namespace WeeXnes.Views.DiscordRPC { @@ -88,7 +89,7 @@ namespace WeeXnes.Views.DiscordRPC { this.IsRunning = true; //Console.WriteLine("Process started"); - RunRPCView.Data.LogCache.Value = this.ProcessName + " is running"; + RunRPCView.Data.LogCache.Value = new customEvent("[" + this.ProcessName + ".exe] ➜ is running", EventType.ProcessStartedEvent); if (!this.PresenceClient.IsInitialized) { @@ -114,7 +115,7 @@ namespace WeeXnes.Views.DiscordRPC { this.IsRunning = false; //Console.WriteLine("Process stopped"); - RunRPCView.Data.LogCache.Value = this.ProcessName + " stopped running"; + RunRPCView.Data.LogCache.Value = new customEvent("[" + this.ProcessName + ".exe] ➜ stopped running", EventType.ProcessStoppedEvent); if (this.PresenceClient.IsInitialized) { this.PresenceClient.ClearPresence(); @@ -126,13 +127,14 @@ namespace WeeXnes.Views.DiscordRPC private void PresenceClientOnOnPresenceUpdate(object sender, PresenceMessage args) { //Console.WriteLine("[" + this.ProcessName + ".exe] ➜ Received Update on " + args.Name); - RunRPCView.Data.LogCache.Value = "[" + this.ProcessName + ".exe] ➜ Received Update on " + args.Name; + RunRPCView.Data.LogCache.Value = new customEvent("[" + this.ProcessName + ".exe] ➜ Received Update on " + args.Name, EventType.RPCUpdateEvent); } private void PresenceClientOnOnReady(object sender, ReadyMessage args) { //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; + RunRPCView.Data.LogCache.Value = + new customEvent("[" + this.ProcessName + ".exe] ➜ Received Ready from user " + args.User.Username, EventType.RPCReadyEvent); } public void CheckState(Process[] processes) { diff --git a/WeeXnes/Views/DiscordRPC/RunRPCView.xaml b/WeeXnes/Views/DiscordRPC/RunRPCView.xaml index 9c7b668..11890ce 100644 --- a/WeeXnes/Views/DiscordRPC/RunRPCView.xaml +++ b/WeeXnes/Views/DiscordRPC/RunRPCView.xaml @@ -24,12 +24,54 @@ /> - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WeeXnes/Views/DiscordRPC/RunRPCView.xaml.cs b/WeeXnes/Views/DiscordRPC/RunRPCView.xaml.cs index 781db8e..19e0209 100644 --- a/WeeXnes/Views/DiscordRPC/RunRPCView.xaml.cs +++ b/WeeXnes/Views/DiscordRPC/RunRPCView.xaml.cs @@ -12,7 +12,7 @@ namespace WeeXnes.Views.DiscordRPC { public static class Data { - public static UpdateVar LogCache = new UpdateVar(); + public static UpdateVar LogCache = new UpdateVar(); } BackgroundWorker backgroundWorker = new BackgroundWorker(); public RunRPCView() @@ -36,8 +36,8 @@ namespace WeeXnes.Views.DiscordRPC Console.WriteLine("Log Write Data: " + Data.LogCache.Value); this.Dispatcher.Invoke(() => { - RichTextBoxRPCLog.AppendText(Data.LogCache.Value + "\n"); - RichTextBoxRPCLog.ScrollToEnd(); + RpcLogView.Items.Add(Data.LogCache.Value); + LogViewer.ScrollToEnd(); }); } @@ -78,7 +78,7 @@ namespace WeeXnes.Views.DiscordRPC private void BackgroundWorkerOnDoWork(object sender, DoWorkEventArgs e) { - Data.LogCache.Value = "RPC Thread is running"; + Data.LogCache.Value = new customEvent("[INFO] RPC Thread is running", EventType.ProcessStartedEvent); bool runWorker = true; while (runWorker) { @@ -99,7 +99,7 @@ namespace WeeXnes.Views.DiscordRPC foreach (Game game in DiscordRPCView.Data.Games) game.Stop(); Console.WriteLine("Thread Stopped"); - Data.LogCache.Value = "RPC Thread has stopped"; + Data.LogCache.Value = new customEvent("[INFO] RPC Thread has stopped", EventType.ProcessStoppedEvent); } private void RunRPCView_OnUnloaded(object sender, RoutedEventArgs e) @@ -112,5 +112,11 @@ namespace WeeXnes.Views.DiscordRPC { NavigationService.Navigate(new Uri("/Views/DiscordRPC/DiscordRPCView.xaml",UriKind.Relative)); } + + + private void RpcLogView_OnLoaded(object sender, RoutedEventArgs e) + { + + } } } \ No newline at end of file diff --git a/WeeXnes/WeeXnes.csproj b/WeeXnes/WeeXnes.csproj index 144d738..1b22d18 100644 --- a/WeeXnes/WeeXnes.csproj +++ b/WeeXnes/WeeXnes.csproj @@ -4,7 +4,7 @@ Debug AnyCPU - 4.2.3 + 4.2.5 {4B33CEE7-C74D-43B9-B99A-8B273D5195BC} WinExe WeeXnes @@ -68,6 +68,7 @@ +