コード例 #1
0
        }// unicode转中文

        private void skinButton1_Click(object sender, EventArgs e)//保存配置
        {
            if (!isserverrunning)
            {
                string[,] pro = new string[mc.GetConf().Length, 2];
                pro           = mc.GetConf();
                pro[find2("allow-nether", pro), 1]         = putout(skinComboBox1);
                pro[find2("difficulty", pro), 1]           = skinComboBox7.SelectedIndex.ToString();
                pro[find2("spawn-monsters", pro), 1]       = putout(skinComboBox3);
                pro[find2("pvp", pro), 1]                  = putout(skinComboBox8);
                pro[find2("enable-command-block", pro), 1] = putout(skinComboBox9);
                pro[find2("max-players", pro), 1]          = skinTextBox10.Text;
                pro[find2("server-port", pro), 1]          = skinTextBox8.Text;
                pro[find2("spawn-animals", pro), 1]        = putout(skinComboBox5);
                pro[find2("white-list", pro), 1]           = putout(skinComboBox6);
                pro[find2("online-mode", pro), 1]          = putout(skinComboBox2);
                pro[find2("level-seed", pro), 1]           = skinTextBox9.Text;
                pro[find2("motd", pro), 1]                 = unicode_0(skinTextBox7.Text);
                string value = "";
                int    x     = 0;
                foreach (string i in pro)
                {
                    if (x % 2 == 0)
                    {
                        value += i + "=";
                    }
                    else
                    {
                        value += i + "\r\n";
                    }
                    x++;
                }
                if (MCS.WriteText(Rundir + "\\server.properties", value))
                {
                    SkinMessageBox("提示 :", "保存完成", 1);
                }
                else
                {
                    SkinMessageBox("提示 :", "保存失败", 1);
                }
            }
            else
            {
                SkinMessageBox("警告 :", "关闭服务器后再试", 1);
            }
        }
コード例 #2
0
 private void saveButton_Click(object sender, EventArgs e)
 {
     if (!isserverrunning)
     {
         if (jardirectorytextbox.Text == "" || javapathtextbox.Text == "" || maxtextbox.Text == "" || mintextbox.Text == "")
         {
             SkinMessageBox("警告 :", "信息不完整", 1);
         }
         else
         {
             string value = "[setting]" + "\r\n" + "jardirectory = " + jardirectorytextbox.Text
                            + "\r\n" + "javapath = " + javapathtextbox.Text + "\r\n" + "max = " + maxtextbox.Text + "\r\n" + "min = " + mintextbox.Text;
             MCS.WriteText(Environment.CurrentDirectory + @"\MCSM.conf", value);
             mc.changerundir(jardirectorytextbox.Text);
             string[] r = settingcheck();
             if (r != null)
             {
                 SkinMessageBox("提示 :", "保存完成", 1);
             }
         }
     }
 }