public bool IsMatch(CodeFileLocation location)
        {
            if (location is WorkspaceCodeFileLocation workspaceCodeFileLocation)
            {
                return(this.documentPaths.Any(m => PathMaskHelper.PathMatchMask(workspaceCodeFileLocation.DocumentPath.ToString(), m)));
            }

            throw new NotSupportedException($"{nameof(WorkspaceCodeFileLocationFilter)} supports only locations of type: {typeof(WorkspaceCodeFileLocation)}");
        }
        public string ResolveCodeFileName(CodeFileLocation location)
        {
            if (this.fileSystem.File.Exists(location.FilePath))
            {
                return(this.fileSystem.Path.GetFileName(location.FilePath));
            }

            return(null);
        }
Esempio n. 3
0
        public string ResolveCodeFileName(CodeFileLocation location)
        {
            var document = this.FindDocument(location);

            if (document != null)
            {
                return(document.Name);
            }

            return(null);
        }
Esempio n. 4
0
        public bool IsMatch(CodeFileLocation location)
        {
            foreach (var mask in this.pathMasks)
            {
                var startDirectoryMask = PathMaskHelper.GetAbsolutePathMask(mask, this.basePath, this.fileSystem);
                if (PathMaskHelper.PathMatchMask(location.FilePath, startDirectoryMask))
                {
                    return(true);
                }
            }

            return(false);
        }
        public virtual CodeFile ResolveExistingCodeFile(CodeFileLocation location)
        {
            if (!this.storageHandler.CanResolveCodeFileName(location))
            {
                throw new InvalidOperationException($"Unable to resolve code file at location ({location})");
            }

            var codeFile = this.CreateCodeFile(this.storageHandler.ResolveCodeFileName(location));

            codeFile.Location = location;
            this.storageHandler.ResolveCodeFile(codeFile);
            this.compilationHandler.Register(codeFile);
            return(codeFile);
        }
Esempio n. 6
0
        public bool IsMatch(CodeFileLocation location)
        {
            var result = false;

            foreach (var filter in this.Filters)
            {
                if (filter.Filter.IsMatch(location))
                {
                    result = filter.Operation == Operation.Shadow;
                }
            }

            return(result);
        }
        protected string GetProjectRelativePath(CodeFileLocation location, MsBuildProject msBuildProject)
        {
            if (location is WorkspaceCodeFileLocation)
            {
                var wLocation = location as WorkspaceCodeFileLocation;

                if (!string.IsNullOrEmpty(wLocation.DocumentPath?.DocumentName))
                {
                    return(this.fileSystem.Path.Combine(string.Join(this.fileSystem.Path.DirectorySeparatorChar.ToString(), wLocation.DocumentPath.ProjectFolders), wLocation.DocumentPath.DocumentName));
                }
            }
            else
            {
                return(PathMaskHelper.GetRelativePath(msBuildProject.FullPath, location.FilePath, this.fileSystem));
            }

            return(null);
        }
Esempio n. 8
0
        private Document FindDocument(CodeFileLocation location)
        {
            Document document = null;

            if (location is WorkspaceCodeFileLocation)
            {
                var workspaceLocation = location as WorkspaceCodeFileLocation;
                if (workspaceLocation.DocumentPath != null)
                {
                    document = this.workspaceManager.FindDocument(workspaceLocation.DocumentPath);
                }
            }
            else
            {
                document = this.workspaceManager.FindDocumentByFilePath(location.FilePath);
            }

            return(document);
        }
        private MsBuildProject GetContainingProject(CodeFileLocation location)
        {
            if (location is WorkspaceCodeFileLocation)
            {
                var workspaceLocation = location as WorkspaceCodeFileLocation;
                return(this.Solution.GetProject(workspaceLocation.DocumentPath.ProjectName));
            }
            else
            {
                if (!string.IsNullOrEmpty(location.FilePath))
                {
                    foreach (var project in this.Solution.Projects)
                    {
                        if (PathMaskHelper.DirectoryIsBaseOf(this.fileSystem.Path.GetDirectoryName(project.Value.FullPath), location.FilePath))
                        {
                            return(project.Value);
                        }
                    }
                }
            }

            return(null);
        }
Esempio n. 10
0
 public bool CanResolveCodeFileName(CodeFileLocation location)
 {
     return(this.FindDocument(location) != null);
 }
 public string ResolveCodeFileName(CodeFileLocation location)
 {
     throw new NotImplementedException();
 }
Esempio n. 12
0
 public string ResolveCodeFileName(CodeFileLocation location)
 {
     return(this.workspaceFileStorageHandler.ResolveCodeFileName(location));
 }
 public bool CanResolveCodeFileName(CodeFileLocation location)
 {
     return(this.fileSystem.File.Exists(location.FilePath));
 }
 public bool CanResolveCodeFile(string language, CodeFileLocation location)
 {
     return(this.HandlerFor(language).CanResolveExistingCodeFile(location));
 }
Esempio n. 15
0
 public bool CanResolveCodeFileName(CodeFileLocation location)
 {
     return(this.workspaceFileStorageHandler.CanResolveCodeFileName(location));
 }
 public virtual bool CanResolveExistingCodeFile(CodeFileLocation location)
 {
     return(this.storageHandler.CanResolveCodeFileName(location));
 }
Esempio n. 17
0
 public WorkspaceCodeFileLocation(CodeFileLocation location)
 {
     this.FilePath = location.FilePath;
 }