private void IntegrateStatements(IDesignerSerializationManager manager, object root, ICollection members, StatementContext statementCxt, CodeTypeDeclaration typeDecl) { Dictionary <string, int> dictionary = new Dictionary <string, int>(); List <CodeMethodMap> list = new List <CodeMethodMap>(); if (members != null) { foreach (object obj2 in members) { if (obj2 != root) { CodeStatementCollection statements = statementCxt.StatementCollection[obj2]; if (statements != null) { CodeMethodMap map; int num; CodeMemberMethod method = this.GetInitializeMethod(manager, typeDecl, obj2); if (method == null) { throw new InvalidOperationException(); } if (dictionary.TryGetValue(method.Name, out num)) { map = list[num]; } else { map = new CodeMethodMap(method); list.Add(map); dictionary[method.Name] = list.Count - 1; } if (statements.Count > 0) { map.Add(statements); } } } } } CodeStatementCollection statements2 = statementCxt.StatementCollection[root]; if (statements2 != null) { CodeMethodMap map2; int num2; CodeMemberMethod method2 = this.GetInitializeMethod(manager, typeDecl, root); if (method2 == null) { throw new InvalidOperationException(); } if (dictionary.TryGetValue(method2.Name, out num2)) { map2 = list[num2]; } else { map2 = new CodeMethodMap(method2); list.Add(map2); dictionary[method2.Name] = list.Count - 1; } if (statements2.Count > 0) { map2.Add(statements2); } } foreach (CodeMethodMap map3 in list) { map3.Combine(); typeDecl.Members.Add(map3.Method); } }
private void IntegrateStatements(IDesignerSerializationManager manager, object root, ICollection members, StatementContext statementCxt, CodeTypeDeclaration typeDecl) { Dictionary<string, int> dictionary = new Dictionary<string, int>(); List<CodeMethodMap> list = new List<CodeMethodMap>(); if (members != null) { foreach (object obj2 in members) { if (obj2 != root) { CodeStatementCollection statements = statementCxt.StatementCollection[obj2]; if (statements != null) { CodeMethodMap map; int num; CodeMemberMethod method = this.GetInitializeMethod(manager, typeDecl, obj2); if (method == null) { throw new InvalidOperationException(); } if (dictionary.TryGetValue(method.Name, out num)) { map = list[num]; } else { map = new CodeMethodMap(method); list.Add(map); dictionary[method.Name] = list.Count - 1; } if (statements.Count > 0) { map.Add(statements); } } } } } CodeStatementCollection statements2 = statementCxt.StatementCollection[root]; if (statements2 != null) { CodeMethodMap map2; int num2; CodeMemberMethod method2 = this.GetInitializeMethod(manager, typeDecl, root); if (method2 == null) { throw new InvalidOperationException(); } if (dictionary.TryGetValue(method2.Name, out num2)) { map2 = list[num2]; } else { map2 = new CodeMethodMap(method2); list.Add(map2); dictionary[method2.Name] = list.Count - 1; } if (statements2.Count > 0) { map2.Add(statements2); } } foreach (CodeMethodMap map3 in list) { map3.Combine(); typeDecl.Members.Add(map3.Method); } }
internal void Deserialize(IDesignerSerializationManager manager, IDictionary objectState, IList objectNames, bool applyDefaults) { CodeStatementCollection completeStatements = new CodeStatementCollection(); this._expressions = new Dictionary<string, ArrayList>(); this.applyDefaults = applyDefaults; foreach (string str in objectNames) { object[] objArray = (object[]) objectState[str]; if (objArray != null) { if (objArray[0] != null) { this.PopulateCompleteStatements(objArray[0], str, completeStatements); } if (objArray[1] != null) { this.PopulateCompleteStatements(objArray[1], str, completeStatements); } } } CodeStatementCollection targetStatements = new CodeStatementCollection(); CodeMethodMap map = new CodeMethodMap(targetStatements, null); map.Add(completeStatements); map.Combine(); this._statementsTable = new Hashtable(); CodeDomSerializerBase.FillStatementTable(manager, this._statementsTable, targetStatements); ArrayList list = new ArrayList(objectNames); foreach (string str2 in this._statementsTable.Keys) { if (!list.Contains(str2)) { list.Add(str2); } } this._objectState = new Hashtable(objectState.Keys.Count); foreach (DictionaryEntry entry in objectState) { this._objectState.Add(entry.Key, entry.Value); } ResolveNameEventHandler handler = new ResolveNameEventHandler(this.OnResolveName); manager.ResolveName += handler; try { foreach (string str3 in list) { this.ResolveName(manager, str3, true); } } finally { this._objectState = null; manager.ResolveName -= handler; } }