Finished ListPasswords method

This commit is contained in:
2023-04-16 21:03:44 +02:00
parent b74bb2fcdd
commit 4a43cfd8ed

View File

@@ -39,7 +39,26 @@ class Program
static int ListPasswords()
{
DirectoryInfo d;
FileInfo[] files = new FileInfo[0];
try
{
//since this file is already dependent on the Common namespace, we don't need events to mitigate this; better off asking ConfigFileManager for the path directly
d = new DirectoryInfo(ConfigFileManager.GetPath());
files = d.GetFiles("*.gpg");
}
catch (ArgumentNullException e)
{
ErrorOccured(e, "Error while getting password files");
return 1;
}
foreach (FileInfo f in files)
{
Console.WriteLine($"\t{f.Name}");
}
return 0;
}
static void ErrorOccured(Exception e)