public static Accounts ReadAccountItems() { Accounts account = new Accounts(); string filePath = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "AccountItems.txt"); if (!File.Exists(filePath)) { return(account); } using (StreamReader streamwriter = new StreamReader(filePath)) { string[] oneLine = Regex.Split(streamwriter.ReadToEnd(), @"\r\n"); for (int i = 0; i < oneLine.Length - 1; i++) { AccountItem item = ParseItem(oneLine[i]); account.AddItem(item); } } return(account); }
public void AddItem(AccountItem item) { accounts.Add(item); }