diff --git a/WeeXnes/Core/Globals.cs b/WeeXnes/Core/Globals.cs
index 526f0d4..5165678 100644
--- a/WeeXnes/Core/Globals.cs
+++ b/WeeXnes/Core/Globals.cs
@@ -15,7 +15,7 @@ namespace WeeXnes.Core
public static string encryptionKey = "8zf5#RdyQ]$4x4_";
public static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WeeXnes");
public static string SettingsFileName = "settings.ini";
- public static string version = "3.1.1";
+ public static string version = "3.2";
public static bool info_isRpcRunning = false;
public static bool info_RpcAutoStart;
public static string apiUrl = "http://www.weexnes.com:5169/";
diff --git a/WeeXnes/Core/customEvent.cs b/WeeXnes/Core/customEvent.cs
new file mode 100644
index 0000000..1952d41
--- /dev/null
+++ b/WeeXnes/Core/customEvent.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Net;
+using System.Threading.Tasks;
+using System.Windows;
+
+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/MVVM/View/DiscordRpcView.xaml b/WeeXnes/MVVM/View/DiscordRpcView.xaml
index 2ebd40a..c9eef29 100644
--- a/WeeXnes/MVVM/View/DiscordRpcView.xaml
+++ b/WeeXnes/MVVM/View/DiscordRpcView.xaml
@@ -207,19 +207,48 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WeeXnes/MVVM/View/DiscordRpcView.xaml.cs b/WeeXnes/MVVM/View/DiscordRpcView.xaml.cs
index ff7e644..2b323a3 100644
--- a/WeeXnes/MVVM/View/DiscordRpcView.xaml.cs
+++ b/WeeXnes/MVVM/View/DiscordRpcView.xaml.cs
@@ -28,11 +28,12 @@ namespace WeeXnes.MVVM.View
///
public partial class DiscordRpcView : UserControl
{
+ public List events = new List();
//static bool shouldBeRunning = false;
BackgroundWorker backgroundWorker = new BackgroundWorker();
List Games = new List();
Game lastSelectedGame = null;
- public static string logContent = null;
+ public static customEvent logContent = null;
public static UpdateVar triggerLogupdate = new UpdateVar();
public DiscordRpcView()
{
@@ -47,8 +48,8 @@ namespace WeeXnes.MVVM.View
};
InitializeSettings();
CheckForAutostart();
+
}
-
public void CheckFolders()
{
if (!Globals.settings_RpcItemsPath_Bool.Value)
@@ -80,25 +81,28 @@ namespace WeeXnes.MVVM.View
backgroundWorker.DoWork += BackgroundWorker_DoWork;
Refresh();
}
- public void writeLog(string _content, bool _timestamp = true)
+ public void writeLog(customEvent _content, bool _timestamp = true)
{
string timestamp = DateTime.Now.ToString("HH:mm:ss");
- if (_timestamp)
+ /*if (_timestamp)
{
_content = "[" + timestamp + "] " + _content;
}
- Console.WriteLine(_content);
+ */
this.Dispatcher.Invoke(() =>
{
- RpcLog.AppendText(_content + "\n");
- RpcLog.ScrollToEnd();
+ //RpcLog.AppendText(_content + "\n");
+ //RpcLog.ScrollToEnd();
+
+ ListViewVersions.Items.Add(_content);
+ LogViewer.ScrollToEnd();
});
}
private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
Globals.info_isRpcRunning = true;
- writeLog("Thread Started");
+ writeLog(new customEvent("Thread Started", EventType.ProcessStartedEvent));
bool runWorker = true;
int delay = 2000;
while (runWorker)
@@ -129,7 +133,7 @@ namespace WeeXnes.MVVM.View
{
game.isRunning = false;
}
- writeLog("Thread Closed");
+ writeLog(new customEvent("Thread Closed",EventType.ProcessStoppedEvent));
}
public void runBackgroundWorker()
{
@@ -313,5 +317,10 @@ namespace WeeXnes.MVVM.View
stopBackgroundWorker();
}
+
+ private void ListViewVersions_OnLoaded(object sender, RoutedEventArgs e)
+ {
+
+ }
}
}
diff --git a/WeeXnes/RPC/Game.cs b/WeeXnes/RPC/Game.cs
index 51d950d..1c22c91 100644
--- a/WeeXnes/RPC/Game.cs
+++ b/WeeXnes/RPC/Game.cs
@@ -7,9 +7,15 @@ using System.Threading.Tasks;
using WeeXnes.Core;
using WeeXnes.MVVM.View;
using DiscordRPC;
+using DiscordRPC.Message;
+using EventType = WeeXnes.Core.EventType;
namespace WeeXnes.RPC
{
+ class EventCache
+ {
+ public static string cache1 = "";
+ }
public class Game
{
public DiscordRpcClient client { get; set; }
@@ -44,25 +50,8 @@ namespace WeeXnes.RPC
{
client.Initialize();
}
- client.OnReady += (sender, e) =>
- {
- /*
- Globals.logContent.Value = "[" + this.ProcessName + ".exe] -> Received Ready from user " + e.User.Username;
- Globals.logUpdateTrigger.Value = "mgjnoeimgje";
- */
- DiscordRpcView.logContent = "[" + this.ProcessName + ".exe] -> Received Ready from user " + e.User.Username;
- DiscordRpcView.triggerLogupdate.Value = "nlejgmolegjog";
- };
- client.OnPresenceUpdate += (sender, e) =>
- {
- /*
- Globals.logContent.Value = "[" + this.ProcessName + ".exe] ->Received Update!";
- Globals.logUpdateTrigger.Value = "mgjnoeimgje";
- */
- DiscordRpcView.logContent = "[" + this.ProcessName + ".exe] -> Received Update on RPC";
- DiscordRpcView.triggerLogupdate.Value = "nlejgmolegjog";
-
- };
+ client.OnReady += ClientOnOnReady;
+ client.OnPresenceUpdate += ClientOnOnPresenceUpdate;
client.SetPresence(new RichPresence()
{
Details = this.details,
@@ -80,11 +69,26 @@ namespace WeeXnes.RPC
client.UpdateStartTime();
}
}
+
+ private void ClientOnOnPresenceUpdate(object sender, PresenceMessage args)
+ {
+ DiscordRpcView.logContent = new customEvent("[" + this.ProcessName + ".exe] ➜ Received Update on " + args.Name, EventType.RPCUpdateEvent);
+ DiscordRpcView.triggerLogupdate.Value = "nlejgmolegjog";
+ }
+
+ private void ClientOnOnReady(object sender, ReadyMessage args)
+ {
+ DiscordRpcView.logContent = new customEvent("[" + this.ProcessName + ".exe] ➜ Received Ready from user " + args.User.Username, EventType.RPCReadyEvent);
+ DiscordRpcView.triggerLogupdate.Value = "nlejgmolegjog";
+ }
+
public void stop()
{
if (this.client.IsInitialized)
{
client.ClearPresence();
+ client.OnReady -= ClientOnOnReady;
+ client.OnPresenceUpdate -= ClientOnOnPresenceUpdate;
}
}
public void checkState(Process[] processes)
@@ -110,12 +114,11 @@ namespace WeeXnes.RPC
//message.running(this.ProcessName);
start();
- string output = this.Name + " [" + this.ProcessName + ".exe] started";
/*
Globals.logContent.Value = output;
Globals.logUpdateTrigger.Value = "mjfgoklemkgoeg";
*/
- DiscordRpcView.logContent = output;
+ DiscordRpcView.logContent = new customEvent("↪ " + this.Name + " [" + this.ProcessName + ".exe] started", EventType.ProcessStartedEvent);
DiscordRpcView.triggerLogupdate.Value = "nlejgmolegjog";
this.isRunning = true;
}
@@ -127,12 +130,11 @@ namespace WeeXnes.RPC
//Do when Process is closed
//message.closed(this.ProcessName);
stop();
- string output = this.Name + " [" + this.ProcessName + ".exe] closed";
/*
Globals.logContent.Value = output;
Globals.logUpdateTrigger.Value = "mjfgoklemkgoeg";
*/
- DiscordRpcView.logContent = output;
+ DiscordRpcView.logContent = new customEvent( "↩ " + this.Name + " [" + this.ProcessName + ".exe] closed", EventType.ProcessStoppedEvent);
DiscordRpcView.triggerLogupdate.Value = "nlejgmolegjog";
this.isRunning = false;
diff --git a/WeeXnes/WeeXnes.csproj b/WeeXnes/WeeXnes.csproj
index 4c3d493..2376881 100644
--- a/WeeXnes/WeeXnes.csproj
+++ b/WeeXnes/WeeXnes.csproj
@@ -60,6 +60,7 @@
Designer
+
UpdateMessage.xaml