本文整理汇总了C#中Module.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Module.Clone方法的具体用法?C# Module.Clone怎么用?C# Module.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitModule
public virtual Differences VisitModule(Module module1, Module module2){
Differences differences = new Differences(module1, module2);
if (module1 == null || module2 == null){
if (module1 != module2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
return differences;
}
Module changes = (Module)module2.Clone();
Module deletions = (Module)module2.Clone();
Module insertions = (Module)module2.Clone();
this.OriginalModule = module1;
this.NewModule = module2;
AssemblyReferenceList arChanges, arDeletions, arInsertions;
Differences diff = this.VisitAssemblyReferenceList(module1.AssemblyReferences, module2.AssemblyReferences, out arChanges, out arDeletions, out arInsertions);
if (diff == null){Debug.Assert(false); return differences;}
changes.AssemblyReferences = arChanges;
deletions.AssemblyReferences = arDeletions;
insertions.AssemblyReferences = arInsertions;
differences.NumberOfDifferences += diff.NumberOfDifferences;
differences.NumberOfSimilarities += diff.NumberOfSimilarities;
AttributeList attrChanges, attrDeletions, attrInsertions;
diff = this.VisitAttributeList(module1.Attributes, module2.Attributes, out attrChanges, out attrDeletions, out attrInsertions);
if (diff == null){Debug.Assert(false); return differences;}
changes.Attributes = attrChanges;
deletions.Attributes = attrDeletions;
insertions.Attributes = attrInsertions;
differences.NumberOfDifferences += diff.NumberOfDifferences;
differences.NumberOfSimilarities += diff.NumberOfSimilarities;
if (module1.HashAlgorithm == module2.HashAlgorithm) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;
if (module1.Kind == module2.Kind) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;
ModuleReferenceList mrChanges, mrDeletions, mrInsertions;
diff = this.VisitModuleReferenceList(module1.ModuleReferences, module2.ModuleReferences, out mrChanges, out mrDeletions, out mrInsertions);
if (diff == null){Debug.Assert(false); return differences;}
changes.ModuleReferences = mrChanges;
deletions.ModuleReferences = mrDeletions;
insertions.ModuleReferences = mrInsertions;
differences.NumberOfDifferences += diff.NumberOfDifferences;
differences.NumberOfSimilarities += diff.NumberOfSimilarities;
if (module1.Name == module2.Name) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;
if (module1.PEKind == module2.PEKind) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;
SecurityAttributeList secChanges, secDeletions, secInsertions;
diff = this.VisitSecurityAttributeList(module1.SecurityAttributes, module2.SecurityAttributes, out secChanges, out secDeletions, out secInsertions);
if (diff == null){Debug.Assert(false); return differences;}
changes.SecurityAttributes = secChanges;
deletions.SecurityAttributes = secDeletions;
insertions.SecurityAttributes = secInsertions;
differences.NumberOfDifferences += diff.NumberOfDifferences;
differences.NumberOfSimilarities += diff.NumberOfSimilarities;
if (module1.TargetRuntimeVersion == module2.TargetRuntimeVersion) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;
if (module1.TrackDebugData == module2.TrackDebugData) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;
TypeNodeList typeChanges, typeDeletions, typeInsertions;
diff = this.VisitTypeNodeList(module1.Types, module2.Types, out typeChanges, out typeDeletions, out typeInsertions);
if (diff == null){Debug.Assert(false); return differences;}
changes.Types = typeChanges;
deletions.Types = typeDeletions;
insertions.Types = typeInsertions;
differences.NumberOfDifferences += diff.NumberOfDifferences;
differences.NumberOfSimilarities += diff.NumberOfSimilarities;
if (differences.NumberOfDifferences == 0){
differences.Changes = null;
differences.Deletions = null;
differences.Insertions = null;
}else{
differences.Changes = changes;
differences.Deletions = deletions;
differences.Insertions = insertions;
}
return differences;
}