Пример #1
0
        private void 保存到游戏目录ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            //预设的一些
            path = path + @"\Klei\DSTTools\Cluster_1\";
            if (cpath != "")
            {
                path = cpath + @"\";
            }
            else
            {
                SelectSavePath slp = new SelectSavePath();
                slp.checkfile = @"\cluster.ini";

                if (slp.ShowDialog() == DialogResult.OK)
                {
                    path = slp.pathret;
                }
                else
                {
                    MessageBox.Show("请选择目录");
                    return;
                }
            }
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            IniFiles ini = new IniFiles(path + "cluster.ini");

            //预设的一些

            if (checkBox1.Checked)
            {
                creatini(ini, true, true);
            }
            else
            {
                creatini(ini, false, false);
            }

            MessageBox.Show("生成成功了\n已经放置到游戏目录");
            if (cpath != "")
            {
                DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                System.Diagnostics.Process.Start("explorer.exe", path);
            }
        }
Пример #2
0
        private void 保存到游戏目录ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            //预设的一些
            path = path + @"\Klei\DSTTools\Cluster_1\";
            if (cpath != "")
            {
                path = cpath + @"\";
            }
            else {

                SelectSavePath slp = new SelectSavePath();
                slp.checkfile = @"\cluster.ini";

                if (slp.ShowDialog() == DialogResult.OK)
                {
                    path = slp.pathret;

                }
                else
                {
                    MessageBox.Show("请选择目录");
                    return;

                }
            }
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            IniFiles ini = new IniFiles(path + "cluster.ini");
            //预设的一些

            if (checkBox1.Checked)
            {
                creatini(ini, true, true);
            }
            else
            {
                creatini(ini, false, false);
            }

            MessageBox.Show("生成成功了\n已经放置到游戏目录");
            if (cpath != "")
            {
                DialogResult = DialogResult.OK;
                this.Close();
            }
            else {
                System.Diagnostics.Process.Start("explorer.exe", path);
            }
        }
Пример #3
0
        private void 自动部署文件到应该的地方ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //选择文件夹
            FolderBrowserDialog fb = new FolderBrowserDialog();
            fb.Description = "选择游戏目录(游戏根目录)";
            if (fb.ShowDialog() == DialogResult.OK)
            {
                gamepath = fb.SelectedPath;

                if (!Directory.Exists(gamepath + @"\mods\"))
                {
                    MessageBox.Show("选择的不是根目录,\n根目录下有mods文件夹你的没有\n请重新选择");
                    gamepath = "";
                    return;
                }
            }
            else
            {
                MessageBox.Show("未设置游戏目录不可以-自动生成");
                gamepath = "";
                return;
            }

            StreamWriter sw,sw2,sw1;
            string path = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            if (cpath != "") {
                 sw = new StreamWriter(cpath + @"\Master\modoverrides.lua", false, utf8);
                sw2 = new StreamWriter(gamepath + @"\mods\dedicated_server_mods_setup.lua", false, utf8);
                sw1 = new StreamWriter(cpath + @"\Slave\modoverrides.lua", false, utf8);

            } else {
                SelectSavePath slp = new SelectSavePath();
                slp.checkfile = @"\Master\modoverrides.lua";

                    if (slp.ShowDialog() == DialogResult.OK)
                    {
                        path = slp.pathret;

                    }
                    else
                    {
                        MessageBox.Show("请选择目录");
                        return;

                    }

                //modoverrides.lua||dedicated_server_mods_setup.lua||ServerModSetup("workshop-365119238") 	-- "SmartCrockPot"
                sw = new StreamWriter(path + @"\Master\modoverrides.lua", false, utf8);
                sw2 = new StreamWriter(gamepath + @"\mods\dedicated_server_mods_setup.lua", false, utf8);
                sw1 = new StreamWriter(path + @"\Slave\modoverrides.lua", false, utf8);
                //  sw.WriteLine("--这个文件请放到我的文档\\klei\\DoNotStarveTogether_EasyConfigOverworld和DoNotStarveTogether_EasyConfigCaves目录中");
            }
            sw.WriteLine("return{");
            sw1.WriteLine("return{");
            string str2 = "";
            string txt = "";
            int cont = 0;
            foreach (ListViewItem lvi in listView1.Items)  //选中项遍历
            {
                if (lvi.Checked) {
                    str2 = "[\"workshop-" + lvi.Text + "\"] = { enabled = true },	--" + lvi.SubItems[1].Text ;
                    sw.WriteLine(str2);
                    sw1.WriteLine(str2);
                    txt = "ServerModSetup(\"" + lvi.Text + "\")           --" + lvi.SubItems[1].Text;
                    sw2.WriteLine(txt);
                    cont++;
                }
            }

            sw.WriteLine("}");
            sw1.WriteLine("}");
              txt = "--由JV工具生成weibo:" + @"http://weibo.com/findlike";
             sw.WriteLine(txt);
             sw1.WriteLine(txt);
             sw2.WriteLine(txt);
            sw.Close();
            sw2.Close();
            sw1.Close();
            MessageBox.Show("生成成功本次添加了" + cont.ToString() + "个mod");

            System.Diagnostics.Process.Start("explorer.exe", path );
            System.Diagnostics.Process.Start("explorer.exe", gamepath+@"\mods\");
            if (cpath != "")
            {
                DialogResult = DialogResult.OK;
                this.Close();
                return;
            }
        }
Пример #4
0
        private void 自动部署文件到应该的地方ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //选择文件夹
            FolderBrowserDialog fb = new FolderBrowserDialog();

            fb.Description = "选择游戏目录(游戏根目录)";
            if (fb.ShowDialog() == DialogResult.OK)
            {
                gamepath = fb.SelectedPath;

                if (!Directory.Exists(gamepath + @"\mods\"))
                {
                    MessageBox.Show("选择的不是根目录,\n根目录下有mods文件夹你的没有\n请重新选择");
                    gamepath = "";
                    return;
                }
            }
            else
            {
                MessageBox.Show("未设置游戏目录不可以-自动生成");
                gamepath = "";
                return;
            }

            StreamWriter sw, sw2, sw1;
            string       path = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            if (cpath != "")
            {
                sw  = new StreamWriter(cpath + @"\Master\modoverrides.lua", false, utf8);
                sw2 = new StreamWriter(gamepath + @"\mods\dedicated_server_mods_setup.lua", false, utf8);
                sw1 = new StreamWriter(cpath + @"\Slave\modoverrides.lua", false, utf8);
            }
            else
            {
                SelectSavePath slp = new SelectSavePath();
                slp.checkfile = @"\Master\modoverrides.lua";

                if (slp.ShowDialog() == DialogResult.OK)
                {
                    path = slp.pathret;
                }
                else
                {
                    MessageBox.Show("请选择目录");
                    return;
                }

                //modoverrides.lua||dedicated_server_mods_setup.lua||ServerModSetup("workshop-365119238")   -- "SmartCrockPot"
                sw  = new StreamWriter(path + @"\Master\modoverrides.lua", false, utf8);
                sw2 = new StreamWriter(gamepath + @"\mods\dedicated_server_mods_setup.lua", false, utf8);
                sw1 = new StreamWriter(path + @"\Slave\modoverrides.lua", false, utf8);
                //  sw.WriteLine("--这个文件请放到我的文档\\klei\\DoNotStarveTogether_EasyConfigOverworld和DoNotStarveTogether_EasyConfigCaves目录中");
            }
            sw.WriteLine("return{");
            sw1.WriteLine("return{");
            string str2 = "";
            string txt  = "";
            int    cont = 0;

            foreach (ListViewItem lvi in listView1.Items)  //选中项遍历
            {
                if (lvi.Checked)
                {
                    str2 = "[\"workshop-" + lvi.Text + "\"] = { enabled = true },	--"+ lvi.SubItems[1].Text;
                    sw.WriteLine(str2);
                    sw1.WriteLine(str2);
                    txt = "ServerModSetup(\"" + lvi.Text + "\")           --" + lvi.SubItems[1].Text;
                    sw2.WriteLine(txt);
                    cont++;
                }
            }

            sw.WriteLine("}");
            sw1.WriteLine("}");
            txt = "--由JV工具生成weibo:" + @"http://weibo.com/findlike";
            sw.WriteLine(txt);
            sw1.WriteLine(txt);
            sw2.WriteLine(txt);
            sw.Close();
            sw2.Close();
            sw1.Close();
            MessageBox.Show("生成成功本次添加了" + cont.ToString() + "个mod");

            System.Diagnostics.Process.Start("explorer.exe", path);
            System.Diagnostics.Process.Start("explorer.exe", gamepath + @"\mods\");
            if (cpath != "")
            {
                DialogResult = DialogResult.OK;
                this.Close();
                return;
            }
        }
Пример #5
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("未启动");
                }

            }
        }
Пример #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            animalskv    = "";
            resourceskv  = "";
            unpreparedkv = "";
            monsterskv   = "";
            misckv       = "";

            GetControls(this.Controls);
            string txt = "";
            string an  = "\r\n animals={\r\n <#k-v>\r\n},";
            string re  = "\r\n resources={\r\n <#k-v>\r\n},";
            string un  = "\r\n unprepared={\r\n <#k-v>\r\n},";
            string mo  = "\r\n monsters={\r\n <#k-v>\r\n},";
            string mi  = "\r\n misc={\r\n <#k-v>\r\n},";

            mi  = mi.Replace("<#k-v>", misckv);
            an  = an.Replace("<#k-v>", animalskv);
            un  = un.Replace("<#k-v>", unpreparedkv);
            mo  = mo.Replace("<#k-v>", monsterskv);
            re  = re.Replace("<#k-v>", resourceskv);
            txt = un + mi + an + re + mo;
            string txtmian = "return { \r\n override_enabled = true,\r\n preset = \"DST_CAVE\"," + txt + "\r\n}\r\n\r\n--生成于,添加洞穴相关选项\r\n--BY JearyVon\r\n--WeiBo:http://weibo.com/findlike \r\n--如有不详细的地方还请告诉我(微博,邮箱都行)";
            string txtcave = "return { \r\n override_enabled = true," + txt + "\r\n}\r\n\r\n--生成于,添加洞穴相关选项\r\n--BY JearyVon\r\n--WeiBo:http://weibo.com/findlike \r\n--如有不详细的地方还请告诉我(微博,邮箱都行)";
            string path    = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            path = path + @"\Klei\DSTTools";
            if (cpath != "")
            {
                if (checkBox1.Checked)
                {
                    try
                    {
                        StreamWriter sw = File.CreateText(cpath + @"\Slave\worldgenoverride.lua");//洞穴
                        sw.Write(txtmian);
                        sw.Close();
                        StreamWriter sw2 = File.CreateText(cpath + @"\Master\worldgenoverride.lua");
                        sw2.Write(txtcave);
                        sw2.Close();
                        DialogResult dr = MessageBox.Show("帮你打开目录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                        if (dr == DialogResult.OK)
                        {
                            System.Diagnostics.Process.Start("explorer.exe", path);
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("保存失败!");
                        throw;
                    }
                }
                else
                {
                    try
                    {
                        StreamWriter sw = File.CreateText(cpath + @"\Master\worldgenoverride.lua");
                        sw.Write(txtcave);
                        sw.Close();
                        MessageBox.Show("生成成功,将为你打开目录");
                        System.Diagnostics.Process.Start("explorer.exe", path);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("保存失败!");
                        throw;
                    }
                }

                DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                if (checkBox1.Checked)
                {
                    try
                    {
                        SelectSavePath slp = new SelectSavePath();
                        slp.checkfile = @"\Master\worldgenoverride.lua";

                        if (slp.ShowDialog() == DialogResult.OK)
                        {
                            path = slp.pathret;
                        }
                        else
                        {
                            MessageBox.Show("请选择目录");
                            return;
                        }

                        StreamWriter sw = File.CreateText(path + @"\Slave\worldgenoverride.lua");
                        sw.Write(txtmian);
                        sw.Close();
                        StreamWriter sw2 = File.CreateText(path + @"\Master\worldgenoverride.lua");
                        sw2.Write(txtcave);
                        sw2.Close();
                        DialogResult dr = MessageBox.Show("帮你打开目录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                        if (dr == DialogResult.OK)
                        {
                            System.Diagnostics.Process.Start("explorer.exe", path);
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("保存失败!");
                        throw;
                    }
                }
                else
                {
                    try
                    {
                        StreamWriter sw = File.CreateText(path + @"\Master\worldgenoverride.lua");
                        sw.Write(txtcave);
                        sw.Close();
                        MessageBox.Show("生成成功,将为你打开目录");
                        System.Diagnostics.Process.Start("explorer.exe", path);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("保存失败!");
                        throw;
                    }
                }
            }
        }
Пример #7
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("未启动");
                }
            }
        }