Exemplo n.º 1
0
        public void Registrate(Account newAccount)
        {
            string allInformationFromFile;
            int    count = 0;

            using (StreamReader sr = new StreamReader(@"Accounts\list.txt", Encoding.Default))
            {
                count = Convert.ToInt32(sr.ReadLine());
                allInformationFromFile = sr.ReadToEnd();
            }
            if (IsSimilarAccount(allInformationFromFile, newAccount) == false)
            {
                MessageBox.Show("Такой логин уже существует!");
                return;
            }
            using (StreamWriter sw = new StreamWriter(@"Accounts\list.txt", false, Encoding.Default))
            {
                count++;
                sw.WriteLine(count.ToString());
                sw.Write(allInformationFromFile);
                Shifrator encrypter = new Shifrator();
                sw.WriteLine(encrypter.Encrypt(newAccount.accountLogin + " " + count, "100501"));

                CreateNewFile(count.ToString());
                MessageBox.Show("Вы успешно зарегестрированы!");
            }
        }
Exemplo n.º 2
0
 private void ReWrite()
 {
     using (StreamWriter sw = new StreamWriter(@"Accounts\" + saveAccount.ID + ".txt", false, Encoding.Default))
     {
         Shifrator encrypter = new Shifrator();
         for (int j = 0; j < saveAccount.resoursesList.Count(); j++)
         {
             sw.WriteLine(encrypter.Encrypt(saveAccount.resoursesList[j], saveAccount.accountPassword));
         }
     }
 }