public void AddObjectProperty(object prop, bool includeState) { IGxJSONAble ijsonprop; JArray jarray = jsonArr as JArray; if ((ijsonprop = prop as IGxJSONAble) != null) { GxUserType bc = ijsonprop as GxUserType; if (bc != null) { jarray.Add(bc.GetJSONObject(includeState)); } else { jarray.Add(ijsonprop.GetJSONObject()); } } else if (prop is DateTime) { jarray.Add(DateTimeUtil.TToC2((DateTime)prop)); } else { jarray.Add(prop); } }
internal static RemoteNotification FromGxUserType(GxUserType sdt) { RemoteNotification notification = new RemoteNotification(); JObject jobj = sdt.GetJSONObject() as JObject; if (jobj != null) { object deviceTypeObj = jobj["DeviceType"]; if (deviceTypeObj is Int16) { notification.DeviceType = (short)deviceTypeObj; } else { notification.DeviceType = -1; } notification.DeviceToken = TryGetObjectPropertyValue(jobj, "DeviceToken"); notification.Message = TryGetObjectPropertyValue(jobj, "Message"); notification.Title = TryGetObjectPropertyValue(jobj, "Title"); notification.Icon = TryGetObjectPropertyValue(jobj, "Icon"); notification.Sound = TryGetObjectPropertyValue(jobj, "Sound"); notification.Badge = TryGetObjectPropertyValue(jobj, "Badge"); notification.Delivery.Priority = TryGetObjectPropertyValue(jobj["Delivery"] as JObject, "Priority", "normal"); notification.ExecutionTime = 0; notification.Parameters = new NotificationParameters(); JObject eventObj = jobj["Event"] as JObject; if (eventObj != null) { notification.Action = eventObj["Name"] as string; object executionTime = eventObj["Execution"]; if (executionTime is Int16) { notification.ExecutionTime = (short)executionTime; } if (eventObj.Contains("Parameters")) { JArray arr = eventObj["Parameters"] as JArray; for (int i = 0; i < arr.Length; i++) { notification.Parameters.Add(arr.GetObject(i)["Name"] as string, arr.GetObject(i)["Value"] as string); } } } } return(notification); }
public int GetManager(GxUserType gxStoreConfig, int platform, out IStoreManager mgr) { Init(); JObject storeConfig = (JObject)gxStoreConfig.GetJSONObject(); mgr = null; int errCode = 1; switch (platform) { case 2: string appleKey; if (GetConfigValue("appleKey", storeConfig, out appleKey)) { mgr = new AppleStoreStoreManager(appleKey); errCode = 0; } break; case 1: string sAccount, certPath, certPassword; if (GetConfigValue("googleServiceAccount", storeConfig, out sAccount) && GetConfigValue("googleCertificate", storeConfig, out certPath) && GetConfigValue("googleCertificatePassword", storeConfig, out certPassword)) { mgr = new GooglePlayStoreManager() { CertificatePassword = certPassword, CertificatePath = certPath, ServiceAccountEmail = sAccount }; errCode = 0; } break; default: throw new StoreInvalidPurchaseException("StoreManager Platform not implemented"); } ErrCode = errCode; return(errCode); }