Ejemplo n.º 1
0
        public IEnumerable <Password> GetAll()
        {
            Logger.Instance.FunctionStart();
            Logger.Instance.Debug($"========= Get All start =========");
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            try
            {
                Passwords = decoder.Decode(storage.Read(), PasswordFirst, PasswordSecond).OrderBy(x => x.Title);
                Logger.Instance.Debug("Returning passwords");
                return(Passwords);
            }
            catch (Exception e)
            {
                Logger.Instance.Error(e);
                return(null);
            }
            finally
            {
                stopWatch.Stop();
                Logger.Instance.Debug($"========= Get All finished in {stopWatch.ElapsedMilliseconds} ms =========");
                Logger.Instance.FunctionEnd();
            }
        }
Ejemplo n.º 2
0
        public Password Get(int id)
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();
            try
            {
                return(decoder.Decode(storage.Get(id), PasswordFirst, PasswordSecond));
            }
            catch (Exception e)
            {
                Logger.Instance.Error(e);
                return(null);
            }
            finally
            {
                stopWatch.Stop();
                Logger.Instance.Debug($"########### GET {stopWatch.ElapsedMilliseconds} ms ###########");
            }
        }