/// <summary> /// Loads the viewer status values from a saved version of the viewer status, This allows settings to persist /// across sessions if the user wishes. /// </summary> /// <param name="storeStream">The stream from which to read the settings</param> public void LoadViewerStatus(Stream storeStream) { //Bilge.E(); try { XmlSerializer xmls = new XmlSerializer(typeof(MexStatus)); MexStatus temp = (MexStatus)xmls.Deserialize(storeStream); if ((temp.XLoc < 0) || (temp.YLoc < 0) || (temp.XLoc > System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width) || (temp.YLoc > System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height)) { // TODO : Eliminate the cause for this. //Bilge.Warning("INVALID settings for the size of Mex being loaded, the screen would not be visible. Resetting to defaults. WHY is this occuring!?"); //Bilge.Dump(temp, "Invalid MexStatus detected."); this.LoadDefaultStatus(); //Bilge.Warning("Invalid settings caused defaults to be loaded, user settings have been lost"); } else { this.PopulateFromMe(temp); } } finally { //Bilge.X(); } }
private void PopulateFromMe(MexStatus ms) { this.XLoc = ms.XLoc; this.YLoc = ms.YLoc; this.Width = ms.Width; this.Height = ms.Height; if (ms.FileMostRecentlyUsedList == null) { this.FileMostRecentlyUsedList = new string[0]; } else { this.FileMostRecentlyUsedList = new string[ms.FileMostRecentlyUsedList.Length]; Array.Copy(ms.FileMostRecentlyUsedList, this.FileMostRecentlyUsedList, ms.FileMostRecentlyUsedList.Length); } if (ms.LastLoadedFile == null) { this.LastLoadedFile = string.Empty; } else { this.LastLoadedFile = ms.LastLoadedFile; } this.ProcessViewIndexColumnWidth = ms.ProcessViewIndexColumnWidth; this.ProcessViewThreadColumnWidth = ms.ProcessViewThreadColumnWidth; this.ProcessViewLocationColumnWidth = ms.ProcessViewLocationColumnWidth; this.ProcessViewDebugMessageColumnWidth = ms.ProcessViewDebugMessageColumnWidth; this.ProcessViewPhysicalLocationColumnWidth = ms.ProcessViewPhysicalLocationColumnWidth; this.MoreDetailsTopPanelHeight = ms.MoreDetailsTopPanelHeight; this.MoreDetailsBottomPanelHeight = ms.MoreDetailsBottomPanelHeight; this.MoreDetailsWidth = ms.MoreDetailsWidth; this.MoreDetailsHeight = ms.MoreDetailsHeight; }