예제 #1
0
        private void LoadQuestions()
        {
            LoginQuestions loginQuestions = LoginHelper.FetchQuesAns();

            lblQ1.Text = MySecurity.DecryptWithOffset(loginQuestions.Ques1);
            lblQ2.Text = MySecurity.DecryptWithOffset(loginQuestions.Ques2);
            lblQ3.Text = MySecurity.DecryptWithOffset(loginQuestions.Ques3);
            strAns1    = MySecurity.DecryptWithOffset(loginQuestions.Ans1);
            strAns2    = MySecurity.DecryptWithOffset(loginQuestions.Ans2);
            strAns3    = MySecurity.DecryptWithOffset(loginQuestions.Ans3);
        }
예제 #2
0
        public static LoginQuestions FetchQuesAns()
        {
            LoginQuestions _loginQuestions = new LoginQuestions();

            try
            {
                var text    = System.IO.File.ReadAllText(AppGlobalDatas.LoginFileName);
                var xmlText = XElement.Parse(text);
                var res     = from recoveryInformation in xmlText.Elements("recovery_information")
                              select new
                {
                    q1 = recoveryInformation.Element("q1")?.Value,
                    a1 = recoveryInformation.Element("a1")?.Value,
                    q2 = recoveryInformation.Element("q2")?.Value,
                    a2 = recoveryInformation.Element("a2")?.Value,
                    q3 = recoveryInformation.Element("q3")?.Value,
                    a3 = recoveryInformation.Element("a3")?.Value
                };
                foreach (var r in res)
                {
                    _loginQuestions.Ques1 = r.q1;
                    _loginQuestions.Ques2 = r.q2;
                    _loginQuestions.Ques3 = r.q3;
                    _loginQuestions.Ans1  = r.a1;
                    _loginQuestions.Ans2  = r.a2;
                    _loginQuestions.Ans3  = r.a3;

                    break;
                }
            }
            catch (Exception ex)
            {
                AppGlobalDatas.CurrentError           = ex.Message;
                AppGlobalDatas.CurrentErrorStackTrace = ex;
            }
            return(_loginQuestions);
        }