internal static string ToJson(LabelMixedTextStyle labelMixedTextStyle)
{
string json = "{";
System.Collections.Generic.List<string> list = new List<string>();
if (labelMixedTextStyle.DefaultStyle != null)
{
list.Add(string.Format("\"defaultStyle\":{0}", ServerTextStyle.ToJson(labelMixedTextStyle.DefaultStyle)));
}
else
{
list.Add(string.Format("\"defaultStyle\":{0}", ServerTextStyle.ToJson(new ServerTextStyle())));
}
if (!string.IsNullOrEmpty(labelMixedTextStyle.Separator))
{
list.Add(string.Format("\"separator\":\"{0}\"", labelMixedTextStyle.Separator));
}
else
{
list.Add("\"separator\":\"\"");
}
list.Add(string.Format("\"separatorEnabled\":{0}", labelMixedTextStyle.SeparatorEnabled.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower()));
if (labelMixedTextStyle.SplitIndexes != null && labelMixedTextStyle.SplitIndexes.Count > 0)
{
List<string> splitList = new List<string>();
for (int i = 0; i < labelMixedTextStyle.SplitIndexes.Count; i++)
{
splitList.Add(string.Format("{0}", labelMixedTextStyle.SplitIndexes[i].ToString(System.Globalization.CultureInfo.InvariantCulture)));
}
list.Add(string.Format("\"splitIndexes\":[{0}]", string.Join(",", splitList.ToArray())));
}
else
{
list.Add("\"splitIndexes\":[]");
}
if (labelMixedTextStyle.Styles != null && labelMixedTextStyle.Styles.Count > 0)
{
List<string> stylesList = new List<string>();
foreach (var item in labelMixedTextStyle.Styles)
{
stylesList.Add(ServerTextStyle.ToJson(item));
}
list.Add(string.Format("\"styles\":[{0}]", string.Join(",", stylesList.ToArray())));
}
else
{
list.Add("\"styles\":[]");
}
json += string.Join(",", list.ToArray());
json += "}";
return json;
}