IEnumerable <string> GetFileNames(IProgressMonitor monitor, FilterOptions filterOptions) { if (monitor != null) { monitor.Log.WriteLine(GettextCatalog.GetString("Looking in '{0}'", path)); } foreach (string fileMask in filterOptions.FileMask.Split(',', ';')) { string[] files; try { files = Directory.GetFiles(path, fileMask, recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); } catch (Exception e) { LoggingService.LogError("Can't access path " + path, e); yield break; } foreach (string fileName in files) { if (fileName.StartsWith(".") && !IncludeHiddenFiles) { continue; } if (!IncludeBinaryFiles && !DesktopService.GetMimeTypeIsText(DesktopService.GetMimeTypeForUri(fileName))) { continue; } yield return(fileName); } } }
public bool CanHandle(FilePath fileName, string mimeType, Project ownerProject) { if (string.IsNullOrEmpty(mimeType)) { return(false); } return(DesktopService.GetMimeTypeIsText(mimeType)); }
public override bool CanCreateContentForMimeType(string mimetype) { if (String.IsNullOrEmpty(mimetype)) { return(false); } return(DesktopService.GetMimeTypeIsText(mimetype)); }
public override IEnumerable <FileProvider> GetFiles(IProgressMonitor monitor, FilterOptions filterOptions) { if (IdeApp.Workspace.IsOpen) { monitor.Log.WriteLine(GettextCatalog.GetString("Looking in project '{0}'", project.Name)); foreach (ProjectFile file in project.Files.Where(f => filterOptions.NameMatches(f.Name) && File.Exists(f.Name))) { if (!IncludeBinaryFiles && !DesktopService.GetMimeTypeIsText(DesktopService.GetMimeTypeForUri(file.Name))) { continue; } yield return(new FileProvider(file.Name, project)); } } }
public static CodeFormatter GetFormatter(string mimeType) { //find the most specific formatter that can handle the document var chain = DesktopService.GetMimeTypeInheritanceChain(mimeType); foreach (var mt in chain) { var node = nodes.FirstOrDefault(f => f.MimeType == mt); if (node != null) { return(new CodeFormatter(mimeType, node.GetFormatter())); } } if (DesktopService.GetMimeTypeIsText(mimeType)) { return(new CodeFormatter(mimeType, new DefaultCodeFormatter())); } return(null); }
/// <summary> /// Determines whether the task's file should be opened automatically when jumping to the next error. /// </summary> public static bool IsProjectTaskFile(TaskListEntry t) { if (t.FileName.IsNullOrEmpty) { return(false); } //only files that are part of project Project p = t.WorkspaceObject as Project; if (p == null) { return(false); } if (p.GetProjectFile(t.FileName) == null) { return(false); } //only text files var mimeType = DesktopService.GetMimeTypeForUri(t.FileName); if (!DesktopService.GetMimeTypeIsText(mimeType)) { return(false); } //only files for which we have a default internal display binding var binding = DisplayBindingService.GetDefaultBinding(t.FileName, mimeType, p); if (binding == null || !binding.CanUseAsDefault || binding is IExternalDisplayBinding) { return(false); } return(true); }
public bool CanHandleFile(string fileName) { string mt = DesktopService.GetMimeTypeForUri(fileName); return(DesktopService.GetMimeTypeIsText(mt)); }
public bool CanHandle(VersionControlItem item, DocumentView primaryView) { return((primaryView == null || primaryView.GetContent <ITextFile> () != null) && DesktopService.GetMimeTypeIsText(DesktopService.GetMimeTypeForUri(item.Path))); }
public override bool CanCreateContentForUri(string fileName) { string mt = DesktopService.GetMimeTypeForUri(fileName); return(DesktopService.GetMimeTypeIsText(mt)); }
public bool CanHandle(VersionControlItem item) { return(DesktopService.GetMimeTypeIsText(DesktopService.GetMimeTypeForUri(item.Path))); }