internal static ThemeLabelText FromJson(JsonObject json) { if (json == null) return null; ThemeLabelText labelText = new ThemeLabelText(); labelText.MaxTextHeight = (int)json["maxTextHeight"]; labelText.MaxTextWidth = (int)json["maxTextWidth"]; labelText.MinTextHeight = (int)json["minTextHeight"]; labelText.MinTextWidth = (int)json["minTextWidth"]; labelText.UniformMixedStyle = LabelMixedTextStyle.FromJson((JsonObject)json["uniformMixedStyle"]); labelText.UniformStyle = ServerTextStyle.FromJson((JsonObject)json["uniformStyle"]); return labelText; }
internal static string ToJson(ThemeLabelText labelText) { string json = ""; System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>(); list.Add(string.Format("\"minTextHeight\":{0}", labelText.MinTextHeight.ToString(System.Globalization.CultureInfo.InvariantCulture))); list.Add(string.Format("\"maxTextWidth\":{0}", labelText.MaxTextWidth.ToString(System.Globalization.CultureInfo.InvariantCulture))); list.Add(string.Format("\"minTextWidth\":{0}", labelText.MinTextWidth.ToString(System.Globalization.CultureInfo.InvariantCulture))); list.Add(string.Format("\"maxTextHeight\":{0}", labelText.MaxTextHeight.ToString(System.Globalization.CultureInfo.InvariantCulture))); if (labelText.UniformStyle != null) { list.Add(string.Format("\"uniformStyle\":{0}", ServerTextStyle.ToJson(labelText.UniformStyle))); } else { list.Add(string.Format("\"uniformStyle\":{0}", ServerTextStyle.ToJson(new ServerTextStyle()))); } if (labelText.UniformMixedStyle != null) { list.Add(string.Format("\"uniformMixedStyle\":{0}", LabelMixedTextStyle.ToJson(labelText.UniformMixedStyle))); } else { list.Add("\"uniformMixedStyle\":null"); } json = string.Join(",", list.ToArray()); return json; }