Optimized Server Start

This commit is contained in:
MaxXor 2015-01-13 10:12:56 +01:00
parent 9a329711a7
commit e325a78e23
2 changed files with 16 additions and 5 deletions

View File

@ -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();

View File

@ -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; }