${REST_ThemeUniqueItem_Title}
${REST_ThemeUniqueItem_Description}
internal static string ToJson(ThemeUniqueItem item) { string json = "{"; List<string> list = new List<string>(); if (!string.IsNullOrEmpty(item.Caption)) { list.Add(string.Format("\"caption\":\"{0}\"", item.Caption)); } else { list.Add("\"caption\":\"\""); } //默认值这边儿是个问题,又不要判断呢? list.Add(string.Format("\"visible\":{0}", item.Visible.ToString().ToLower())); if (item.Style != null) { list.Add(string.Format("\"style\":{0}", ServerStyle.ToJson(item.Style))); } else { list.Add(string.Format("\"style\":{0}", ServerStyle.ToJson(new ServerStyle()))); } if (!string.IsNullOrEmpty(item.Unique)) { list.Add(string.Format("\"unique\":\"{0}\"", item.Unique)); } else { list.Add("\"unique\":\"\""); } json += string.Join(",", list.ToArray()); json += "}"; return json; }
internal static ThemeUniqueItem FromJson(JsonValue jsonValue) { if (jsonValue == null) { return null; }; ThemeUniqueItem item = new ThemeUniqueItem(); item.Caption = jsonValue.GetObject()["caption"].GetStringEx(); item.Style = ServerStyle.FromJson(jsonValue.GetObject()["style"].GetObjectEx()); item.Unique = jsonValue.GetObject()["unique"].GetStringEx(); item.Visible = jsonValue.GetObject()["visible"].GetBooleanEx(); return item; }