MainWnd.UI2Settings(): no ls.Save() when no UI change, LocalSettings: Saves either plain or encrypted file, ver. 2.18.1268
This commit is contained in:
parent
fa22b6a8c7
commit
28a324be8d
@ -343,7 +343,13 @@ namespace TBF
|
||||
try
|
||||
{
|
||||
UpdateResultsOutputData();
|
||||
|
||||
#if PUCHONG_200
|
||||
/// Write settings to an unencrypted file
|
||||
using (TextWriter writer = new StreamWriter(Program.LocalSettingsFileName))
|
||||
{
|
||||
serializer.Serialize(writer, this);
|
||||
}
|
||||
#else
|
||||
/// Write settings to a string
|
||||
StringBuilder plain = new StringBuilder();
|
||||
using (TextWriter writer = new StringWriter(plain))
|
||||
@ -351,7 +357,7 @@ namespace TBF
|
||||
serializer.Serialize(writer, this);
|
||||
}
|
||||
|
||||
/// Encrypt
|
||||
/// Encrypt and write to a file
|
||||
using (RijndaelManaged myRijndael = new RijndaelManaged())
|
||||
{
|
||||
/// Create an encryptor to perform the stream transform.
|
||||
@ -376,6 +382,7 @@ namespace TBF
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@ -652,29 +652,32 @@ namespace TBF
|
||||
/// </summary>
|
||||
void UI2Settings()
|
||||
{
|
||||
/// Obtain MainWnd dimensions, etc.
|
||||
bool isMaximized = (WindowState == FormWindowState.Maximized);
|
||||
int left = (WindowState == FormWindowState.Normal) ? Location.X : RestoreBounds.Left;
|
||||
int top = (WindowState == FormWindowState.Normal) ? Location.Y : RestoreBounds.Top;
|
||||
int width = (WindowState == FormWindowState.Normal) ? Size.Width : RestoreBounds.Width;
|
||||
int height = (WindowState == FormWindowState.Normal) ? Size.Height : RestoreBounds.Height;
|
||||
int sd1 = rightHorizSplitContainer.SplitterDistance;
|
||||
int sd2 = topVerticalSplitContainer.SplitterDistance;
|
||||
|
||||
LocalSettings ls = Program.LocalSettings;
|
||||
|
||||
if (ls != null)
|
||||
if (ls != null && (ls.MainWndMaximized != isMaximized ||
|
||||
ls.MainWndLeft != left ||
|
||||
ls.MainWndTop != top ||
|
||||
ls.MainWndWidth != width ||
|
||||
ls.MainWndHeight != height ||
|
||||
ls.RightPaneHorizSplitterDistance != sd1 ||
|
||||
ls.TopPaneVerticalSplitterDistance != sd2))
|
||||
{
|
||||
ls.RightPaneHorizSplitterDistance = rightHorizSplitContainer.SplitterDistance;
|
||||
ls.TopPaneVerticalSplitterDistance = topVerticalSplitContainer.SplitterDistance;
|
||||
|
||||
ls.MainWndMaximized = (WindowState == FormWindowState.Maximized);
|
||||
if (WindowState == FormWindowState.Normal)
|
||||
{
|
||||
ls.MainWndLeft = Location.X;
|
||||
ls.MainWndTop = Location.Y;
|
||||
ls.MainWndWidth = Size.Width;
|
||||
ls.MainWndHeight = Size.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Maximized or minimized (when restarted, minimized window is restored as normal)
|
||||
ls.MainWndLeft = RestoreBounds.Left;
|
||||
ls.MainWndTop = RestoreBounds.Top;
|
||||
ls.MainWndWidth = RestoreBounds.Width;
|
||||
ls.MainWndHeight = RestoreBounds.Height;
|
||||
}
|
||||
/// At least one MainWnd dimension differs => Update local settings and save them
|
||||
ls.MainWndMaximized = isMaximized;
|
||||
ls.MainWndLeft = left;
|
||||
ls.MainWndTop = top;
|
||||
ls.MainWndWidth = width;
|
||||
ls.MainWndHeight = height;
|
||||
ls.RightPaneHorizSplitterDistance = sd1;
|
||||
ls.TopPaneVerticalSplitterDistance = sd2;
|
||||
ls.Save();
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.18.1265.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1265.0")]
|
||||
[assembly: AssemblyVersion("2.18.1268.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1268.0")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user