Esempio n. 1
0
        private async Task CollectSolutionInformationAsync()
        {
            var solutionReader     = new SolutionReferenceParser();
            var solutionReferences = solutionReader.Process(await Context.Options.FileSystem.ReadAsync(Context.SolutionPath));

            foreach (var solutionReference in solutionReferences)
            {
                var solutionHistory    = new HistoryInformation();
                var solutionPathMapper = new PathMapper(Context.SolutionPath);
                solutionHistory.Before.AbsolutePath = solutionPathMapper.GetAbsolutePath(solutionReference.RelativePath);
                solutionHistory.Before.RelativePath = solutionReference.RelativePath;

                if (Context.Projects.Contains(solutionHistory.Before.AbsolutePath))
                {
                    // reference will be moved
                    solutionHistory.After.AbsolutePath = Context.Options.ProjectPathTransformer.AbsolutePath(solutionPathMapper.GetSuggestedPath(solutionHistory.Before.AbsolutePath, Context.DestinationPath));
                    solutionHistory.After.RelativePath = Context.Options.ProjectPathTransformer.RelativePath(solutionPathMapper.GetRelativePath(solutionHistory.After.AbsolutePath));
                }
                else
                {
                    solutionHistory.After.AbsolutePath = Context.Options.ProjectPathTransformer.AbsolutePath(solutionPathMapper.GetAbsolutePath(solutionReference.RelativePath));
                    solutionHistory.After.RelativePath = Context.Options.ProjectPathTransformer.RelativePath(solutionReference.RelativePath);
                }

                SolutionReferences.Add(solutionHistory);
            }
        }
Esempio n. 2
0
        private async Task CollectProjectsInformationAsync()
        {
            foreach (var currentProject in SolutionReferences)
            {
                var projectProcessor    = new ProjectReferenceParser();
                var projectReferences   = projectProcessor.Process(await Context.Options.FileSystem.ReadAsync(currentProject.Before.AbsolutePath));
                var historyInformations = new List <HistoryInformation>();

                foreach (var projectReference in projectReferences)
                {
                    var referenceHistory = new HistoryInformation();
                    referenceHistory.Before.RelativePath = projectReference.RelativePath;
                    referenceHistory.Before.AbsolutePath = new PathMapper(currentProject.Before.AbsolutePath).GetAbsolutePath(projectReference.RelativePath);

                    var futureReference = SolutionReferences.FirstOrDefault(d => string.Equals(d.Before.AbsolutePath, referenceHistory.Before.AbsolutePath, StringComparison.OrdinalIgnoreCase));
                    if (futureReference == null)
                    {
                        referenceHistory.After.AbsolutePath = referenceHistory.Before.AbsolutePath;
                        referenceHistory.After.RelativePath = referenceHistory.Before.RelativePath;
                    }
                    else
                    {
                        referenceHistory.After.AbsolutePath = futureReference.After.AbsolutePath;
                        referenceHistory.After.RelativePath = new PathMapper(currentProject.After.AbsolutePath).GetRelativePath(futureReference.After.AbsolutePath);
                    }

                    historyInformations.Add(referenceHistory);
                }

                ProjectReferences.Add(currentProject.Before.AbsolutePath, historyInformations);
            }
        }