Esempio n. 1
0
        protected override void AddToContext(string fullPath, IImmutableDictionary <string, string> metadata, bool isActiveContext, IProjectLogger logger)
        {
            string[] folderNames = GetFolderNames(fullPath, metadata);

            logger.WriteLine("Adding source file '{0}'", fullPath);
            _context.AddSourceFile(fullPath, isInCurrentContext: isActiveContext, folderNames: folderNames);
        }
        private void AddSourceFile(string fullPath, IProjectTreeServiceState state = null)
        {
            if (!_sourceFiles.Contains(fullPath))
            {
                string[] folderNames = Array.Empty <string>();
                if (state != null)  // We're looking at a generated file, which doesn't appear in a tree.
                {
                    folderNames = GetFolders(fullPath, state).ToArray();
                }

                _sourceFiles.Add(fullPath);
                _context.AddSourceFile(fullPath, folderNames: folderNames); // TODO: IsInCurrentContext
            }
        }
Esempio n. 3
0
        private void AddSourceFile(string filePath, string[] folderNames, IWorkspaceProjectContext context, bool isActiveContext)
        {
            string fullPath = _project.MakeRooted(filePath);

            if (!_sourceFilesByContext.TryGetValue(context, out HashSet <string> sourceFiles))
            {
                sourceFiles = new HashSet <string>(StringComparers.Paths);
                _sourceFilesByContext.Add(context, sourceFiles);
            }
            else if (sourceFiles.Contains(fullPath))
            {
                return;
            }

            sourceFiles.Add(fullPath);
            context.AddSourceFile(fullPath, folderNames: folderNames, isInCurrentContext: isActiveContext);
        }
Esempio n. 4
0
        private void AddSourceFile(string fullPath, IWorkspaceProjectContext context, bool isActiveContext, IProjectTreeServiceState state = null)
        {
            fullPath = _project.MakeRooted(fullPath);

            if (!_sourceFilesByContext.TryGetValue(context, out HashSet <string> sourceFiles))
            {
                sourceFiles = new HashSet <string>(StringComparers.Paths);
                _sourceFilesByContext.Add(context, sourceFiles);
            }
            else if (sourceFiles.Contains(fullPath))
            {
                return;
            }

            string[] folderNames = Array.Empty <string>();
            if (state != null)  // We're looking at a generated file, which doesn't appear in a tree.
            {
                folderNames = GetFolders(fullPath, state).ToArray();
            }

            sourceFiles.Add(fullPath);
            context.AddSourceFile(fullPath, folderNames: folderNames, isInCurrentContext: isActiveContext);
        }
        protected override void AddToContext(string fullPath, IImmutableDictionary <string, string> metadata, bool isActiveContext)
        {
            string[] folderNames = GetFolderNames(fullPath, metadata);

            _context.AddSourceFile(fullPath, isInCurrentContext: isActiveContext, folderNames: folderNames);
        }