Beispiel #1
0
        public PasswordFileAuthenticator(string[] args)
        {
            if (args == null || args.Length != 1)
            {
                throw new ArgumentException("Expected 1 argument");
            }

            FileName = Environment.ExpandEnvironmentVariables(args[0]);

            var directory = Path.GetDirectoryName(FileName);

            if (directory == string.Empty)
            {
                directory = ".";
            }
            var fileName = Path.GetFileName(FileName);

            _watcher          = new FileSystemWatcher(directory, fileName);
            _watcher.Changed += OnChanged;

            _manager = PasswordManager.Load(FileName);

            _watcher.EnableRaisingEvents = true;
        }
Beispiel #2
0
 private void OnChanged(object?sender, FileSystemEventArgs e)
 {
     Manager = PasswordManager.Load(FileName);
 }