Beispiel #1
0
        private void UpdatePassword()
        {
            if (string.IsNullOrEmpty(userTextBox1.ToString()))
            {
                return;
            }

            string pw = userTextBox1.ToString();

            DB db = new DB();

            try
            {
                if (db.ConnectionDataBase())
                {
                    db.UpdatePassWord(pw);
                }
            }
            catch (Exception ex)
            {
                string msg = $"{Properties.Resources.UpdatePassWord}\n{ex.Message}";

                using (FormMessageBox fm = new FormMessageBox(msg))
                {
                    fm.ShowDialog();
                }
            }
            finally
            {
                db.CloseConnection();
                this.Close();
            }
        }
Beispiel #2
0
        static void Main()
        {
            //{25AF45BC-AE51-4F04-985E-ECAF7FF51FC3}
            string mutextName = "25AF45BC-AE51-4F04-985E-ECAF7FF51FC3";
            bool   createdNew;

            Mutex mtx = new Mutex(true, mutextName);

            TimeSpan tsWait = new TimeSpan(0, 0, 1);

            createdNew = mtx.WaitOne(tsWait);

            if (!createdNew)
            {
                using (FormMessageBox fm = new FormMessageBox(Properties.Resources.AlreadyProgram))
                {
                    fm.ShowDialog();
                }

                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Setting.Option.Load();

            if (Setting.Option.isPW)
            {
                using (FormLogin fm = new FormLogin(FormLogin.FormType.Login))
                {
                    DialogResult dialogResult = fm.ShowDialog();

                    if (dialogResult == DialogResult.OK)
                    {
                        Application.Run(new FormCrypto());
                    }
                    else
                    {
                        return;
                    }
                }
            }
            else
            {
                Application.Run(new FormCrypto());
            }
        }
Beispiel #3
0
        private void ShowBallonMsg(string ext, string fileName, string done)
        {
            bool isSuccess = false;

            if (ext.Contains("chan"))
            {
                isSuccess = ShowBallonTip.Invoke("파일 복호화", $"{label_name.Text} 파일 {done}");
            }
            else
            {
                isSuccess = ShowBallonTip.Invoke("파일 암호화", $"{label_name.Text} 파일 {done}");
            }

            if (!isSuccess)
            {
                using (FormMessageBox fm = new FormMessageBox(done))
                {
                    fm.ShowDialog();
                }
            }
        }
Beispiel #4
0
        private void Login()
        {
            DB     db = new DB();
            string pw = "";

            try
            {
                if (db.ConnectionDataBase())
                {
                    pw = Encrypt.Instance.DecryptPass(db.GetPassWord());
                }
            }
            catch (Exception ex)
            {
                string msg = $"{Properties.Resources.GetPassWord}\n{ex.Message}";

                using (FormMessageBox fm = new FormMessageBox(msg))
                {
                    fm.ShowDialog();
                }
            }
            finally
            {
                db.CloseConnection();
            }

            if (string.IsNullOrEmpty(pw))
            {
                using (FormMessageBox fm = new FormMessageBox(Properties.Resources.GetPassWord))
                {
                    fm.ShowDialog();
                }

                this.DialogResult = DialogResult.No;
                this.Close();
            }

            if (pw == userTextBox1.ToString())
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                reTry++;

                if (reTry > 2)
                {
                    using (FormMessageBox fm = new FormMessageBox(Properties.Resources.RetryPassWord))
                    {
                        fm.ShowDialog();
                    }

                    this.DialogResult = DialogResult.No;
                    this.Close();
                }
                else
                {
                    using (FormMessageBox fm = new FormMessageBox(Properties.Resources.IncPassWord))
                    {
                        fm.ShowDialog();
                    }
                }
            }
        }