I'm literally on fire rn

This commit is contained in:
Miskolczi Richárd
2023-03-24 14:03:09 +01:00
parent b06568fb27
commit 99498ed660
10 changed files with 85 additions and 51 deletions

View File

@@ -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();
}
}
}