public void Load() { if (!_isoStoreInit) { return; } try { if (_isoStore.FileExists(SettingsPath)) { using (var isoStream = new IsolatedStorageFileStream(SettingsPath, FileMode.Open, _isoStore)) { using (var reader = new StreamReader(isoStream)) { var serializer = new XmlSerializer(typeof(PipelineSettings)); Default = (PipelineSettings)serializer.Deserialize(reader); var history = Default.ProjectHistory.ToArray(); foreach (var h in history) { if (!File.Exists(h)) { Default.ProjectHistory.Remove(h); } } } } } } catch { Save(); } }
public void Load() { if (_isoStore.FileExists(SettingsPath)) { using (var isoStream = new IsolatedStorageFileStream(SettingsPath, FileMode.Open, _isoStore)) { using (var reader = new StreamReader(isoStream)) { var serializer = new XmlSerializer(typeof(PipelineSettings)); Default = (PipelineSettings)serializer.Deserialize(reader); } } } }
public void Load() { if (!_isoStoreInit) { return; } try { if (!_isoStore.FileExists(SettingsPath)) { return; } using var isoStream = new IsolatedStorageFileStream( SettingsPath, FileMode.Open, _isoStore); using var reader = new XmlTextReader(isoStream); var serializer = new XmlSerializer(typeof(PipelineSettings)); Default = (PipelineSettings)serializer.Deserialize(reader); for (int i = Default.ProjectHistory.Count; i-- > 0;) { string entry = Default.ProjectHistory[i]; if (!File.Exists(entry)) { Default.ProjectHistory.RemoveAt(i); } } } catch { Save(); } }
static PipelineSettings() { Default = new PipelineSettings(); }