Пример #1
0
        public static HabitList Initialize()
        {
            if (_habits == null)
            {
                _habits = new HabitList();
                Save.Load(ref _habits, _path);
            }

            return(_habits);
        }
Пример #2
0
 public static void SaveLoad(HabitList fData, string path)
 {
     try
     {
         using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate))
         {
             BinaryFormatter bf = new BinaryFormatter();
             bf.Serialize(fs, fData);
         }
     }
     catch { }
 }
Пример #3
0
        public static void Load(ref HabitList fData, string path)
        {
            if (!File.Exists(path))
            {
                return;
            }

            try
            {
                using (FileStream fs = new FileStream(path, FileMode.Open))
                {
                    BinaryFormatter bf = new BinaryFormatter();
                    fData = (HabitList)bf.Deserialize(fs);
                }
            }
            catch { }
        }