Esempio n. 1
0
        private void frmMain_Loaded(object sender, RoutedEventArgs e)
        {
            ConfigApp.initDirSetting();

            webServer = new WebServer(clientInfoAdd);

            os = new OS();
            os.interfaceServerDisabled    = interfaceServerDisabled;
            os.interfaceMinecraftDisabled = interfaceMinecraftDisabled;
            os.serverRunning    = serverRunning;
            os.minecraftRunning = minicraftRunning;
            os.startMonitor();

            this.frmMain.Title = ConfigApp.getAppTitle();

            cfgClient  = ConfigApp.LoadClientSetting();
            cfgServer  = ConfigApp.LoadServerSetting();
            listServer = ConfigApp.LoadListServer();


            cmbMemory.ItemsSource = os.freeMemory();
            //cmbMemory.ite;
            cmbMemoryServer.ItemsSource  = os.freeMemory();
            lblIsx64.Content             = os.getIsOSx64() + os.getJavaInfo();
            cmbVersionGame.ItemsSource   = game.getGameVersions();
            cmbVersionServer.ItemsSource = server.getVersions();


            //SERVER SETTING
            for (int i = 0; i < listServer.Length; i++)
            {
                cmbGameServer.Items.Add(listServer[i]);
            }

            // CLIENT
            txtUserName.Text    = (!String.IsNullOrEmpty(cfgClient.Username)) ? cfgClient.Username : os.getUserName();
            IsForge.IsChecked   = cfgClient.IsForge;
            isReMods.IsChecked  = cfgClient.IsinstallMods;
            cmbMemory.Text      = (!String.IsNullOrEmpty(cfgClient.Memory)) ? cfgClient.Memory.Trim() : "";
            cmbVersionGame.Text = (!String.IsNullOrEmpty(cfgClient.VersionGame)) ? cfgClient.VersionGame.Trim() : "";
            //txtHostServerMap.Text = cfgClient.HostServer;
            cmbGameServer.Text     = cfgClient.HostServer;
            txtPortGameServer.Text = cfgClient.PortGameServer;
            txtPortMapServer.Text  = cfgClient.PortMapServer;

            //SERVER
            cmbMemoryServer.Text  = (!String.IsNullOrEmpty(cfgServer.Memory)) ? cfgServer.Memory.Trim() : "";
            cmbVersionServer.Text = (!String.IsNullOrEmpty(cfgServer.Version)) ? cfgServer.Version.Trim() : "";
            isGUI.IsChecked       = cfgServer.IsGUI;


            // Отправить данные на сервер
            string postData = String.Format("login={0}&memory={1}&version={2}&is_forge={3}&version_launcher={4}",
                                            cfgClient.Username, cfgClient.Memory, cfgClient.VersionGame, cfgClient.IsForge, ConfigApp.getVersion());

            new WebClientInfo(serverResponseInfo).send(postData);
        }
Esempio n. 2
0
        private void btnAddGameServer_Click(object sender, RoutedEventArgs e)
        {
            if (!String.IsNullOrEmpty(txtGameServer.Text.Trim()))
            {
                cmbGameServer.Items.Add(txtGameServer.Text.Trim());

                ConfigApp.SaveListServer(txtGameServer.Text.Trim());

                txtGameServer.Text = null;
            }
        }
Esempio n. 3
0
        private void btnRemoveGameServer_Click(object sender, RoutedEventArgs e)
        {
            if (cmbGameServer.SelectedItem != null)
            {
                string rt = cmbGameServer.SelectedItem.ToString();
                cmbGameServer.Items.Remove(cmbGameServer.SelectedItem);

                string[] array = cmbGameServer.Items.Cast <string>().ToArray();
                ConfigApp.ReSaveListServer(array);
            }
        }
Esempio n. 4
0
 private void frmMain_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     ConfigApp.SaveClientSetting(cfgClient);
     ConfigApp.SaveServerSetting(cfgServer);
 }