public Event(IChannel source, LooseDictionary data, int beginTime, int endTime) : base(data) { this.BeginTime = beginTime; this.EndTime = endTime; this.Source = source; }
private static void ResolveKey(ref string key, ref LooseDictionary dict) { string[] parts = key.Split('.'); LooseObject obj; for (int i = 0; i < parts.Length - 1; i++) { if (!dict.TryGetValue(parts[i], out obj)) throw new ArgumentException("key: Contains non-existant path."); dict = obj as LooseDictionary; if (dict == null) throw new ArgumentException("key: Contains non-dictionary in path."); } key = parts[parts.Length - 1]; }
public LooseObject this[string key] { get { LooseDictionary dict = this; ResolveKey(ref key, ref dict); return(dict.GetFlat(key)); } set { LooseDictionary dict = this; ResolveKey(ref key, ref dict); if (value == null) { dict.Remove(key); } else { dict.dictionary[key] = value; } } }
private static void SerializeDictionary(StringBuilder str, LooseDictionary dict) { str.Append('{'); List<string> keys = new List<string>(dict.Keys); keys.Sort(); bool comma = false; foreach (string key in keys) { if (comma) str.Append(','); comma = true; SerializeString(str, key); str.Append(':'); SerializeObject(str, dict[key]); } str.Append('}'); }
private static void ResolveKey(ref string key, ref LooseDictionary dict) { string[] parts = key.Split('.'); LooseObject obj; for (int i = 0; i < parts.Length - 1; i++) { if (!dict.TryGetValue(parts[i], out obj)) { throw new ArgumentException("key: Contains non-existant path."); } dict = obj as LooseDictionary; if (dict == null) { throw new ArgumentException("key: Contains non-dictionary in path."); } } key = parts[parts.Length - 1]; }
protected MetadataObject(LooseDictionary data) { this.LooseData = data; this.Name = data["name"].ToString(); }
protected Event(IChannel source, LooseDictionary data) : base(data) { this.SetLoose(); this.Source = source; }