I'm literally on fire rn
This commit is contained in:
@@ -6,18 +6,35 @@ namespace Password_Manager
|
||||
{
|
||||
public ResultListBox() : base() { }
|
||||
|
||||
public void Refresh()
|
||||
public void ReloadResults()
|
||||
{
|
||||
DirectoryInfo d = new DirectoryInfo(Fields.CurrentProfile.Path); //Assuming Test is your Folder
|
||||
DirectoryInfo d = new DirectoryInfo(ProfileHandler.CurrentProfile.Path);
|
||||
FileInfo[] files = d.GetFiles("*.gpg");
|
||||
string[] elements = new string[files.Length];
|
||||
|
||||
for (int i = 0; i < elements.Length; i++)
|
||||
string[] arrayTmp = new string[files.Length];
|
||||
for (int i = 0; i < arrayTmp.Length; i++)
|
||||
{
|
||||
elements[i] = files[i].Name;
|
||||
arrayTmp[i] = files[i].Name;
|
||||
}
|
||||
List<string> elements = new List<string>(arrayTmp);
|
||||
|
||||
string[] copy = elements.ToArray();
|
||||
if (Program.mainForm.searchBox.Text != "") //we have a search query
|
||||
{
|
||||
foreach (string s in copy)
|
||||
{
|
||||
if (!s.Contains(Program.mainForm.searchBox.Text))
|
||||
{
|
||||
elements.Remove(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.DataSource = elements;
|
||||
}
|
||||
|
||||
public void ReloadResults(object o, EventArgs e) //needed so that I can subscribe this method to a delegate in MainForm
|
||||
{
|
||||
ReloadResults();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user