public override void Deserialize(Dictionary <string, object> data) { base.Deserialize(data); foreach (Dictionary <string, object> data1 in data["y_unit"] as object[]) { TimelineUnit unit = new TimelineUnit((object)"1", (object)"1", true); unit.Deserialize(data1); this.AddOption(unit); } }
public void Deserialize(Dictionary <string, object> data) { this.key = (object)data["key"].ToString(); this.label = (object)data["label"].ToString(); this.elements.Clear(); if (!data.ContainsKey("children")) { return; } foreach (Dictionary <string, object> data1 in data["children"] as object[]) { TimelineUnit unit = new TimelineUnit((object)"1", (object)"1", false); unit.Deserialize(data1); this.AddOption(unit); } }
public void AddOptions(IEnumerable units) { object obj = (object)null; foreach (object unit in units) { TimelineUnit timelineUnit = unit as TimelineUnit; if (timelineUnit != null) { this.elements.Add(timelineUnit); } else { obj = unit; break; } } if (obj == null) { return; } PropertyInfo[] properties = obj.GetType().GetProperties(); PropertyInfo propertyInfo1 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "key")); PropertyInfo propertyInfo2 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "label")); PropertyInfo propertyInfo3 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "open")); PropertyInfo propertyInfo4 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "children")); if (propertyInfo1 == null && propertyInfo2 == null) { return; } foreach (object unit in units) { IEnumerable <object> objects = propertyInfo3.GetValue(unit, (object[])null) as IEnumerable <object>; TimelineUnit timelineUnit = this.AddOption(new TimelineUnit(propertyInfo1.GetValue(unit, (object[])null), propertyInfo2.GetValue(unit, (object[])null), propertyInfo3 != null && (bool)propertyInfo3.GetValue(unit, (object[])null))); if (propertyInfo4 != null && objects != null) { timelineUnit.AddOptions((IEnumerable)objects); } } }
public TimelineUnit AddOption(object unit) { PropertyInfo[] properties = unit.GetType().GetProperties(); PropertyInfo propertyInfo1 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "key")); PropertyInfo propertyInfo2 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "label")); PropertyInfo propertyInfo3 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "open")); PropertyInfo propertyInfo4 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "children")); if (propertyInfo1 == null && propertyInfo2 == null) { return((TimelineUnit)null); } TimelineUnit timelineUnit = this.AddOption(new TimelineUnit(propertyInfo1.GetValue(unit, (object[])null), propertyInfo2.GetValue(unit, (object[])null), propertyInfo3 != null && (bool)propertyInfo3.GetValue(unit, (object[])null))); IEnumerable <object> objects = propertyInfo3.GetValue(unit, (object[])null) as IEnumerable <object>; if (propertyInfo4 != null && objects != null) { timelineUnit.AddOptions((IEnumerable)objects); } return(timelineUnit); }
public TimelineUnit AddOption(TimelineUnit unit) { this.elements.Add(unit); return(unit); }
public TimelineUnit AddOption(TimelineUnit unit) { this.m_serverList.AddOption(unit); return(unit); }