當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。