diff --git a/AMRPC WatchDog Desktop/Messenger.cs b/AMRPC WatchDog Desktop/Messenger.cs index ddb2f60..77c18f9 100644 --- a/AMRPC WatchDog Desktop/Messenger.cs +++ b/AMRPC WatchDog Desktop/Messenger.cs @@ -44,17 +44,25 @@ internal class Sender : WebSocketBehavior protected override void OnMessage(MessageEventArgs e) { - Send(JsonConvert.SerializeObject(Payload)); + AnswerAsType(Payload.ResponseTypes.Response); } public void OnPayloadChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { - Send(JsonConvert.SerializeObject(Payload)); + AnswerAsType(Payload.ResponseTypes.Event); } protected override void OnClose(CloseEventArgs e) { Messenger.Reconfigure(); } + + private void AnswerAsType(string answerType) + { + var original = Payload.type; + Payload.type = answerType; + Send(JsonConvert.SerializeObject(Payload)); + Payload.type = original; + } } } \ No newline at end of file diff --git a/AMRPC WatchDog Desktop/Payload.cs b/AMRPC WatchDog Desktop/Payload.cs index 2622bd1..9fb924c 100644 --- a/AMRPC WatchDog Desktop/Payload.cs +++ b/AMRPC WatchDog Desktop/Payload.cs @@ -12,6 +12,12 @@ public class Payload public event PropertyChangedEventHandler PropertyChanged; + public static class ResponseTypes + { + public const string Response = "res"; + public const string Event = "event"; + } + public static class PlayingStatuses { public const string Playing = "playing"; @@ -23,6 +29,7 @@ public static class PlayingStatuses public string album { get; set; } public string artist { get; set; } public string thumbnailPath { get; set; } + public string type { get; set; } public string playerState { @@ -71,6 +78,7 @@ public void ResetToInitialState() playerState = PlayingStatuses.NotStarted; endTime = -1; duration = -1; + type = ResponseTypes.Event; } } } \ No newline at end of file diff --git a/AMRPC WatchDog Desktop/Program.cs b/AMRPC WatchDog Desktop/Program.cs index 354ef29..08aafbb 100644 --- a/AMRPC WatchDog Desktop/Program.cs +++ b/AMRPC WatchDog Desktop/Program.cs @@ -6,7 +6,7 @@ namespace AMRPC_WatchDog_Desktop internal static class Program { - private const string AppVersion = "v0.3.4"; + private const string AppVersion = "v0.4.0"; [STAThread] private static void Main()