public void StartExecuting(ServerSession serverSession) { List <string> stringList = new List <string>(); if (this.m_parameters.Count > 0) { ParameterDialog parameterDialog = new ParameterDialog(this.m_parameters, serverSession); bool? nullable = parameterDialog.ShowDialog(); bool flag = false; if ((nullable.GetValueOrDefault() == flag ? (nullable.HasValue ? 1 : 0) : 0) != 0) { return; } foreach (RconCommandParameter parameter in this.m_parameters) { string s = parameterDialog.ParameterToUserInput[parameter].Text; if (parameter.Quoted) { s = RconCommand.QuoteString(s); } stringList.Add(s); } } if (!serverSession.SendMessage(string.Format(this.m_messageTemplate, (object[])stringList.ToArray()), true)) { return; } string receivedMessage = ""; serverSession.ReceiveMessage(out receivedMessage, true, true); }
public bool GetData(ServerSession serverSession, out string[] data) { data = new string[0]; string receivedMessage = ""; if (!serverSession.SendMessage(this.m_messageTemplate, true) || !serverSession.ReceiveMessage(out receivedMessage, true, false)) { return(false); } if (this.IsArray) { string[] strArray = Regex.Split(receivedMessage, "\t"); int count = int.Parse(strArray[0]); data = ((IEnumerable <string>)strArray).Skip <string>(1).Take <string>(count).ToArray <string>(); } else { data = new string[1] { receivedMessage } }; return(true); }