Exemplo n.º 1
0
        public bool LogIn()
        {
            try
            {
                _encryptController.SecureString = GetPassword();

                var xDoc           = _xDocument.Get();
                var postActionRepo = _actionBase.Exec(xDoc);

                _encryptController.DecryptXDoc(postActionRepo.TaskRepos);

                ViewBase.LogInSuccess();
                return(true);
            }
            catch (CryptographicException)
            {
                ViewBase.LogInFailed();
                return(false);
            }
            catch (Exception ex)
            {
                ViewBase.SomethingWentWrong();
                Console.WriteLine(ex);
                return(false);
            }
        }
Exemplo n.º 2
0
        public static void Exec()
        {
            var xDocToEncrypt  = _xDocument.Get();
            var postActionRepo = _actionBase.Exec(xDocToEncrypt, "/");

            postActionRepo.XDoc = xDocToEncrypt;
            postActionRepo.XDoc.Descendants(TASK).Remove();

            _encryptController.SecureString = Account.GetInstance(_consoleKey, _consoleLine, _encryptController, _xDocument, _actionBase).GetPassword();

            for (int i = 0; i < postActionRepo.TaskRepos.Count; i++)
            {
                var task = postActionRepo.TaskRepos[i];
                task.Content = _encryptController.EncryptXDoc(task.Content);

                postActionRepo.XDoc.Element(TASKS).Add(new XElement(TASK, new XAttribute(TIME, task.DataTime), task.Content));

                ShowProgress(i, postActionRepo.TaskRepos.Count);
            }
            postActionRepo.XDoc.Save(FilePath);
        }