public ServConfig(object caller, object mon) { InitializeComponent(); this.caller = (Manager)caller; this.mon = (SrcdsMonitor)mon; autoStart.Checked = this.mon.isAutoStart; this.Text = this.mon.getName() + " - Configuration"; addr.Text = this.mon.getAddr(); parms.Text = this.mon.getCmd(); executable.Text = this.mon.getExe(); name.Text = this.mon.getName(); port.Text = this.mon.getPort(); maxplayers.Text = this.mon.getMaxplayers(true); //There has GOT to be a better way of doing this... cpuList.Add(cpu1); cpuList.Add(cpu2); cpuList.Add(cpu3); cpuList.Add(cpu4); cpuList.Add(cpu5); cpuList.Add(cpu6); cpuList.Add(cpu7); cpuList.Add(cpu8); cpuList.Add(cpu9); cpuList.Add(cpu10); cpuList.Add(cpu12); cpuList.Add(cpu13); cpuList.Add(cpu14); cpuList.Add(cpu15); cpuList.Add(cpu16); foreach (CheckBox box in cpuList) { box.CheckStateChanged += new EventHandler(cpu_CheckedChanged); } for (int c = 0; c < Environment.ProcessorCount; c++) { cpuList[c].Visible = true; } if (this.mon.AffinityMask != new String('1', Environment.ProcessorCount)) { cpuAll.Checked = false; for (int c = 0; c < Environment.ProcessorCount; c++) { if (this.mon.AffinityMask[c] == '1') { cpuList[c].Checked = true; } else { cpuList[c].Checked = false; } } } }
public NewServer(object sender) { InitializeComponent(); this.sender = (Manager)sender; cpuList.Add(cpu1); cpuList.Add(cpu2); cpuList.Add(cpu3); cpuList.Add(cpu4); cpuList.Add(cpu5); cpuList.Add(cpu6); cpuList.Add(cpu7); cpuList.Add(cpu8); cpuList.Add(cpu9); cpuList.Add(cpu10); cpuList.Add(cpu12); cpuList.Add(cpu13); cpuList.Add(cpu14); cpuList.Add(cpu15); cpuList.Add(cpu16); foreach (CheckBox box in cpuList) { box.CheckStateChanged += new EventHandler(cpu_CheckedChanged); } for (int c = 0; c < Environment.ProcessorCount; c++) { cpuList[c].Visible = true; } Random rand = new Random((int)DateTime.Now.Ticks); StringBuilder str = new StringBuilder(); char ch; for (int i = 0; i < 6; i++) { ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * rand.NextDouble() + 65))); str.Append(ch); } str.Append('-'); for (int i = 0; i < 8; i++) { ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * rand.NextDouble() + 65))); str.Append(ch); } servID.Text = str.ToString(); servID.ReadOnly = true; }
public SrcdsMonitor(String exePath, String game, String commandLine, String Name, String sID, String ipAddr, String port, String maxplayers, String AffinityMask, object caller) { this.exePath = exePath; this.commandLine = commandLine; this.Name = Name; this.sID = sID; this.game = game; this.AffinityMask = AffinityMask; startInfo = new ProcessStartInfo(); startInfo.FileName = exePath; if (ipAddr == "0.0.0.0") { IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); foreach (IPAddress addr in host.AddressList) { if (addr.AddressFamily == AddressFamily.InterNetwork) { this.ipAddr = addr; break; } } } else { this.ipAddr = IPAddress.Parse(ipAddr); } this.port = int.Parse(port); this.maxplayers = int.Parse(maxplayers); proc.StartInfo = startInfo; this.caller = (Manager)caller; pinger = new SrcdsPinger(this, this.ipAddr, this.port, proc); }
public UnknownApp(object sender) { InitializeComponent(); this.sender = (Manager)sender; }
public void Exited(object caller) { caller = null; if (cleanExit != true) { pinger.Dispose(); Crashed(); } }