Exemplo n.º 1
0
        /// <summary>
        /// Write login information to file
        /// </summary>
        private void Ghi_DuLieu()
        {
            string data_de = string.Concat(tbx_UserName.Text, " ", tbx_Password.Text);

            File.WriteAllText("temp.txt", data_de, Encoding.UTF8);
            CryptoStuff.EncryptFile(pass, "temp.txt", "data.dat");
            File.Delete("temp.txt");
        }
Exemplo n.º 2
0
        private void Doc_DuLieu()
        {
            string path = "data.dat";

            CryptoStuff.DecryptFile(pass, path, "temp.txt");
            string data = File.ReadAllText("temp.txt");

            File.Delete("temp.txt");
            string[] temp = data.Split(' ');
            mssv = temp[0];
            tbx_UserName.Text = temp[0];
            password          = temp[1];
            tbx_Password.Text = temp[1];
        }
Exemplo n.º 3
0
        /// <summary>
        /// Read login information from a existed data.dat
        /// </summary>
        private void Doc_DuLieu()
        {
            string path = "data.dat";

            //Because decrypt string has gone wrong, so I must call decrypt file
            CryptoStuff.DecryptFile(pass, path, "temp.txt");
            string data = File.ReadAllText("temp.txt");

            File.Delete("temp.txt");
            string[] temp = data.Split(' ');
            mssv = temp[0];
            tbx_UserName.Text = temp[0];
            password          = temp[1];
            tbx_Password.Text = temp[1];
        }
Exemplo n.º 4
0
        /// <summary>
        /// Read login information from a existed file which is successful
        /// </summary>
        void Doc_DuLieu()
        {
            string path = "data.dat";

            CryptoStuff.DecryptFile(pass, path, "temp.txt");
            string data = File.ReadAllText("temp.txt");

            File.Delete("temp.txt");
            string[] temp = data.Split(' ');
            mssv     = temp[0];
            password = temp[1];
            if (!rememberLogin)
            {
                File.Delete(path);
            }
        }
Exemplo n.º 5
0
        public void ExcepionMessageCalc(Exception ex)
        {
            string exceptMessage = ex.ToString();
            string exceptLabel   = ("Critical Error:" + ex.GetType().ToString());

            string[]    gonnaWrite = { exceptMessage, Environment.NewLine, exceptLabel };
            ErrorWindow ew         = new ErrorWindow(exceptMessage, exceptLabel, true);

            ew.ShowDialog();
            string dateStr = DateTime.Now.ToString("yyyy-dd-M_HH-mm-ss");
            string fileDir = (AppDomain.CurrentDomain.BaseDirectory + "error_" + dateStr + ".debug");
            string tempDir = (Path.GetTempPath() + "error_" + dateStr + ".debug");

            using (StreamWriter sWriter = new System.IO.StreamWriter(tempDir))
            {
                foreach (string line in gonnaWrite)
                {
                    sWriter.WriteLine();
                }
            }
            CryptoStuff.EncryptFile(pass, tempDir, fileDir);
            return;
        }