示例#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);
            }
        }