Exemple #1
0
 /// <summary>
 /// Serializes the object to JSON.
 /// </summary>
 /// <param name="writer">The <see cref="T: Newtonsoft.Json.JsonWriter" /> to write to.</param>
 /// <param name="obj">The object to serialize to JSON.</param>
 internal static void Serialize(JsonWriter writer, ContainerLabel obj)
 {
     // Required properties are always serialized, optional properties are serialized when not null.
     writer.WriteStartObject();
     writer.WriteProperty(obj.Name, "name", JsonWriterExtensions.WriteStringValue);
     writer.WriteProperty(obj.Value, "value", JsonWriterExtensions.WriteStringValue);
     writer.WriteEndObject();
 }
Exemple #2
0
        public static void Load(XmlElement node)
        {
            ClearAll();

            try
            {
                foreach (XmlElement el in node.GetElementsByTagName("containerlabel"))
                {
                    ContainerLabel label = new ContainerLabel
                    {
                        Id    = el.GetAttribute("id"),
                        Type  = el.GetAttribute("type"),
                        Label = el.GetAttribute("label"),
                        Hue   = Convert.ToInt32(el.GetAttribute("hue")),
                        Alias = el.GetAttribute("alias")
                    };

                    ContainerLabelList.Add(label);
                }
            }
            catch
            {
            }
        }