コード例 #1
0
 public ModuleNode(AssemblyNode parent, IOldToNewTupleMap <ModuleMetadata> map, IReadOnlyList <NamespaceNode> namespaces)
     : base(parent, "", map.GetFirstNotNullItem().GetName())
 {
     Parent     = parent;
     Map        = map;
     Namespaces = namespaces;
 }
コード例 #2
0
        public static ModuleNode CreateFromModuleMap(AssemblyNode parent, IOldToNewTupleMap <ModuleMetadata> moduleMap)
        {
            var module = new ModuleNode(parent, moduleMap, new NamespaceNode[0]);

            var types = new TypesMergeManager(moduleMap)
                        .GetMergedCollection()
                        .ToList();

            var namespaces = types.GroupBy(e => e.GetFirstNotNullItem().GetNamespace())
                             .OrderBy(e => e.Key)
                             .Select(e => NamespaceNode.Create(module, e.Key, e.ToArray()))
                             .ToArray();

            module.Namespaces = namespaces;

            return(module);
        }
コード例 #3
0
        public static AssemblyNode Create(IOldToNewTupleMap <string> assemblyMap, IOldToNewTupleMap <GeneratedProjectOutputInfo> generationProjectInfoMap)
        {
            var assemblyNode = new AssemblyNode(assemblyMap, new ModuleNode[0], new ResourceNode[0]);

            var moduleMergeManager = new ModuleManager(assemblyMap);
            var modulesNodes       = moduleMergeManager.GetMergedCollection()
                                     .Select(tuple => ModuleNode.CreateFromModuleMap(assemblyNode, tuple))
                                     .ToArray();

            assemblyNode.Modules = modulesNodes;

            ICollection <string> oldResources = new Collection <string>();
            ICollection <string> newResources = new Collection <string>();

            IAssemblyDecompilationResults oldAssemblyResult;
            IAssemblyDecompilationResults newAssemblyResult;

            if (GlobalDecompilationResultsRepository.Instance.TryGetAssemblyDecompilationResult(assemblyMap.OldType, out oldAssemblyResult))
            {
                oldResources = oldAssemblyResult.ResourcesFilePaths;
            }

            if (GlobalDecompilationResultsRepository.Instance.TryGetAssemblyDecompilationResult(assemblyMap.NewType, out newAssemblyResult))
            {
                newResources = newAssemblyResult.ResourcesFilePaths;
            }

            var resourceMergeManager = new ResourceMergeManager(
                new OldToNewTupleMap <ICollection <string> > (oldResources, newResources),
                (a, b) => string.Compare(generationProjectInfoMap.OldType.GetRelativePath(a), generationProjectInfoMap.OldType.GetRelativePath(b), true),
                (a, b) => string.Compare(generationProjectInfoMap.NewType.GetRelativePath(a), generationProjectInfoMap.NewType.GetRelativePath(b), true),
                (a, b) => ResourceNameComparer(generationProjectInfoMap, a, b));

            var resourceNodes = resourceMergeManager.GetMergedCollection()
                                .Select(e => new ResourceNode(assemblyNode, e))
                                .ToArray();

            assemblyNode.Resources = resourceNodes;

            return(assemblyNode);
        }
コード例 #4
0
 public ResourceNode(AssemblyNode parent, IOldToNewTupleMap <string> map)
     : base(parent, "", Path.GetFileName(map.GetFirstNotNullItem()))
 {
     Map = map;
 }