Example #1
0
 /// <summary>
 /// Creates a UserEvent from a JSON Object
 /// </summary>
 /// <param name="item">The item.</param>
 /// <param name="settings">The settings.</param>
 /// <returns>
 /// A UserEvent object
 /// </returns>
 internal static UserEvent FromJToken(JToken item, IMusicClientSettings settings)
 {
     return(new UserEvent
     {
         Action = ParseHelper.ParseEnumOrDefault <UserEventAction>(item.Value <string>("action")),
         Client = item.Value <string>("client"),
         ClientVersion = item.Value <string>("clientversion"),
         DateTime = item.Value <DateTime>("datetime"),
         Location = Location.FromJToken(item["location"]),
         Mix = Mix.FromJToken(item["mix"], settings),
         Offset = item.Value <int>("offset"),
         Product = Product.FromJToken(item["product"], settings),
         Target = ParseHelper.ParseEnumOrDefault <UserEventTarget>(item.Value <string>("target")),
         ClientType = ParseHelper.ParseEnumOrDefault <UserEventClientType>(item.Value <string>("clienttype"))
     });
 }