/// <summary> /// It loads the Bank info from the provided stream /// </summary> /// <param name="textIn">The stream to load the bank from</param> /// <returns>The DictionaryBank object</returns> public static DictionaryBank Load(TextReader textIn) { DictionaryBank result = new DictionaryBank(); string countString = textIn.ReadLine(); int count = int.Parse(countString); for (int i = 0; i < count; i++) { string className = textIn.ReadLine(); IAccount account = AccountFactory.MakeAccount(className, textIn); result.accountDictionary.Add(account.GetName(), account); } return(result); }
public static HashBank Load(System.IO.TextReader textIn) { HashBank result = new HashBank(); string countString = textIn.ReadLine(); int count = int.Parse(countString); for (int i = 0; i < count; i++) { // CustomerAccount account = CustomerAccount.Load(textIn); // Override using factory class to create bank accounts string className = textIn.ReadLine(); IAccount account = AccountFactory.MakeAccount(className, textIn); result.bankHashtable.Add(account.GetName(), account.GetBalance()); } return(result); }