public static void GetKnownFoldersSource(object sender, GetCustomSourceEventArgs e)
 {
     Func<string, bool> predicate = null;
     if (e.Text.StartsWith("shell:", StringComparison.OrdinalIgnoreCase))
     {
         List<string> tag = e.Target.Tag as List<string>;
         if (tag == null)
         {
             tag = new List<string>();
             foreach (string str in KnownFolder.GetNames())
             {
                 tag.Add("shell:" + str);
             }
             tag.TrimExcess();
             e.Target.Tag = tag;
         }
         if (predicate == null)
         {
             predicate = delegate (string x) {
                 return x.StartsWith(e.Text, StringComparison.OrdinalIgnoreCase);
             };
         }
         IEnumerable<string> collection = tag.Where<string>(predicate);
         e.CustomSource = ConcatSources(e.CustomSource, collection);
         e.Handled = true;
     }
 }
 public static void GetComboBoxSource(object sender, GetCustomSourceEventArgs e)
 {
     Func<object, bool> predicate = null;
     Func<object, bool> func2 = null;
     ComboBox target = e.Target as ComboBox;
     if (((target != null) && (target.Items.Count > 0)) && (e.Text.Length > 0))
     {
         IEnumerable<object> source = target.Items.Cast<object>();
         if (target.AutoCompleteMode == AutoCompleteMode.Suggest)
         {
             if (predicate == null)
             {
                 predicate = delegate (object x) {
                     return x.ToString().IndexOf(e.Text, StringComparison.OrdinalIgnoreCase) >= 0;
                 };
             }
             source = source.Where<object>(predicate);
         }
         else
         {
             if (func2 == null)
             {
                 func2 = delegate (object x) {
                     return x.ToString().StartsWith(e.Text, StringComparison.OrdinalIgnoreCase);
                 };
             }
             source = source.Where<object>(func2);
         }
         e.CustomSource = ConcatSources(e.CustomSource, source);
         e.Handled = true;
     }
 }
 public static void GetRecentFoldersSource(object sender, GetCustomSourceEventArgs e)
 {
     AutoCompleteMode autoCompleteMode;
     Func<string, bool> predicate = null;
     Func<string, bool> func2 = null;
     TextBox target = e.Target as TextBox;
     if (target != null)
     {
         autoCompleteMode = target.AutoCompleteMode;
     }
     else
     {
         ComboBox box2 = e.Target as ComboBox;
         if (box2 == null)
         {
             return;
         }
         autoCompleteMode = box2.AutoCompleteMode;
     }
     if (e.Text.Length > 0)
     {
         IEnumerable<string> changeFolder = HistorySettings.Default.ChangeFolder;
         if (changeFolder != null)
         {
             if (autoCompleteMode == AutoCompleteMode.Suggest)
             {
                 if (predicate == null)
                 {
                     predicate = delegate (string x) {
                         return x.IndexOf(e.Text, StringComparison.OrdinalIgnoreCase) >= 0;
                     };
                 }
                 changeFolder = changeFolder.Where<string>(predicate);
             }
             else
             {
                 if (func2 == null)
                 {
                     func2 = delegate (string x) {
                         return x.StartsWith(e.Text, StringComparison.OrdinalIgnoreCase);
                     };
                 }
                 changeFolder = changeFolder.Where<string>(func2);
             }
             e.CustomSource = ConcatSources(e.CustomSource, changeFolder);
             e.Handled = true;
         }
     }
 }
 protected virtual void OnGetCustomSource(GetCustomSourceEventArgs e)
 {
     EventHandler<GetCustomSourceEventArgs> handler = base.Events[EventGetCustomSource] as EventHandler<GetCustomSourceEventArgs>;
     if (handler != null)
     {
         handler(this, e);
     }
 }
 protected virtual IEnumerable<object> ExpandSource(Control control)
 {
     IEnumerable<object> first = new object[0];
     CancelEventArgs e = new CancelEventArgs();
     this.OnBeforeSourcesLookup(e);
     if (!e.Cancel)
     {
         if (this.UseFileSystemSource)
         {
             first = first.Concat<object>(this.ExpandFileSystem(control, control.Text).Cast<object>());
         }
         if (this.UseEnvironmentVariablesSource)
         {
             first = first.Concat<object>(this.ExpandEnvironmentVariables(control, control.Text).Cast<object>());
         }
         if (!this.UseCustomSource)
         {
             return first;
         }
         GetCustomSourceEventArgs args2 = new GetCustomSourceEventArgs(control, control.Text);
         this.OnGetCustomSource(args2);
         if (args2.Handled && (args2.CustomSource != null))
         {
             first = first.Concat<object>(args2.CustomSource.Cast<object>());
         }
     }
     return first;
 }