コード例 #1
0
ファイル: FieldsRestorer.cs プロジェクト: kidhudi/de4dot
        public void initialize()
        {
            foreach (var kv in getMovedTypes())
            {
                var structType = kv.Key;
                structToOwners.add(structType, kv.Value);

                foreach (var ownerType in kv.Value)
                {
                    foreach (var ownerField in ownerType.Fields)
                    {
                        if (DotNetUtils.getType(module, ownerField.FieldType) != structType)
                        {
                            continue;
                        }
                        structFieldsToFix.add(ownerField, true);
                        break;
                    }

                    var fieldsDict = new FieldDefinitionAndDeclaringTypeDict <FieldDefinition>();
                    typeToFieldsDict.add(ownerType, fieldsDict);
                    foreach (var structField in structType.Fields)
                    {
                        var newField = DotNetUtils.createFieldDefinition(structField.Name, structField.Attributes, structField.FieldType);
                        ownerType.Fields.Add(newField);
                        fieldsDict.add(structField, newField);
                    }
                }
            }
        }