internal static string ToJson(LabelImageCell imageCell) { string json = "{"; List<string> list = new List<string>(); list.Add(string.Format("\"pathField\":\"{0}\"", imageCell.PathField)); list.Add(string.Format("\"sizeFixed\":{0}", imageCell.SizeFixed.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower())); list.Add(string.Format(System.Globalization.CultureInfo.InvariantCulture, "\"height\":{0}", imageCell.Height)); list.Add(string.Format(System.Globalization.CultureInfo.InvariantCulture, "\"width\":{0}", imageCell.Width)); list.Add(string.Format(System.Globalization.CultureInfo.InvariantCulture, "\"rotation\":{0}", imageCell.Rotation)); list.Add(string.Format("\"type\":\"{0}\"", imageCell.Type)); json += string.Join(",", list.ToArray()); json += "}"; return json; }
internal static LabelImageCell FromJson(JsonObject json) { if (json == null) return null; LabelImageCell imageCell = new LabelImageCell(); imageCell.Height = (double)json["height"]; imageCell.PathField = (string)json["pathField"]; imageCell.Rotation = (double)json["rotation"]; imageCell.SizeFixed = (bool)json["sizeFixed"]; imageCell.Width = (double)json["width"]; return imageCell; }