diff --git a/Server/Forms/frmMain.cs b/Server/Forms/frmMain.cs index e4538d4c..d18e4a4a 100644 --- a/Server/Forms/frmMain.cs +++ b/Server/Forms/frmMain.cs @@ -13,18 +13,22 @@ public partial class frmMain : Form public Server listenServer; private ListViewColumnSorter lvwColumnSorter; - public frmMain() + private void ReadSettings(bool WriteIfNotExist = true) { - XMLSettings.WriteDefaultSettings(); + if (WriteIfNotExist) + XMLSettings.WriteDefaultSettings(); XMLSettings.ListenPort = ushort.Parse(XMLSettings.ReadValue("ListenPort")); + XMLSettings.ShowToU = bool.Parse(XMLSettings.ReadValue("ShowToU")); XMLSettings.AutoListen = bool.Parse(XMLSettings.ReadValue("AutoListen")); XMLSettings.ShowPopup = bool.Parse(XMLSettings.ReadValue("ShowPopup")); + XMLSettings.UseUPnP = bool.Parse(XMLSettings.ReadValue("UseUPnP")); XMLSettings.Password = XMLSettings.ReadValue("Password"); - // fallback for old settings - XMLSettings.UseUPnP = bool.Parse((!string.IsNullOrEmpty(XMLSettings.ReadValue("UseUPnP"))) ? XMLSettings.ReadValue("UseUPnP") : "False"); + } - if (bool.Parse(XMLSettings.ReadValue("ShowToU"))) + private void ShowTermsOfService(bool Show) + { + if (Show) { using (var frm = new frmTermsOfUse()) { @@ -32,6 +36,12 @@ public frmMain() } Thread.Sleep(300); } + } + + public frmMain() + { + ReadSettings(); + ShowTermsOfService(XMLSettings.ShowToU); InitializeComponent(); diff --git a/Server/Settings/Settings.cs b/Server/Settings/Settings.cs index b3c9702b..9f961689 100644 --- a/Server/Settings/Settings.cs +++ b/Server/Settings/Settings.cs @@ -9,6 +9,7 @@ public static class XMLSettings { public const string VERSION = "RELEASE3"; public static ushort ListenPort { get; set; } + public static bool ShowToU { get; set; } public static bool AutoListen { get; set; } public static bool ShowPopup { get; set; } public static bool UseUPnP { get; set; }