SuperMap.Web.ISDotNET6.ServerTextStyle.ToJson C# (CSharp) Method

ToJson() static private method

static private ToJson ( ServerTextStyle serverTextStyle ) : string
serverTextStyle ServerTextStyle
return string
        internal static string ToJson(ServerTextStyle serverTextStyle)
        {
            if (serverTextStyle == null)
            {
                return null;
            }
            string json = "{";
            List<string> list = new List<string>();

            list.Add(string.Format("\"align\":{0}", (int)serverTextStyle.Align));

            list.Add(string.Format("\"bgColor\":{0}", ServerColor.ToJson(serverTextStyle.BgColor)));

            list.Add(string.Format("\"bold\":{0}", serverTextStyle.Bold.ToString().ToLower()));

            list.Add(string.Format("\"color\":{0}", ServerColor.ToJson(serverTextStyle.Color)));

            list.Add(string.Format("\"fixedSize\": {0}", serverTextStyle.FixedSize.ToString().ToLower()));

            list.Add(string.Format("\"fixedTextSize\":{0}", serverTextStyle.FixedTextSize));
            list.Add(string.Format("\"fontHeight\":{0}", serverTextStyle.FontHeight));
            list.Add(string.Format("\"italicAngle\":{0}", serverTextStyle.ItalicAngle));
            if (!string.IsNullOrEmpty(serverTextStyle.FontName))
            {
                list.Add(string.Format("\"fontName\":\"{0}\"", serverTextStyle.FontName));
            }
            list.Add(string.Format("\"fontWidth\":{0}", serverTextStyle.FontWidth));
            list.Add(string.Format("\"italic\":{0}", serverTextStyle.Italic.ToString().ToLower()));
            list.Add(string.Format("\"outline\":{0}", serverTextStyle.Outline.ToString().ToLower()));
            list.Add(string.Format("\"rotation\":{0}", serverTextStyle.Rotation));
            list.Add(string.Format("\"shadow\":{0}", serverTextStyle.Shadow.ToString().ToLower()));
            list.Add(string.Format("\"stroke\":{0}", serverTextStyle.Stroke.ToString().ToLower()));
            list.Add(string.Format("\"transparent\":{0}", serverTextStyle.Transparent.ToString().ToLower()));
            list.Add(string.Format("\"underline\":{0}", serverTextStyle.Underline.ToString().ToLower()));

            json += string.Join(",", list.ToArray());
            json += "}";

            return json;
        }