using DiscordRPC.Converters; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace DiscordRPC.RPC.Payload { /// /// The payload that is sent by the client to discord for events such as setting the rich presence. /// /// SetPrecense /// /// internal class ArgumentPayload : IPayload { /// /// The data the server sent too us /// [JsonProperty("args", NullValueHandling = NullValueHandling.Ignore)] public JObject Arguments { get; set; } public ArgumentPayload() : base() { Arguments = null; } public ArgumentPayload(long nonce) : base(nonce) { Arguments = null; } public ArgumentPayload(object args, long nonce) : base(nonce) { SetObject(args); } /// /// Sets the obejct stored within the data. /// /// public void SetObject(object obj) { Arguments = JObject.FromObject(obj); } /// /// Gets the object stored within the Data /// /// /// public T GetObject() { return Arguments.ToObject(); } public override string ToString() { return "Argument " + base.ToString(); } } }