// 启动游戏按钮 private void btnCGameStart_Click(object sender, EventArgs e) { ini.rPlayerName = tbCPlayerName.Text; ini.rServerIPNSNet = tbCServerIP.Text; // 判定 DotA 路径设置 if (!File.Exists(ini.lPath + "\\dota.exe")) { setDotA2Path(); } else { CopyFolder cpREVClientPath = new CopyFolder(Application.StartupPath + "\\RtLabs", ini.lPath); File.Delete(ini.lPath + "\\dota\\gameinfo.txt"); try { File.Copy(ini.lPath + "\\dota\\gameinfo-Client.txt", ini.lPath + "\\dota\\gameinfo.txt", true); } catch { // 不抛出任何异常,用来忽略文件正在被使用的问题 } File.Copy(ini.lPath + "\\dota\\cfg\\autoexec_Client.cfg", ini.lPath + "\\dota\\cfg\\autoexec.cfg", true); FileStream fsConnectCfg = new FileStream(ini.lPath + "\\dota\\cfg\\connect.cfg", FileMode.OpenOrCreate); StreamWriter swConnectCfg = new StreamWriter(fsConnectCfg); swConnectCfg.WriteLine("connect " + tbCServerIP.Text + ":" + tbCServerPort.Text); swConnectCfg.Close(); runDota(ini.lPath + "\\revLoader.exe"); } }
// 建立服务器 private void btnSServerHost_Click(object sender, EventArgs e) { initServerCfg(); // 判定 DotA 路径设置 if (!File.Exists(ini.lPath + "\\dota.exe")) { setDotA2Path(); } else { CopyFolder cpREVServerPath = new CopyFolder(Application.StartupPath + "\\RtLabs", ini.lPath); File.Delete(ini.lPath + "\\dota\\gameinfo.txt"); try { File.Copy(ini.lPath + "\\dota\\gameinfo-Server.txt", ini.lPath + "\\dota\\gameinfo.txt", true); } catch { // 不抛出任何异常,用来忽略文件正在被使用的问题 } File.Delete(ini.lPath + "\\dota\\cfg\\autoexec.cfg"); runSrcds(ini.lPath + "\\revLoader.exe"); } }