internal static string ToJson(ThemeRange themeRange)
{
string json = "{";
List<string> list = new List<string>();
if (themeRange.Items != null && themeRange.Items.Count >= 1)
{
List<string> tempTUI = new List<string>();
foreach (var item in themeRange.Items)
{
tempTUI.Add(ThemeRangeItem.ToJson(item));
}
list.Add(string.Format("\"items\":[{0}]", String.Join(",", tempTUI.ToArray())));
}
else
{
list.Add("\"items\":[]");
}
list.Add(string.Format("\"rangeParameter\":\"{0}\"", themeRange.RangeParameter.ToString(System.Globalization.CultureInfo.InvariantCulture)));
list.Add(string.Format("\"rangeMode\":\"{0}\"", themeRange.RangeMode));
list.Add(string.Format("\"colorGradientType\":\"{0}\"", themeRange.ColorGradientType.ToString()));
if (!string.IsNullOrEmpty(themeRange.RangeExpression))
{
list.Add(string.Format("\"rangeExpression\":\"{0}\"", themeRange.RangeExpression));
}
else
{
list.Add("\"rangeExpression\":\"\"");
}
if (themeRange.MemoryData != null)
{
list.Add("\"memoryData\":" + themeRange.ToJson(themeRange.MemoryData));
}
else
{
list.Add("\"memoryData\":null");
}
list.Add("\"type\":\"RANGE\"");
json += string.Join(",", list.ToArray());
json += "}";
return json;
}