public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("Created", Created); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("SharedGroupId", SharedGroupId); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("PlayFabIds", PlayFabIds); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("PlayFabId", PlayFabId); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("CharacterId", CharacterId); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("VirtualCurrency", VirtualCurrency); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("Amount", Amount); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("FriendPlayFabId", FriendPlayFabId); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("FriendUsername", FriendUsername); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("FriendEmail", FriendEmail); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("FriendTitleDisplayName", FriendTitleDisplayName); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
// <summary> /// A helper method for serializing an object to JSON /// </summary> /// <param name="value"></param> /// <returns></returns> public static string Serialize(object value, JsonWriterSettings settings) { StringBuilder output = new StringBuilder(); using (JsonWriter writer = new JsonWriter(output, settings)) { writer.Write(value); } return output.ToString(); }
/// <summary> /// Outputs a .NET Regex as an ECMAScript RegExp literal. /// </summary> /// <param name="writer"></param> /// <param name="regex"></param> /// <param name="isGlobal"></param> /// <remarks> /// http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf /// </remarks> public static void WriteEcmaScriptRegExp(JsonWriter writer, Regex regex, bool isGlobal) { if (regex == null) { writer.TextWriter.Write(JsonReader.LiteralNull); return; } // Regex.ToString() returns the original pattern string pattern = regex.ToString(); if (String.IsNullOrEmpty(pattern)) { // must output something otherwise becomes a code comment pattern = EcmaScriptWriter.EmptyRegExpLiteral; } string modifiers = isGlobal ? "g" : ""; switch (regex.Options & (RegexOptions.IgnoreCase|RegexOptions.Multiline)) { case RegexOptions.IgnoreCase: { modifiers += "i"; break; } case RegexOptions.Multiline: { modifiers += "m"; break; } case RegexOptions.IgnoreCase|RegexOptions.Multiline: { modifiers += "im"; break; } } writer.TextWriter.Write(EcmaScriptWriter.RegExpLiteralDelim); int length = pattern.Length; int start = 0; for (int i = start; i < length; i++) { switch (pattern[i]) { case EcmaScriptWriter.RegExpLiteralDelim: { writer.TextWriter.Write(pattern.Substring(start, i - start)); start = i + 1; writer.TextWriter.Write(EcmaScriptWriter.OperatorCharEscape); writer.TextWriter.Write(pattern[i]); break; } } } writer.TextWriter.Write(pattern.Substring(start, length - start)); writer.TextWriter.Write(EcmaScriptWriter.RegExpLiteralDelim); writer.TextWriter.Write(modifiers); }
public static void WriteEcmaScriptDate(JsonWriter writer, DateTime value) { if (value.Kind == DateTimeKind.Unspecified) { // unknown timezones serialize directly to become browser-local writer.TextWriter.Write( EcmaScriptWriter.EcmaScriptDateCtor7, value.Year, // yyyy value.Month-1, // 0-11 value.Day, // 1-31 value.Hour, // 0-23 value.Minute, // 0-60 value.Second, // 0-60 value.Millisecond); // 0-999 return; } if (value.Kind == DateTimeKind.Local) { // convert server-local to UTC value = value.ToUniversalTime(); } // find the time since Jan 1, 1970 TimeSpan duration = value.Subtract(EcmaScriptWriter.EcmaScriptEpoch); // get the total milliseconds long ticks = (long)duration.TotalMilliseconds; // write out as a Date constructor writer.TextWriter.Write( EcmaScriptWriter.EcmaScriptDateCtor1, ticks); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("ItemInstanceId", ItemInstanceId); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("RemainingUses", RemainingUses); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("OrderId", OrderId); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("PurchaseDate", PurchaseDate); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("Items", Items); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("UsageCount", UsageCount); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("UsagePeriod", UsagePeriod); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("UsagePeriodGroup", UsagePeriodGroup); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("BundledItems", BundledItems); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("BundledResultTables", BundledResultTables); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("BundledVirtualCurrencies", BundledVirtualCurrencies); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("PlayFabId", PlayFabId); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("Created", Created); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("Username", Username); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("TitleInfo", TitleInfo); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("PrivateInfo", PrivateInfo); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("FacebookInfo", FacebookInfo); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("SteamInfo", SteamInfo); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("GameCenterInfo", GameCenterInfo); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("DisplayName", DisplayName); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("UserStatistics", UserStatistics); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("Data", Data); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("Permission", Permission); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("ReceiptData", ReceiptData); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("CurrencyCode", CurrencyCode); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("PurchasePrice", PurchasePrice); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("Value", Value); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("LastUpdated", LastUpdated); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("Permission", Permission); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("KeyItemId", KeyItemId); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("ItemContents", ItemContents); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("ResultTableContents", ResultTableContents); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("VirtualCurrencyContents", VirtualCurrencyContents); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("FacebookId", FacebookId); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("ItemInstanceId", ItemInstanceId); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("ConsumeCount", ConsumeCount); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("GameCenterId", GameCenterId); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("SharedGroupId", SharedGroupId); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("Email", Email); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
/// <summary> /// Outputs a .NET Regex as an ECMAScript RegExp literal. /// Defaults to global matching off. /// </summary> /// <param name="writer"></param> /// <param name="regex"></param> /// <remarks> /// http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf /// </remarks> public static void WriteEcmaScriptRegExp(JsonWriter writer, Regex regex) { EcmaScriptWriter.WriteEcmaScriptRegExp(writer, regex, false); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("SteamId", SteamId); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("SteamCountry", SteamCountry); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("SteamCurrency", SteamCurrency); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("SteamActivationStatus", SteamActivationStatus); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
public void Write (JsonWriter writer, Type type, object value) { Dictionary<string,object> dict = WriteJson (type,value); writer.Write (dict); }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("DisplayName", DisplayName); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("Origination", Origination); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("Created", Created); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("LastLogin", LastLogin); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("FirstLogin", FirstLogin); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("isBanned", isBanned); writer.Writer.Write(JsonReader.OperatorObjectEnd); }
void IJsonSerializable.WriteJson(JsonWriter writer) { if (String.IsNullOrEmpty(this.identifier)) { writer.TextWriter.Write("null"); } else { // TODO: determine if this should output parens around identifier writer.TextWriter.Write(this.identifier); } }
public override void WriteJson(JsonWriter writer) { writer.Writer.Write(JsonReader.OperatorObjectStart); writer.WriteObjectProperty("ReceiptJson", ReceiptJson); writer.Writer.Write(JsonReader.OperatorValueDelim); writer.WriteObjectProperty("Signature", Signature); writer.Writer.Write(JsonReader.OperatorObjectEnd); }