本文整理匯總了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);
}
}
}