コード例 #1
0
ファイル: Form1.cs プロジェクト: vvwall/DSTseverTools
 private void 资源配置ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Setting2 st = new Setting2();
     st.ShowDialog();
 }
コード例 #2
0
        private void 新开存档ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Setexe == "")
            {
                blindexe();
            }


            SelectSavePath ssp = new SelectSavePath();

            if (ssp.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show(ssp.pathret);
                string pt = ssp.pathret;
                MessageBox.Show("第一步:你需要设置服务参数(必选)\n设置后请点击部署到游戏目录", "向导");
                iniform ii = new iniform();
                do
                {
                    ii.cpath = pt;
                    if (ii.ShowDialog() == DialogResult.OK)
                    {
                        break;
                    }
                    else
                    {
                        MessageBox.Show("设置有问题,请重新设置");
                    }
                } while (true);

                //设置mod
                if (MessageBox.Show("第二步,你可以添加你喜欢的mod(可选跳过)\n点击取消跳过设置", "向导", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    modedit me = new modedit();
                    me.cpath = pt;
                    do
                    {
                        if (me.ShowDialog() == DialogResult.OK)
                        {
                            MessageBox.Show("很好,已经完成一半了,马上就能玩了,继续吧");
                            break;
                        }
                        else
                        {
                            if (MessageBox.Show("mod没设置是否继续设置?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                            {
                                break;
                            }
                        }
                    } while (true);
                }
                //设置世界
                if (MessageBox.Show("第三步,最后一步了设置世界(可选跳过)\n点击取消跳过设置", "向导", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    Setting2 st = new Setting2();
                    st.cpath = pt;
                    do
                    {
                        if (st.ShowDialog() == DialogResult.OK)
                        {
                            MessageBox.Show("很好,已经完成了,马上就能玩了,继续吧");
                            break;
                        }
                        else
                        {
                            if (MessageBox.Show("世界配置没设置是否继续设置?(跳过有可能出问题哦)", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                            {
                                break;
                            }
                        }
                    } while (true);
                }
                //生成token

                do
                {
                    if (token != "")
                    {
                        UTF8Encoding utf8 = new UTF8Encoding(false);
                        StreamWriter sw   = new StreamWriter(pt + @"\cluster_token.txt", false, utf8);
                        sw.Write(token);
                        sw.Close();
                        break;
                    }
                    else
                    {
                        if (MessageBox.Show("请设置token,不然只能以局域网模式启动服务器了\n是否设置?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            settoken();
                        }
                        else
                        {
                            consoletxt += " -offline";
                            StreamWriter sw1 = new StreamWriter(pt + @"\offline", false, Encoding.UTF8);
                            sw1.Write("offline");
                            sw1.Close();
                            break;
                        }
                    }
                } while (true);
                //启动服务器
                ListViewItem lvi  = new ListViewItem();
                string       temp = pt.Replace(Directory.GetParent(pt).ToString() + "\\", "");
                lvi.Text = temp;
                lvi.SubItems.Add(File.ReadAllText(pt + @"\intro.txt"));
                lvi.SubItems.Add(Directory.GetCreationTime(pt).ToString());
                listView1.Items.Add(lvi);
                if (MessageBox.Show("是否现在启动?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    string[] ba = buildags(pt).Split('|');
                    for (int k = 0; k < ba.Length - 1; k++)
                    {
                        string cons = "-cluster " + temp + " -shard " + ba[k] + " -conf_dir DSTTools " + consoletxt;
                        Exe(Setexe, cons);
                    }
                }
                else
                {
                    MessageBox.Show("未启动");
                }
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: vvwall/DSTseverTools
        private void 新开存档ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Setexe == "")
                {
                    blindexe();

                }

            SelectSavePath ssp = new SelectSavePath();
            if (ssp.ShowDialog() == DialogResult.OK) {

                MessageBox.Show(ssp.pathret);
                string pt = ssp.pathret;
                MessageBox.Show("第一步:你需要设置服务参数(必选)\n设置后请点击部署到游戏目录", "向导");
                iniform ii=new iniform();
                do
                {
                    ii.cpath = pt;
                    if (ii.ShowDialog() == DialogResult.OK)
                    {
                        break;
                    }
                    else {
                        MessageBox.Show("设置有问题,请重新设置");
                    }
                } while (true);

            //设置mod
                if (MessageBox.Show("第二步,你可以添加你喜欢的mod(可选跳过)\n点击取消跳过设置", "向导", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) {
                    modedit me = new modedit();
                    me.cpath = pt;
                    do {

                        if (me.ShowDialog() == DialogResult.OK)
                        {
                            MessageBox.Show("很好,已经完成一半了,马上就能玩了,继续吧");
                            break;
                        }
                        else
                        {

                            if (MessageBox.Show("mod没设置是否继续设置?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                            {
                                break;
                            }
                        }
                    } while (true);

                }
            //设置世界
                if (MessageBox.Show("第三步,最后一步了设置世界(可选跳过)\n点击取消跳过设置", "向导", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    Setting2 st = new Setting2();
                    st.cpath = pt;
                    do {
                        if (st.ShowDialog() == DialogResult.OK)
                        {
                            MessageBox.Show("很好,已经完成了,马上就能玩了,继续吧");
                            break;
                        }
                        else {
                            if (MessageBox.Show("世界配置没设置是否继续设置?(跳过有可能出问题哦)", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                            {
                                break;
                            }

                        }

                    } while (true);
                }
            //生成token

                do
                {
                    if (token != "")
                    {
                        UTF8Encoding utf8 = new UTF8Encoding(false);
                        StreamWriter sw = new StreamWriter(pt + @"\cluster_token.txt",false, utf8);
                        sw.Write(token);
                        sw.Close();
                        break;
                    }
                    else
                    {
                        if (MessageBox.Show("请设置token,不然只能以局域网模式启动服务器了\n是否设置?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            settoken();
                        }
                        else {
                            consoletxt += " -offline";
                            StreamWriter sw1 = new StreamWriter( pt + @"\offline", false,Encoding.UTF8);
                            sw1.Write("offline");
                            sw1.Close();
                            break;
                        }

                    }
                } while (true);
            //启动服务器
                ListViewItem lvi = new ListViewItem();
                string temp = pt.Replace(Directory.GetParent(pt).ToString() + "\\", "");
                lvi.Text=temp;
                lvi.SubItems.Add(File.ReadAllText(pt + @"\intro.txt"));
                lvi.SubItems.Add(Directory.GetCreationTime(pt).ToString());
                listView1.Items.Add(lvi);
                if (MessageBox.Show("是否现在启动?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {

                    string[] ba = buildags(pt).Split('|');
                  for(int k =0;k<ba.Length-1;k++){
                      string cons = "-cluster " + temp + " -shard " + ba[k]+ " -conf_dir DSTTools " + consoletxt;
                      Exe(Setexe, cons);
                  }

                }
                else {
                    MessageBox.Show("未启动");
                }

            }
        }
コード例 #4
0
        private void 资源配置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Setting2 st = new Setting2();

            st.ShowDialog();
        }