当前位置: 首页>>代码示例>>C#>>正文


C# FilterOptions.NameMatches方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:brantwedel,项目名称:monodevelop,代码行数:8,代码来源:Scope.cs

示例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);
				}
			}
		}
开发者ID:acken,项目名称:monodevelop,代码行数:10,代码来源:Scope.cs

示例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);
				}
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:11,代码来源:Scope.cs

示例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);
                    }
                }

            }
        }
开发者ID:brantwedel,项目名称:monodevelop,代码行数:52,代码来源:Scope.cs

示例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> ();
		}
开发者ID:kirill85,项目名称:monodevelop,代码行数:8,代码来源:Scope.cs

示例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);
				}
			}
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:18,代码来源:Scope.cs


注:本文中的MonoDevelop.Ide.FindInFiles.FilterOptions.NameMatches方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。