/// <summary> /// Load snapshot debug setting from stream /// </summary> public bool LoadConfigSettings(Stream stream) { Assumes.ThrowIfNull(stream, nameof(stream)); BinaryFormatter formatter = new BinaryFormatter(); try { if (stream.Length > 0) { SnapshotDebugUserSettings userSettings = formatter.Deserialize(stream) as SnapshotDebugUserSettings; if (SnapshotDebugUserSettings.VersionMatch(userSettings?.Version)) { if (userSettings.DebugConfigs?.Count() > 0) { _mruDictionary = userSettings.DebugConfigs.ToDictionary(p => p.Key, p => new MRUList <SnapshotDebugConfig>(p.Value.ToList())); // Guid.empty means all MRU lists are changed ConfigListChanged?.Invoke(this, _mruDictionary.Select(p => p.Key)); } return(true); } } } catch (SerializationException e) { Assumes.Fail(e.ToString()); } return(false); }
/// <summary> /// Update MRU list when user visit a configuration or created a new configuration /// </summary> public void VisitConfig(Guid projectGuid, SnapshotDebugConfig config) { MRUList <SnapshotDebugConfig> mruList = GetMRUList(projectGuid); mruList.VisitItem(config); ConfigListChanged?.Invoke(this, new Guid[] { projectGuid }); }