public void Undo() { resourceNodeCreator?.Remove(); if (origModuleCustomAttributes != null && newModuleCustomAttributes != null) { modNode.Document.ModuleDef.CustomAttributes.Clear(); foreach (var ca in origModuleCustomAttributes) { modNode.Document.ModuleDef.CustomAttributes.Add(ca); } } if (origAssemblyCustomAttributes != null && newAssemblyCustomAttributes != null) { modNode.Document.AssemblyDef.CustomAttributes.Clear(); foreach (var ca in origAssemblyCustomAttributes) { modNode.Document.AssemblyDef.CustomAttributes.Add(ca); } } for (int i = existingTypeNodeUpdaters.Length - 1; i >= 0; i--) { existingTypeNodeUpdaters[i].Remove(); } for (int i = newTypeNodeCreators.Length - 1; i >= 0; i--) { newTypeNodeCreators[i].Remove(); } }
public void Undo() { bool refresh = false; resourceNodeCreator?.Remove(); if (!(newAssemblyVersion is null) && !(origAssemblyVersion is null)) { modNode.Document.AssemblyDef !.Version = origAssemblyVersion; refresh = true; } if (!(origExportedTypes is null) && !(newExportedTypes is null)) { modNode.Document.ModuleDef !.ExportedTypes.Clear(); foreach (var et in origExportedTypes) { modNode.Document.ModuleDef.ExportedTypes.Add(et); } } if (!(origModuleCustomAttributes is null) && !(newModuleCustomAttributes is null)) { modNode.Document.ModuleDef !.CustomAttributes.Clear(); foreach (var ca in origModuleCustomAttributes) { modNode.Document.ModuleDef.CustomAttributes.Add(ca); } } if (!(origAssemblyCustomAttributes is null) && !(newAssemblyCustomAttributes is null)) { modNode.Document.AssemblyDef !.CustomAttributes.Clear(); foreach (var ca in origAssemblyCustomAttributes) { modNode.Document.AssemblyDef.CustomAttributes.Add(ca); } } if (!(origAssemblyDeclSecurities is null) && !(newAssemblyDeclSecurities is null)) { modNode.Document.AssemblyDef !.DeclSecurities.Clear(); foreach (var ds in origAssemblyDeclSecurities) { modNode.Document.AssemblyDef.DeclSecurities.Add(ds); } } for (int i = existingTypeNodeUpdaters.Length - 1; i >= 0; i--) { existingTypeNodeUpdaters[i].Remove(); } for (int i = newTypeNodeCreators.Length - 1; i >= 0; i--) { newTypeNodeCreators[i].Remove(); } if (refresh) { asmNode?.TreeNode.RefreshUI(); } }
public void Undo() { resourceNodeCreator?.Remove(); if (newAssemblyVersion != null && origAssemblyVersion != null) { modNode.Document.AssemblyDef.Version = origAssemblyVersion; asmNode?.TreeNode.RefreshUI(); } if (origModuleCustomAttributes != null && newModuleCustomAttributes != null) { modNode.Document.ModuleDef.CustomAttributes.Clear(); foreach (var ca in origModuleCustomAttributes) { modNode.Document.ModuleDef.CustomAttributes.Add(ca); } } if (origAssemblyCustomAttributes != null && newAssemblyCustomAttributes != null) { modNode.Document.AssemblyDef.CustomAttributes.Clear(); foreach (var ca in origAssemblyCustomAttributes) { modNode.Document.AssemblyDef.CustomAttributes.Add(ca); } } if (origAssemblyDeclSecurities != null && newAssemblyDeclSecurities != null) { modNode.Document.AssemblyDef.DeclSecurities.Clear(); foreach (var ds in origAssemblyDeclSecurities) { modNode.Document.AssemblyDef.DeclSecurities.Add(ds); } } for (int i = existingTypeNodeUpdaters.Length - 1; i >= 0; i--) { existingTypeNodeUpdaters[i].Remove(); } for (int i = newTypeNodeCreators.Length - 1; i >= 0; i--) { newTypeNodeCreators[i].Remove(); } }