SuperMap.Web.iServerJava2.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));
            if (ServerColor.ToJson(serverTextStyle.BgColor) != null)
            {
                list.Add(string.Format("\"bgColor\":{0}", ServerColor.ToJson(serverTextStyle.BgColor)));
            }
            else
            {
                list.Add(string.Format("\"bgColor\":null"));
            }
            list.Add(string.Format("\"bold\":{0}", serverTextStyle.Bold));
            if (ServerColor.ToJson(serverTextStyle.Color) != null)
            {
                list.Add(string.Format("\"color\":{0}", ServerColor.ToJson(serverTextStyle.Color)));
            }
            else
            {
                list.Add(string.Format("\"color\":null"));
            }
            list.Add(string.Format("\"fixedSize\":{0}", serverTextStyle.FixedSize));
            list.Add(string.Format("\"fixedTextSize\":{0}", serverTextStyle.FixedTextSize));
            list.Add(string.Format("\"fontHeight\":{0}", serverTextStyle.FontHeight));
            list.Add(string.Format("\"fontWeight\":{0}", serverTextStyle.FontWeight));
            if (serverTextStyle.FontName != null)
            {
                list.Add(string.Format("\"fontName\":{0}", serverTextStyle.FontName));
            }
            list.Add(string.Format("\"fontWidth\":{0}", serverTextStyle.FontWidth));
            list.Add(string.Format("\"italic\":{0}", serverTextStyle.Italic));
            list.Add(string.Format("\"outline\":{0}", serverTextStyle.Outline));
            list.Add(string.Format("\"rotation\":{0}", serverTextStyle.Rotation));
            list.Add(string.Format("\"shadow\":{0}", serverTextStyle.Shadow));
            list.Add(string.Format("\"stroke\":{0}", serverTextStyle.Stroke));
            list.Add(string.Format("\"transparent\":{0}", serverTextStyle.Transparent));
            list.Add(string.Format("\"underline\":{0}", serverTextStyle.Underline));

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

            return json;
        }