public ServerAccessClass(string address,int port, System.Windows.Forms.Label resultLabel, System.Windows.Forms.ProgressBar progressBar,FormMain parent)
 {
     _label = resultLabel;
     _progressbar = progressBar;
     _parent = parent;
     _address = address;
     _port = port;
 }
        public FormOptions(FormMain parent)
        {
            InitializeComponent();
            _formMain = parent;

            try
            {
                string LinksRTF = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Segoe UI;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}}";
                LinksRTF += @"\viewkind4\uc1\pard\f0\fs18 ";//
                LinksRTF += @"KillerBeesGaming.com \tab -  http://www.killerbeesgaming.com/content.php\par ";
                LinksRTF += @"KillerBees twitter page \tab -  https://twitter.com/intent/user?screen_name=KB_Gaming\par ";
                LinksRTF += @"Industrial Rage \tab\tab -  http://www.killerbeesgaming.com/games.php?do=mc#industrial\par ";
                LinksRTF += @"Endless Rage \tab\tab -  http://www.killerbeesgaming.com/games.php?do=mc#endless\par ";
                LinksRTF += @"Terrafirma Rage \tab\tab -  http://www.killerbeesgaming.com/games.php?do=mc#tfcraft\par ";
                LinksRTF += @"Vanilla Minecraft \tab\tab -  https://minecraft.net/download\f1\fs17\par}"; //
                richTextBoxLinks.Rtf = LinksRTF;

                if (_settings == null)
                    _settings = new xmlSettings(); //creates xml module, and loads all packs

                //_packsInfo = _settings.LoadPacks();

                //if (_packsInfo.Count == 0)
                //{
                //    _packsInfo.Add(new PackClass(_packIRName, 0, "https://www.dropbox.com/s/v26po41rzzun31i/IRpack.zip", "https://www.dropbox.com/s/s7dh3a0pxawsyxh/IRVersion.txt"));
                //    _packsInfo.Add(new PackClass(_packERName, 0, "https://www.dropbox.com/s/sppgwbtlm3hoeeo/ERPack.zip", "https://www.dropbox.com/s/a0vd96eiwp8frt1/ERVersion.txt"));
                //    _packsInfo.Add(new PackClass(_packTFCRName, 0, "https://www.dropbox.com/s/jws5yja076d7zco/TFRpack.zip", "https://www.dropbox.com/s/ku39s71paof1ydd/TFRVersion.txt"));
                //    _packsInfo.Add(new PackClass(_packVanillaName, 0, "https://www.dropbox.com/s/wno98avd34pg34o/VanillaPack.zip", "https://www.dropbox.com/s/0sy2id6ss6l76bt/Vanilla.txt"));

                //    foreach (PackClass pack in _packsInfo)
                //    {
                //        Settings.SavePackInfo(pack);
                //        //packSettings1.AddPack(pack);
                //    }
                //    //Settings.SavePackInfo();
                //    //Settings.SavePackInfo(
                //    //Settings.SavePackInfo(

                //    //MCPackSettings.AddPack(new PackClass(_packIRName, 0, "https://www.dropbox.com/s/v26po41rzzun31i/IRpack.zip", "https://www.dropbox.com/s/s7dh3a0pxawsyxh/IRVersion.txt"));
                //    //MCPackSettings.AddPack(new PackClass(_packERName, 0, "https://www.dropbox.com/s/sppgwbtlm3hoeeo/ERPack.zip", "https://www.dropbox.com/s/a0vd96eiwp8frt1/ERVersion.txt"));
                //    //MCPackSettings.AddPack(new PackClass(_packTFCRName, 0, "https://www.dropbox.com/s/jws5yja076d7zco/TFRpack.zip", "https://www.dropbox.com/s/ku39s71paof1ydd/TFRVersion.txt"));
                //    //MCPackSettings.AddPack(new PackClass(_packVanillaName, 0, "https://www.dropbox.com/s/wno98avd34pg34o/VanillaPack.zip", "https://www.dropbox.com/s/0sy2id6ss6l76bt/Vanilla.txt"));

                //}

                //foreach (PackClass pack in _packsInfo)
                //{
                //    //Settings.SavePackInfo(pack);
                //    packSettings1.AddPack(pack);
                //}

                //generate default folders
                string packDir = Application.StartupPath + "\\Minecraft Packs";

                if (!Directory.Exists(packDir + "\\" + _packIRName))
                    Directory.CreateDirectory(packDir + "\\" + _packIRName);

                if (!Directory.Exists(packDir + "\\" + _packERName))
                    Directory.CreateDirectory(packDir + "\\" + _packERName);

                if (!Directory.Exists(packDir + "\\" + _packTFCRName))
                    Directory.CreateDirectory(packDir + "\\" + _packTFCRName);

                if (!Directory.Exists(packDir + "\\" + _packVanillaName))
                    Directory.CreateDirectory(packDir + "\\" + _packVanillaName);

                //if (!Directory.Exists(packDir) || Directory.GetDirectories(packDir).Length == 0)
                //{
                //    Directory.CreateDirectory(packDir + "\\" + _packIRName);
                //    Directory.CreateDirectory(packDir + "\\" + _packERName);
                //    Directory.CreateDirectory(packDir + "\\" + _packTFCRName);
                //    Directory.CreateDirectory(packDir + "\\" + _packVanillaName);
                //}

                labelVersion.Text = string.Format("Version {0}.{1}.{2}.{3}",GetClientVersion().VersionMajor,GetClientVersion().VersionMinor,GetClientVersion().VersionRevision,GetClientVersion().VersionPack); //KBGClientVersion.ToString();
                //labelManualJavaPath.Text = GetJavaVersion();

                checkBoxManualJavaPath.Checked = _settings.UseManualJavaPath;
                textBoxManualJavaPath.Text = _settings.ManualJavaPath;

                _LoadingSettings = true;

                //get system memmory

                trackBarMemmory.Maximum = (int)Math.Floor(decimal.Round(GetTotalMemoryInBytes() / 1048576));
                trackBarMemmory.Value = _settings.MemmoryMax;
                AdjustMemmoryValues();
                //decimal.Round(GetTotalMemoryInBytes() / 3000000)
                //numericUpDownRamMin.Value = _settings.MemmoryMin;
                //numericUpDownRamMax.Value = _settings.MemmoryMax;

                _LoadingSettings = false;
            }
            catch (UnauthorizedAccessException ex)
            {
                ex.Data.Add("FormOptions() - ExecutablePath", Application.ExecutablePath);
                string message = string.Format("The program encountered a situation where it did not have enough permissions to do its work in its own folder and cannot continue to function.{0}Please make sure you put the {1} file in a folder with more permissions!{0}{0}I suggest a place like c:\\Games\\Minecraft", Environment.NewLine, new FileInfo(Application.ExecutablePath).Name);
                MessageBox.Show(message, "Insufficiant permissions", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                _formMain.ErrorReporting(ex, true);
            }
            catch (Exception ex)
            {
                _formMain.ErrorReporting(ex, true);
                throw;
            }
        }