${IS6_Entity_Title}
${IS6_Entity_Description}
/// <summary>${IS6_Entity_method_fromJSON_D}</summary> /// <returns>${IS6_Entity_method_fromJSON_Return}</returns> /// <param name="jsonObject">${IS6_Entity_method_fromJSON_param}</param> public static Entity FromJson(JsonObject jsonObject) { if (jsonObject == null) { return null; } Entity entity = new Entity(); entity.ID = jsonObject["id"]; entity.Shape = ServerGeometry.FromJson((JsonObject)jsonObject["shape"]); //fieldValue JsonArray jsonValue = (JsonArray)jsonObject["fieldValues"]; if (jsonValue != null && jsonValue.Count > 0) { entity.FieldValues = new List<string>(); for (int i = 0; i < jsonValue.Count; i++) { entity.FieldValues.Add(jsonValue[i]); } } //fieldNames JsonArray jsonNames = (JsonArray)jsonObject["fieldNames"]; if (jsonNames != null && jsonNames.Count > 0) { entity.FieldNames = new List<string>(); for (int i = 0; i < jsonNames.Count; i++) { entity.FieldNames.Add(jsonNames[i]); } } return entity; }
internal static string ToJson(Entity entity) { if (entity == null) { return null; } string json = "{"; List<string> list = new List<string>(); if (entity.FieldNames != null && entity.FieldNames.Count > 0) { List<string> temp = new List<string>(); foreach (string fn in entity.FieldNames) { temp.Add(string.Format("\"{0}\"", fn)); } list.Add(string.Format("\"fieldNames\":[{0}]", string.Join(",", temp.ToArray()))); } else { list.Add(string.Format("\"fieldNames\":null")); } if (entity.FieldValues != null && entity.FieldValues.Count > 0) { List<string> temp = new List<string>(); foreach (string fv in entity.FieldValues) { temp.Add(string.Format("\"{0}\"", fv)); } list.Add(string.Format("\"fieldValues\":[{0}]", string.Join(",", temp.ToArray()))); } else { list.Add(string.Format("\"fieldValues\":null")); } list.Add(string.Format("\"shape\":{0}", ServerGeometry.ToJson(entity.Shape))); list.Add(string.Format("\"id\":{0}", entity.ID)); json += string.Join(",", list.ToArray()); json += "}"; return json; }
/// <summary>${IS6_GetEntityEventArgs_constructor_None_D}</summary> public GetEntityEventArgs(Entity result, string originResult, object token) : base(token) { Result = result; OriginResult = originResult; }