public void Save(IModelPickle saveItem) { try { if (File.Exists(_filePath)) { if (saveItem.Modified) { File.WriteAllLines(_filePath, saveItem.Serialize()); } } } //if running multiple instances of the application the file may already being read. Then HIDE exception. catch (IOException) { } }
public void Load(IModelPickle loadItem) { try { if (!File.Exists(_filePath)) { File.Create(_filePath).Close(); return; } string[] fileData = File.ReadAllLines(_filePath); if (fileData.Length != 0) { loadItem.Deserialize(fileData); } } //if running multiple instances of the application the file may already being read. Then HIDE exception. catch (IOException) { } }