Exemple #1
0
        protected override void LoadChildren()
        {
            ICollection <string> oldResources = new Collection <string>();
            ICollection <string> newResources = new Collection <string>();

            IAssemblyDecompilationResults oldAssemblyResult;
            IAssemblyDecompilationResults newAssemblyResult;

            if (GlobalDecompilationResultsRepository.Instance.TryGetAssemblyDecompilationResult(typesMap.OldType, out oldAssemblyResult))
            {
                oldResources = oldAssemblyResult.ResourcesFilePaths;
            }
            if (GlobalDecompilationResultsRepository.Instance.TryGetAssemblyDecompilationResult(typesMap.NewType, out newAssemblyResult))
            {
                newResources = newAssemblyResult.ResourcesFilePaths;
            }
            var resourceMergeManager = new ResourceMergeManager(new OldToNewTupleMap <ICollection <string> >(oldResources, newResources),
                                                                OldResourceNameComparer, NewResourceNameComparer, ResourceNameComparer);

            List <ItemNodeBase> resourceNodes = resourceMergeManager.GetMergedCollection()
                                                .Select(GetResourceNode)
                                                .ToList();

            DispatcherObjectExt.Invoke(() =>
            {
                foreach (var item in resourceNodes)
                {
                    this.Children.Add(item);
                }

                this.OnChildrenLoaded();

                this.differenceDecoration = GetDifferenceDecoration();
            });
        }
        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);
        }