예제 #1
0
        public static ICollection<Income> LoadIncome(string saveFileName)
        {
            string path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDoc‌​uments), "FamilyBudgetCalculator", saveFileName);
            ICollection<Income> income = new List<Income>();

            if (!Directory.Exists(path))
            {
                throw new Exception("NO SUCH SAVE FILE!");
            }
            else
            {
                string[] lines = File.ReadAllLines(Path.Combine(path, "incomes.csv"), Encoding.UTF8);
                foreach (var line in lines)
                {
                    income.Add(Income.FromString(line));
                }
            }

            return income;
        }