//todo, i do not need the expandoobject anymore, i can have the same functionality directly with a dictionary here. public ExpandoObjectProxy(ExpandibleObject instance, Action <object, string> SetExecuted) { setExecuted = SetExecuted; realInstance = instance; objectDictionary = (IDictionary <string, object>)realInstance.asDictionary(); }
private void childAdded(string Key, ChangeSet input) { //if i already have an object with this key i'll ignore it, and see what happens. if (innerDictionary.ContainsKey(Key)) { return; } object obj = null; var type = input["type"].As <string>(); if (isPrimitiveTypeName(type)) { if (type == "Date") { obj = (input["value"].As <DateTime>()).ToLocalTime(); } else { //let's say this is a literal for now. obj = input["value"]; } innerDictionary[Key] = obj; } else if (type == "null") { innerDictionary[Key] = null; } else { //first version. if (type == "Array") { obj = new List <Object>(); } else { obj = new ExpandibleObject(new object()); } innerDictionary[Key] = obj; mapSnapshotToObject(obj, input); } checkForRefrences(Key, obj); if (!initialized && missingReferences.Count == 0) { initialized = true; Initialized?.Invoke(this, EventArgs.Empty); } }