From 4a43cfd8ed1bcce1dc73837ee0bdb7f89403486a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miskolczi=20Rich=C3=A1rd?= Date: Sun, 16 Apr 2023 21:03:44 +0200 Subject: [PATCH] Finished ListPasswords method --- CLI/Program.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CLI/Program.cs b/CLI/Program.cs index e697404..8e0a815 100644 --- a/CLI/Program.cs +++ b/CLI/Program.cs @@ -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)