Advertisement
Guest User

Untitled

a guest
Oct 30th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5.  
  6. List<Account> users = new List<Account>();
  7. string path = @"D:\C#\myAccounts.txt";
  8. string input1;
  9. string input2;
  10.  
  11. using (StreamReader sr = new StreamReader(path))
  12. {
  13. string line = sr.ReadToEnd();
  14. Console.WriteLine(line);
  15. // List<string> ReadFile = File.ReadAllLines(@"C:\TEMP\FILE.TXT").ToList();
  16.  
  17. }
  18.  
  19. do
  20. {
  21.  
  22. Console.WriteLine("Enter your username or type exit to quit");
  23.  
  24. input1 = Console.ReadLine();
  25.  
  26. if (input1 == "exit")
  27. break;
  28.  
  29. Console.WriteLine("Ener your password:");
  30.  
  31. input2 = Console.ReadLine();
  32.  
  33. Account account = new Account(input1,input2);
  34.  
  35. users.Add(account);
  36.  
  37. } while (true);
  38.  
  39. foreach (Account account in users)
  40. {
  41. Console.WriteLine(" Username: " + account.userName + " Password: " + account.passWord);
  42. File.AppendAllText(path," Username: " + account.userName.ToString() + "\r\n" + " Password: " + account.passWord.ToString() + "\r\n");
  43.  
  44. }
  45.  
  46. Console.ReadLine();
  47.  
  48.  
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement