本文整理汇总了C#中MonoDevelop.Ide.FindInFiles.FilterOptions.NameMatches方法的典型用法代码示例。如果您正苦于以下问题:C# FilterOptions.NameMatches方法的具体用法?C# FilterOptions.NameMatches怎么用?C# FilterOptions.NameMatches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop.Ide.FindInFiles.FilterOptions
的用法示例。
在下文中一共展示了FilterOptions.NameMatches方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFiles
public override IEnumerable<FileProvider> GetFiles(IProgressMonitor monitor, FilterOptions filterOptions)
{
foreach (Document document in IdeApp.Workbench.Documents) {
monitor.Log.WriteLine (GettextCatalog.GetString ("Looking in '{0}'", document.FileName));
if (!string.IsNullOrEmpty (document.FileName) && filterOptions.NameMatches (document.FileName))
yield return new FileProvider (document.FileName);
}
}
示例2: GetFiles
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) {
if (filterOptions.NameMatches (file.Name))
yield return new FileProvider (file.Name, project);
}
}
}
示例3: GetFiles
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);
}
}
}
示例4: GetFileNames
IEnumerable<string> GetFileNames(IProgressMonitor monitor, FilterOptions filterOptions)
{
if (monitor != null)
monitor.Log.WriteLine (GettextCatalog.GetString ("Looking in '{0}'", path));
var directoryStack = new Stack<string> ();
directoryStack.Push (path);
while (directoryStack.Count > 0) {
var curPath = directoryStack.Pop ();
try {
var readPermission = new FileIOPermission(FileIOPermissionAccess.Read, curPath);
readPermission.Demand ();
} catch (Exception e) {
LoggingService.LogError ("Can't access path " + curPath, e);
yield break;
}
foreach (string fileName in Directory.EnumerateFiles (curPath, "*")) {
if (!IncludeHiddenFiles) {
if (Platform.IsWindows) {
var attr = File.GetAttributes (fileName);
if (attr.HasFlag (FileAttributes.Hidden))
continue;
}
if (Path.GetFileName (fileName).StartsWith (".", StringComparison.Ordinal))
continue;
}
if (!filterOptions.NameMatches (fileName))
continue;
if (!IncludeBinaryFiles && !DesktopService.GetFileIsText (fileName))
continue;
yield return fileName;
}
if (recurse) {
foreach (string directoryName in Directory.EnumerateDirectories (curPath)) {
if (!IncludeHiddenFiles) {
if (Platform.IsWindows) {
var attr = File.GetAttributes (directoryName);
if (attr.HasFlag (FileAttributes.Hidden))
continue;
}
if (Path.GetFileName (directoryName).StartsWith (".", StringComparison.Ordinal))
continue;
}
directoryStack.Push (directoryName);
}
}
}
}
示例5: GetFiles
public override IEnumerable<FileProvider> GetFiles (IProgressMonitor monitor, FilterOptions filterOptions)
{
if (IdeApp.Workspace.IsOpen) {
monitor.Log.WriteLine (GettextCatalog.GetString ("Looking in project '{0}'", project.Name));
return project.Files.Where (f => filterOptions.NameMatches (f.Name) && File.Exists (f.Name)).Select (f => new FileProvider (f.Name, project));
}
return Enumerable.Empty<FileProvider> ();
}
示例6: GetFiles
public override IEnumerable<FileProvider> GetFiles (ProgressMonitor monitor, FilterOptions filterOptions)
{
if (IdeApp.Workspace.IsOpen) {
monitor.Log.WriteLine (GettextCatalog.GetString ("Looking in project '{0}'", project.Name));
var alreadyVisited = new HashSet<string> ();
var conf = project.DefaultConfiguration?.Selector;
foreach (ProjectFile file in project.GetSourceFilesAsync (conf).Result.Where (f => filterOptions.NameMatches (f.Name) && File.Exists (f.Name))) {
if ((file.Flags & ProjectItemFlags.Hidden) == ProjectItemFlags.Hidden)
continue;
if (!IncludeBinaryFiles && !DesktopService.GetFileIsText (file.Name))
continue;
if (alreadyVisited.Contains (file.FilePath.FullPath))
continue;
alreadyVisited.Add (file.FilePath.FullPath);
yield return new FileProvider (file.Name, project);
}
}
}