本文整理汇总了C#中AssemblyNode.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# AssemblyNode.Clone方法的具体用法?C# AssemblyNode.Clone怎么用?C# AssemblyNode.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssemblyNode
的用法示例。
在下文中一共展示了AssemblyNode.Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitAssembly
public virtual Differences VisitAssembly(AssemblyNode/*!*/ assembly1, AssemblyNode assembly2) {
Differences differences = new Differences(assembly1, assembly2);
if (assembly1 == null || assembly2 == null){
if (assembly1 != assembly2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
return differences;
}
AssemblyNode changes = (AssemblyNode)assembly2.Clone();
AssemblyNode deletions = (AssemblyNode)assembly2.Clone();
AssemblyNode insertions = (AssemblyNode)assembly2.Clone();
this.OriginalModule = assembly1;
this.NewModule = assembly2;
AssemblyReferenceList arChanges, arDeletions, arInsertions;
Differences diff = this.VisitAssemblyReferenceList(assembly1.AssemblyReferences, assembly2.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(assembly1.Attributes, assembly2.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 (assembly1.Culture == assembly2.Culture) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;
TypeNodeList typeChanges, typeDeletions, typeInsertions;
diff = this.VisitTypeNodeList(assembly1.ExportedTypes, assembly2.ExportedTypes, 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 (assembly1.Flags == assembly2.Flags) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;
if (assembly1.Kind == assembly2.Kind) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;
diff = this.VisitAttributeList(assembly1.ModuleAttributes, assembly2.ModuleAttributes, 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;
ModuleReferenceList mrChanges, mrDeletions, mrInsertions;
diff = this.VisitModuleReferenceList(assembly1.ModuleReferences, assembly2.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 (assembly1.Name == assembly2.Name) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;
SecurityAttributeList secChanges, secDeletions, secInsertions;
diff = this.VisitSecurityAttributeList(assembly1.SecurityAttributes, assembly2.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;
diff = this.VisitTypeNodeList(assembly1.Types, assembly2.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 (assembly1.Version == assembly2.Version) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++;
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;
}
示例2: VisitAssembly
public override AssemblyNode VisitAssembly(AssemblyNode assembly)
{
if (assembly == null) return null;
this.FindTypesToBeDuplicated(assembly.Types);
return base.VisitAssembly((AssemblyNode)assembly.Clone());
}