public MainWindow()
        {
            InitializeComponent();
            Loaded      += new RoutedEventHandler(MainWindow_Loaded);
            CurrentPath  = AppDomain.CurrentDomain.BaseDirectory;
            VersionsList = new ObservableCollection <MCVersion>();
            WorldList    = new ObservableCollection <MCWorld>();

            if (!File.Exists(CurrentPath + "\\server.properties"))
            {
                MessageBox.Show("ERROR - server.properties file does not exist.");
                Environment.Exit(1);
            }
            ServerProperties = new ConfigParser(CurrentPath + "\\server.properties");
            rng = new Random();

            //Determine and display max avaliable ram, falls back to config if not found?
            Microsoft.VisualBasic.Devices.ComputerInfo DeviceInfo = new Microsoft.VisualBasic.Devices.ComputerInfo();
            int max_ram = (int)(DeviceInfo.AvailablePhysicalMemory / 1024 / 1024 / 1024);

            RAMSlider.Maximum = max_ram;

            //default java args
            JavaArgsInput.Text = java_default_args;
            CurrentMOTD.Text   = ServerProperties.GetValue("motd");

            //find current world
            CurrentWorld.Text = ServerProperties.GetValue("level-name");//.Replace(".world","");

            //list versions & worlds
            string[] versions = Directory.GetFiles(CurrentPath, "*minecraft_server*.jar");
            string[] worlds   = Directory.GetDirectories(CurrentPath, "*.world");
            //versions
            for (int i = 0; i < versions.Count(); i++)
            {
                string    version_name = versions[i].Replace(CurrentPath, "");
                MCVersion version      = new MCVersion()
                {
                    FileName = version_name,
                    FilePath = versions[i]
                };
                VersionsList.Add(version);
                ServerVersion.Items.Add(version.FileName);
            }
            //worlds
            for (int i = 0; i < worlds.Count(); i++)
            {
                worlds[i] = worlds[i].Replace(CurrentPath, "");
                string  displayworld = worlds[i].Replace(".world", "");
                MCWorld world        = new MCWorld()
                {
                    WorldName = displayworld,
                    WorldPath = worlds[i]
                };
                WorldList.Add(world);
                ServerWorld.Items.Add(world.WorldName);
            }
        }
        /* Main Launcher Events */
        private void LaunchServer_Click(object sender, RoutedEventArgs e)
        {
            MCVersion version = VersionsList.Where(f => f.FileName.Equals(ServerVersion.SelectedValue)).FirstOrDefault();
            MCWorld   world   = WorldList.Where(f => f.WorldName.Equals(ServerWorld.SelectedValue)).FirstOrDefault();

            if ((world != null) && (version != null))
            {
                //set version to launch
                JavaJar = version.FilePath;
                //set world
                ServerProperties.UpdateValue("level-name", world.WorldPath);

                //set custom motd based on mc's strings
                if (MOTDcheck.IsChecked == true)
                {
                    if (File.Exists(CurrentPath + "\\motds.txt"))
                    {
                        string        line;
                        List <string> motds = new List <string>();
                        using (StreamReader file = new StreamReader(CurrentPath + "\\motds.txt"))
                        {
                            while ((line = file.ReadLine()) != null)
                            {
                                motds.Add(line);
                            }
                        }
                        string newmotd = motds[rng.Next(0, motds.Count)];
                        CurrentMOTD.Text = newmotd;
                    }
                    else
                    {
                        MessageBox.Show("Alternating MOTD is enabled, motds.txt is missing. Using last MOTD.");
                    }
                }
                //update motd
                ServerProperties.UpdateValue("motd", CurrentMOTD.Text);

                //check for and backup world
                if (BackupWorld.IsChecked == true)
                {
                    CopyDirectory(CurrentPath + world.WorldPath, CurrentPath + world.WorldPath.Replace(".world", ".backup_" + DateTime.Now.ToString("yyyyMMdd-HHmm")));
                }

                //write out properties file
                //todo backgroundworker?
                WritePropertiesFile();

                //launch proccess based on version
                Process runserverjar = new Process();
                runserverjar.StartInfo.FileName  = "java";
                runserverjar.StartInfo.Arguments = @"-jar " + JavaJar + " " + JavaRam + JavaArgs + JavaNoGUI;

                //MessageBox.Show("pretend its running");
                runserverjar.Start();
                runserverjar.Exited += delegate
                {
                    if (CloseSL.IsChecked == true)
                    {
                        Environment.Exit(1);
                    }
                };
            }
            else
            {
                MessageBox.Show("Select both a version and a world to launch.");
            }
        }