private IEnumerable<string> ExpandFileSystem(Control control, string text) { int num = text.LastIndexOfAny(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }); string b = (num >= 0) ? text.Substring(0, num + 1) : string.Empty; if (!string.Equals(this.LastFileSystemSource, b, StringComparison.OrdinalIgnoreCase)) { this.LastFileSystemSource = b; try { this.LastFileSystemCollection = null; string str2 = this.UseEnvironmentVariablesSource ? Environment.ExpandEnvironmentVariables(b) : b; if (!string.IsNullOrEmpty(str2)) { GetCurrentDirectoryEventArgs e = new GetCurrentDirectoryEventArgs(control, this.CurrentDir); this.OnGetCurrentDirectory(e); if (!string.IsNullOrEmpty(e.CurrentDirectory)) { System.IO.Directory.SetCurrentDirectory(e.CurrentDirectory); this.LastFileSystemCollection = new List<string>(); } else if (Path.IsPathRooted(str2)) { this.LastFileSystemCollection = new List<string>(); } } if (this.LastFileSystemCollection != null) { PreviewFileSystemInfoEventArgs args2 = null; foreach (FileSystemInfo info in Microsoft.IO.Directory.GetFileSystemInfos(str2)) { PreviewFileSystemInfoEventArgs args3 = args2 ?? (args2 = new PreviewFileSystemInfoEventArgs(control)); args3._Value = info; args3.Cancel = false; this.OnPreviewFileSystemInfo(args3); if (!args3.Cancel) { this.LastFileSystemCollection.Add(b + info.Name); } } this.LastFileSystemCollection.TrimExcess(); } } catch { this.LastFileSystemCollection = null; } } if (((text.Length > 0) && (this.LastFileSystemCollection != null)) && (this.LastFileSystemCollection.Count > 0)) { return this.LastFileSystemCollection.Where<string>(delegate (string x) { return x.StartsWith(text, StringComparison.OrdinalIgnoreCase); }); } return new string[0]; }
protected virtual void OnPreviewFileSystemInfo(PreviewFileSystemInfoEventArgs e) { EventHandler<PreviewFileSystemInfoEventArgs> handler = base.Events[EventPreviewFileSystemInfo] as EventHandler<PreviewFileSystemInfoEventArgs>; if (handler != null) { handler(this, e); } }
public static void PreviewFileSystemInfo(object sender, PreviewFileSystemInfoEventArgs e) { IFileSystemInfoFilter hiddenItemsFilter = VirtualFilePanelSettings.Default.HiddenItemsFilter as IFileSystemInfoFilter; e.Cancel = !(e.Value is DirectoryInfo) || ((hiddenItemsFilter != null) && hiddenItemsFilter.IsMatch(e.Value)); }