Пример #1
0
        /// <summary>
        /// Returns a properly formatted/sorted list of directory dependencies.
        /// </summary>
        private List <string> GetDirectoryDependencies(ReadOnlyArray <DirectoryArtifact> dependencies)
        {
            var result      = new List <string>();
            var directories = new Stack <(DirectoryArtifact artifact, string path, int tabCount)>(
                dependencies
                .Select(d => (artifact: d, path: d.Path.ToString(PathTable), 0))
                .OrderByDescending(tupple => tupple.path));

            while (directories.Count > 0)
            {
                var directory = directories.Pop();
                result.Add(directory.tabCount == 0
                    ? FormattableStringEx.I($"{directory.path} (PartialSealId: {directory.artifact.PartialSealId}, IsSharedOpaque: {directory.artifact.IsSharedOpaque})")
                    : FormattableStringEx.I($"|{string.Concat(Enumerable.Repeat("---", directory.tabCount))}{directory.path} (PartialSealId: {directory.artifact.PartialSealId}, IsSharedOpaque: {directory.artifact.IsSharedOpaque})"));

                var sealPipId = CachedGraph.PipGraph.GetSealedDirectoryNode(directory.artifact).ToPipId();

                if (PipTable.IsSealDirectoryComposite(sealPipId))
                {
                    var sealPip = (SealDirectory)CachedGraph.PipGraph.GetSealedDirectoryPip(directory.artifact, PipQueryContext.SchedulerExecuteSealDirectoryPip);
                    foreach (var nestedDirectory in sealPip.ComposedDirectories.Select(d => (artifact: d, path: d.Path.ToString(PathTable))).OrderByDescending(tupple => tupple.path))
                    {
                        directories.Push((nestedDirectory.artifact, nestedDirectory.path, directory.tabCount + 1));
                    }
                }
            }

            return(result);
        }