public static void Load(out EmotionsRepository repos, string path) { BinaryFormatter bf = new BinaryFormatter(); using (Stream s = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.None)) { repos = (EmotionsRepository)bf.Deserialize(s); } }
// STATIC public static void Create(out EmotionsRepository repos, string path) { if (File.Exists(path)) { EmotionsRepository.Load(out repos, path); } else { repos = new EmotionsRepository(path); repos.Save(); } }