public void MvnPackage() { try { string path = stb_local_pdir.Text; DirectoryInfo dire = new DirectoryInfo(path); String cmd = string.Format("cd {0} & mvn package --settings {1} -DskipTests", dire.Parent.FullName, stb_maven_xml.Text); CmdResult result = Command.run(cmd); if (result.isFailed()) { errorLabel.Text = "打包失败:" + result.result; run = false; MessageBox.Show(this, errorLabel.Text); } else if (result.isSuccess()) { step = 3; } } catch (Exception ex) { errorLabel.Text = "mvn package 异常:" + ex.Message; run = false; MessageBox.Show(this, errorLabel.Text); } }
public SaveDeckResultEvent(SaveDeckResultEvent other) : this() { result_ = other.result_; deckId_ = other.deckId_; _unknownFields = UnknownFieldSet.Clone(other._unknownFields); }
private void EvaluatorAVH(CmdResult result) { AirFlights afs = new AirFlights(); afs.Load(result.Data); result.Airflights = afs; string resultdate = result.GetAvhdate(); string cmdate = ec.ParentCmdPacket.GetAvhdate(); if (resultdate == cmdate) { if (afs.Count > 5) { CmdPacket c = new CmdPacket("PN", CmdCB, false, new CmdResultEvaluator(EvaluatorAVH), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } } else { result.DiscardResult = true; } }
public virtual CmdResult ShowUsage(string usg) { CmdResult res = Failure("Usage: //" + usg); res.InvalidArgs = true; return(res); }
/// <summary> /// Execute cmd /// </summary> private void ExecuteCmd(string command) { if (!_internalCommand.ProcessInternalCommand(command)) { try { _host.Ui.ShowMsgInStatusBar("Executing...", true); if (_shellCmder != null) { CmdResult cmdResult = _shellCmder.ExecuteCmd("", command, _currentDir, _isWin); //设置当前目录 _currentDir = cmdResult.CurrentDir; //设置提示信息 _consoleBoxCmder.Prompt = _currentDir; _consoleBoxCmder.PrintCommandResult(cmdResult.Result); _host.Ui.ShowMsgInStatusBar("Execute success", false); } } catch (Exception ex) { _consoleBoxCmder.PrintCommandResult("[Error]:" + ex.Message); _host.Ui.ShowMsgInStatusBar("Execute failed", false); } } }
public CmdResult ExecuteXmlCommand(string cmd, object session, OutputDelegate outputDelegate) { outputDelegate = outputDelegate ?? WriteLine; CmdResult res = null; outputDelegate("<xml>"); outputDelegate("<cmdtext>" + cmd + "</cmdtext>"); //strinbg outputDelegate("<output>"); //string try { res = BotClient.ExecuteCommand(cmd, session, outputDelegate, CMDFLAGS.Foregrounded); } finally { string verb = GetType().Name; res = res ?? ACmdResult.Complete(verb, "cannot process " + cmd, false); outputDelegate("\n</output>"); outputDelegate("<message>" + res.Message + "</message>"); //string outputDelegate("<success>" + res.Success + "</success>"); //True/False outputDelegate("<invalidArgs>" + res.InvalidArgs + "</invalidArgs>"); //True/False outputDelegate("<completedSynchronously>" + res.CompletedSynchronously + "</completedSynchronously>"); //True/False outputDelegate("<isCompleted>" + res.IsCompleted + "</isCompleted>"); //True/False outputDelegate("</xml>"); } return(res); }
public override CmdResult ExecuteRequest(CmdRequest args) { if (args.Length < 1) return ShowUsage(); string cmd = args.GetString("command"); //return ClientManager.DoCommandAll() // Make an immutable copy of the Clients dictionary to safely iterate over int[] completed = {0}; var BotClients = ClientManager.BotClients; int count = BotClients.Count; var fromAgentID = args.CallerAgent; if (count == 0) return ClientManager.ExecuteSystemCommand(cmd, fromAgentID, WriteLine, args.CmdFlags); CmdResult[] results = new CmdResult[count]; int[] clientNum = {0}; foreach (BotClient client in BotClients) { clientNum[0]++; ThreadPool.QueueUserWorkItem( (WaitCallback) delegate(object state) { BotClient testClient = (BotClient) state; results[clientNum[0]] = testClient.ExecuteCommand(cmd, fromAgentID, WriteLine, args.CmdFlags); ++completed[0]; }, client); } while (completed[0] < count) Thread.Sleep(50); foreach (var r in results) { if (r != null) return r; } return results[0]; }
private void EvaluatorTeamNM(CmdResult result) { if (Regex.IsMatch(ec.CurrentCmdPacket.CmdString.ToUpper().Trim(), "RT[0-9A-Z]{5}")) { if (Regex.IsMatch(result.Data, @"\sNM([0-9]{1,3})\s")) { result.DiscardResult = true; CmdPacket c = new CmdPacket("RTN", CmdCB, false, new CmdResultEvaluator(EvaluatorTeamNM), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } else { CmdPacket c = new CmdPacket("PAT:A", CmdCB, false, new CmdResultEvaluator(EvaluatorTeamNM), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } } else if (ec.CurrentCmdPacket.CmdString.ToUpper().Trim() == "RTN") { if (Regex.IsMatch(ec.TempResultBuffer + result.Data, @"NM([0-9]{1,3}).*?\1\.")) { CmdPacket c = new CmdPacket("PAT:A", CmdCB, false, new CmdResultEvaluator(EvaluatorTeamNM), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } else { CmdPacket c = new CmdPacket("PN", CmdCB, true, new CmdResultEvaluator(EvaluatorTeamNM), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } } else if (ec.CurrentCmdPacket.CmdString.ToUpper().Trim() == "PN") { if (Regex.IsMatch(ec.TempResultBuffer + result.Data, @"NM([0-9]{1,3}).*?\1\.")) { CmdPacket c = new CmdPacket("PAT:A", CmdCB, false, new CmdResultEvaluator(EvaluatorTeamNM), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } else { ec.CurrentCmdPacket.Repeat = true; } } else if (ec.CurrentCmdPacket.CmdString.ToUpper().Trim() == "PAT:A") { if (!result.Data.ToUpper().Contains("TOTAL:")) { CmdPacket c = new CmdPacket("PAT:", CmdCB, false, new CmdResultEvaluator(EvaluatorTeamNM), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } } }
public void Test() { Cmd cmd = new Cmd(); CmdResult result = cmd.Run("git", "version"); Assert.AreEqual(0, result.ExitCode); Assert.That(result.Output, Is.StringStarting("git version 2.")); }
public static void PrintGuildBattleCmdResult(CmdResult result, ViewModel viewModel) { var status = result.battlestate.status; string history = ""; history += String.Format("{0} (Combo {1})", result.cmd.name, result.history.combo) + Environment.NewLine; viewModel.History = history; }
public void MergeFrom(SelectDeckAndWeaponResultEvent other) { if (other != null) { if (other.Result != 0) { Result = other.Result; } _unknownFields = UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } }
public void MergeFrom(ChangeGodResultEvent other) { if (other != null) { if (other.Result != 0) { Result = other.Result; } _unknownFields = UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } }
/// <summary> /// /// </summary> /// <param name="context_name"></param> /// <param name="stringCodeReader"></param> /// <returns></returns> public override object Read(string context_name, System.IO.TextReader stringCodeReader, OutputDelegate WritResulteLine) { CmdResult res = null; int line = 0; while (stringCodeReader.Peek() != -1) { line++; res = BotClient.ExecuteCommand(stringCodeReader.ReadLine(), context_name, WriteLine, CMDFLAGS.ForceCompletion); } return(res); } // method: Read
public override CmdResult ExecuteRequest(CmdRequest args) { // This is a dummy command. Calls to it should be intercepted and handled specially CmdResult r = Success("This command should not be executed directly"); try { Client.Dispose(); } catch (Exception e0) { } ClientManager.Quit(); return(r); }
// Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250 internal static CmdResult Export(Document document, ref string message, IEnumerable <AssemblyInstance> assemblies, ICamExportIntOptions options, bool variedFormats, out bool bCancelCommand) { bCancelCommand = false; assemblies = ((assemblies != null) ? assemblies.ToList <AssemblyInstance>() : null); bool flag = assemblies == null || assemblies.none <AssemblyInstance>(); CmdResult result; if (flag) { result = CmdResult.Succeeded; } else { IEnumerable <ElementId> assemblyInstanceIds = (from element in assemblies select element.Id).ToList <ElementId>(); bool flag2; CamIntEvents.OnExporting(document, assemblyInstanceIds, options, out flag2); CmdResult cmdResult = CmdResult.Succeeded; bool flag3 = !flag2; if (flag3) { CNCProjectData cncprojectData = CamExporter.GetCNCProjectData(document, options.FileFormat); switch (options.FileFormat) { case FileFormat.Unitechnik52: case FileFormat.Unitechnik60: cmdResult = CamExporter.executeUniCAM(ref message, assemblies, options, cncprojectData, out bCancelCommand); break; case FileFormat.PXML13: cmdResult = CamExporter.executePXML(ref message, assemblies, options, cncprojectData, out bCancelCommand); break; default: throw new InvalidOperationException("Unknown file format for CAM export."); } bool flag4 = cmdResult == CmdResult.Failed; if (flag4) { CamExporter.showError(options.FileFormat); } } CamIntExportStatus status = CamExporter.DetermineStatus(cmdResult, bCancelCommand, flag2); CamIntEvents.OnExported(document, assemblyInstanceIds, options, status); result = cmdResult; } return(result); }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { if (num != 8) { _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); } else { result_ = (CmdResult)input.ReadEnum(); } } }
public void MvnClean() { try { string path = stb_local_pdir.Text; String cmd = "cd " + path + " & mvn clean"; CmdResult result = Command.run(cmd); step = 2; } catch (Exception ex) { errorLabel.Text = "mvn clean 异常:" + ex.Message; run = false; MessageBox.Show(this, errorLabel.Text); } }
public override CmdResult ExecuteRequest(CmdRequest args) { if (args.Length < 1) { return(ShowUsage()); } string cmd = args.GetString("command"); //return ClientManager.DoCommandAll() // Make an immutable copy of the Clients dictionary to safely iterate over int[] completed = { 0 }; var BotClients = ClientManager.BotClients; int count = BotClients.Count; var fromAgentID = args.CallerAgent; if (count == 0) { return(ClientManager.ExecuteSystemCommand(cmd, fromAgentID, WriteLine, args.CmdFlags)); } CmdResult[] results = new CmdResult[count]; int[] clientNum = { 0 }; foreach (BotClient client in BotClients) { clientNum[0]++; ThreadPool.QueueUserWorkItem( (WaitCallback) delegate(object state) { BotClient testClient = (BotClient)state; results[clientNum[0]] = testClient.ExecuteCommand(cmd, fromAgentID, WriteLine, args.CmdFlags); ++completed[0]; }, client); } while (completed[0] < count) { Thread.Sleep(50); } foreach (var r in results) { if (r != null) { return(r); } } return(results[0]); }
/// <summary> /// Log the results of the command execution. /// </summary> /// <param name="result">Result of the command execution.</param> protected void LogResults(CmdResult result) { switch (result) { case CmdResult.Success: // Execution of command succesful. break; case CmdResult.InvalidCommand: Bot.Notice(Message.From.Username, Message.Command + " ei ole validi komento komponentille: " + className); break; default: logToAdmin(); break; } }
/// <summary> /// 创建警报消息 /// </summary> /// <returns></returns> public string Andon_S_CreateAlert() { //data数据 CmdResult data = new CmdResult(); data.cbCode = 0; //head CmdHead head = new CmdHead(); head.wSubID = CmdAndon.Andon_S_CreateAlert; head.dwWorkID = 123456; string serverJsonText = data.GetSendData(head.ToArray(), data.ToArray()); return(serverJsonText); }
public ActionResult LogOn(string token) { if (!string.IsNullOrWhiteSpace(token)) { LoginProfile item = LoginProfile.Parse(token); if (item != null) { LoginApiClient login = new LoginApiClient(); using (login.Wrapper) { UserProfile profile = login.UserProfile(item.Username).ReturnValue?.data; if (item.Username.EqualsIgnoreCaseAndBlank("admin") || profile != null && profile.Authority?.Any(p => p.EqualsIgnoreCaseAndBlank(item.Country)) == true) { CmdResult res = UpdateUsername(item.Username, profile?.UserName).Result; RequestResult <string[]> result = GetAccessableBrands(item.Username); if (!string.IsNullOrWhiteSpace(result.ErrorMessage)) { ModelState.AddModelError("", result.ErrorMessage); } else { FormsAuthenticationHelper.SetAuthCookie(item.Username.Trim(), false, string.Join(",", result.ReturnValue)); return(RedirectToAction("Index", "Home", new { lang = item.Lang })); } } else { ModelState.AddModelError("", $"You are not allowed to visit {item.Country}'s intranet"); } } } else { ModelState.AddModelError("", StringResource.INVALID_USERNAME_OR_PASSWORD); } } Response.Buffer = true; Response.ExpiresAbsolute = DateTime.Now.AddDays(-1); Response.Cache.SetExpires(DateTime.Now.AddDays(-1)); Response.Expires = 0; Response.CacheControl = "no-cache"; Response.Cache.SetNoStore(); return(View()); }
public CmdTVK2() { START = 0; ADDRESS = 0; LENGTH = new byte[2]; EVEN = false; CHECKSUM1 = 0; DATA = new byte[TVK2_DATA_SIZE]; for (int i = 0; i < DATA.Length; i++) { DATA[i] = 0; } CHECKSUM2 = 0; result = CmdResult.BAD_START_BYTE; buf = new byte[TVK2_PACKET_SIZE]; }
private Task <CmdResult> RunWinAppDeployCmdAsync(params string[] arguments) { return(Task.Run(() => { try { var defaultPath = @"C:\Program Files (x86)\Windows Kits\10\bin\x86"; var execName = "WinAppDeployCmd.exe"; var cmdArguments = string.Join(" ", arguments); var proc = new Process { StartInfo = new ProcessStartInfo { FileName = Path.Combine(defaultPath, execName), Arguments = cmdArguments, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true } }; proc.Start(); //proc.WaitForExit(); var result = new CmdResult { //ExitCode = proc.ExitCode, StandarOutput = proc.StandardOutput?.ReadToEnd() ?? string.Empty, ErrorOutput = proc.StandardError?.ReadToEnd() ?? string.Empty }; this.LastCmdRunResukt = result; return result; } catch (Exception ex) { var a = 5; throw; } })); }
public Cmd(int data_size) { START = 0; ADDRESS = 0; LENGTH = new byte[2]; EVEN = false; CHECKSUM1 = 0; DATA = new byte[data_size]; for (int i = 0; i < DATA.Length; i++) { DATA[i] = 0; } CHECKSUM2 = 0; result = CmdResult.BAD_START_BYTE; buf = new byte[MAX_DATA_SIZE]; }
const int MAX_DATA_SIZE = 72; //максимальный размер пакета данных 72 байта (для ЛД 72, МУ ГСП 12...) public Cmd() { START = 0; ADDRESS = 0; LENGTH = new byte[2]; EVEN = false; CHECKSUM1 = 0; DATA = new byte[GSP_DATA_SIZE];//длина пакета исх. данных 10 байт для ГСП for (int i = 0; i < DATA.Length; i++) { DATA[i] = 0; } CHECKSUM2 = 0; result = CmdResult.BAD_START_BYTE; buf = new byte[MAX_DATA_SIZE]; }
// Token: 0x06000002 RID: 2 RVA: 0x00002158 File Offset: 0x00000358 private static CamIntExportStatus DetermineStatus(CmdResult cmdResult, bool bCancelCommand, bool eventCanceled) { CamIntExportStatus result; if (eventCanceled) { result = CamIntExportStatus.EventCanceled; } else if (bCancelCommand) { result = CamIntExportStatus.UserCanceled; } else { bool flag = cmdResult == CmdResult.Cancelled; if (flag) { result = CamIntExportStatus.UserCanceled; } else { bool flag2 = cmdResult == CmdResult.Succeeded; if (flag2) { result = CamIntExportStatus.Success; } else { bool flag3 = cmdResult == CmdResult.Failed; if (flag3) { result = CamIntExportStatus.Failed; } else { ItDebug.assert(false, "Unexpected result of cam export!"); result = CamIntExportStatus.None; } } } } return(result); }
public CmdTVK1() { START = 0; ADDRESS = 0; LENGTH = new byte[2]; EVEN = false; CHECKSUM1 = 0; DATA = new byte[TVK1_DATA_SIZE];//длина пакета данных 18 байт для ТВК1 for (int i = 0; i < DATA.Length; i++) { DATA[i] = 0; } CHECKSUM2 = 0; result = CmdResult.BAD_START_BYTE; buf = new byte[TVK1_PACKET_SIZE]; }
public void MergeFrom(CodedInputStream input) { uint num; while ((num = input.ReadTag()) != 0) { switch (num) { default: _unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8u: result_ = (CmdResult)input.ReadEnum(); break; case 16u: DeckId = input.ReadInt32(); break; } } }
/// <summary> /// 执行cmd /// </summary> private void ExecuteCmd(string command) { if (!_internalCommand.ProcessInternalCommand(command)) { try { if (_shellCmder != null) { CmdResult cmdResult = _shellCmder.ExecuteCmd("", command, _currentDir, _isWin); //设置当前目录 _currentDir = cmdResult.CurrentDir; //设置提示信息 shellTextBox_Cmder.Prompt = _currentDir; shellTextBox_Cmder.PrintCommandResult(cmdResult.Result); } } catch (Exception ex) { shellTextBox_Cmder.PrintCommandResult("[Error]" + ex.Message); } } }
public static CmdResult TTT() { try { using (SqlConnection objConn = new SqlConnection(Cnn)) { SqlCommand cmm = new SqlCommand("[dbo].[XBT_AgentInitialize]", objConn); cmm.CommandType = System.Data.CommandType.StoredProcedure; SqlDataAdapter adapter = new SqlDataAdapter(cmm); DataSet ds = new DataSet(); adapter.Fill(ds); CmdResult result = new CmdResult(ds); _InitDS = ds; return(result); } } catch (Exception ex) { return(new CmdResult(-1, ex.Message)); } }
private void CmdCB(object sender, CmdResult result) { if (InvokeRequired) { Invoke(new EtermConnection.CmdResultCB(CmdCB), sender, result); return; } richTextBox1.SelectionColor = Color.LimeGreen; richTextBox1.SelectionFont = new Font("宋体", 9); richTextBox1.AppendText("\r\n" + result.Data); this.richTextBox1.Select(this.richTextBox1.TextLength, 0); this.richTextBox1.ScrollToCaret(); richTextBox1.AppendText("\r\n" + (char)9632); if (remotableObject != null) { remotableObject.ResultString = result.Data; remotableObject.Set(); } }
public static CmdResult ExecuteRequestProc(CmdRequest args, Command thizcmd) { var TheBotClient = thizcmd.TheBotClient; OutputDelegate WriteLine = thizcmd.WriteLine; bool thread = args.IsTrue("--thread"); bool queue = args.IsTrue("--queue"); bool all = args.IsTrue("--all"); bool kill = args.IsTrue("--kill"); bool asyc = args.IsTrue("--async") || thread; TimeSpan wait; ManualResetEvent mre = null; if (args.TryGetValue("--wait", out wait)) { mre = new ManualResetEvent(false); } bool newDebug = args.IsTrue("--debug"); bool changeDebug = newDebug || args.IsTrue("--nodebug"); bool createFresh = false; string id = args.Length == 0 ? "list" : GetTaskID(args, out createFresh); id = (id == "list") ? "" : id; int n = 0; int found = 0; if (id == "" || kill || changeDebug) { List<string> list = new List<string>(); lock (TaskQueueHandler.TaskQueueHandlers) { var atq = TheBotClient != null ? TheBotClient.AllTaskQueues() : ClientManager.SingleInstance.AllTaskQueues(); foreach (var queueHandler in atq) { if (!queueHandler.MatchesId(id)) continue; bool isQueue = queueHandler.Impl == queueHandler; if (isQueue) found++; else n++; if (changeDebug) queueHandler.DebugQueue = newDebug; if (queueHandler.IsAlive) { string str = queueHandler.ToDebugString(true); if (kill) { if (!all) { if (!isQueue && !thread || isQueue && !queue) { WriteLine("Not killing " + str); continue; } } queueHandler.Abort(); str = "Killing " + str; thizcmd.IncrResult("killed", 1); } WriteLine(str); } else { list.Add(queueHandler.ToDebugString(true)); } } } foreach (var s in list) { WriteLine(s); } } if (kill && createFresh) { return thizcmd.Failure("Cannot create and kill in the same operation"); } string[] cmdS; args.TryGetValue("command", out cmdS); thizcmd.IncrResult("taskqueues", found); thizcmd.IncrResult("threads", n); if (cmdS == null || cmdS.Length == 0) { return thizcmd.Success("TaskQueueHandlers: " + found + ", threads: " + n); } /// task is killed if request.. now making a new one string cmd = Parser.Rejoin(cmdS, 0); bool needResult = mre != null; CmdResult[] result = null; if (createFresh) needResult = false; if (needResult) { result = new CmdResult[1]; } CMDFLAGS flags = needResult ? CMDFLAGS.ForceResult : CMDFLAGS.Inherit; if (asyc) flags |= CMDFLAGS.ForceAsync; ThreadStart task = () => { try { var res = TheBotClient.ExecuteCommand(cmd, args.CallerAgent, args.Output, flags); if (result != null) result[0] = res; } catch (Exception) { throw; } }; string message = TheBotClient.CreateTask(id, task, cmd, createFresh, false, mre, WriteLine); thizcmd.SetResult("taskid", id); if (mre != null) { if (!mre.WaitOne(wait)) return thizcmd.Failure("Timeout: " + message); if (result == null) return thizcmd.Success(message); return result[0] ?? thizcmd.Success(message); } return thizcmd.Success(message); }
private void ec_OnReadPacket(object sender, CmdResult result) { //LogManager.Instance.Log.Info("接收数据: "+result.Data); //MessageBox.Show(result.Data); }
private void EvaluatorTeamNM(CmdResult result) { if (Regex.IsMatch(ec.CurrentCmdPacket.CmdString.ToUpper().Trim(), "RT[0-9A-Z]{5}")) { if (Regex.IsMatch(result.Data, @"\sNM([0-9]{1,3})\s")) { result.DiscardResult = true; CmdPacket c= new CmdPacket("RTN", CmdCB, false, new CmdResultEvaluator(EvaluatorTeamNM), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } else { CmdPacket c= new CmdPacket("PAT:A", CmdCB, false, new CmdResultEvaluator(EvaluatorTeamNM), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } } else if (ec.CurrentCmdPacket.CmdString.ToUpper().Trim() == "RTN") { if (Regex.IsMatch(ec.TempResultBuffer + result.Data, @"NM([0-9]{1,3}).*?\1\.")) { CmdPacket c = new CmdPacket("PAT:A", CmdCB, false, new CmdResultEvaluator(EvaluatorTeamNM), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } else { CmdPacket c = new CmdPacket("PN", CmdCB, true, new CmdResultEvaluator(EvaluatorTeamNM), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } } else if (ec.CurrentCmdPacket.CmdString.ToUpper().Trim() == "PN") { if (Regex.IsMatch(ec.TempResultBuffer + result.Data, @"NM([0-9]{1,3}).*?\1\.")) { CmdPacket c = new CmdPacket("PAT:A", CmdCB, false, new CmdResultEvaluator(EvaluatorTeamNM), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } else { ec.CurrentCmdPacket.Repeat = true; } } else if (ec.CurrentCmdPacket.CmdString.ToUpper().Trim() == "PAT:A") { if (!result.Data.ToUpper().Contains("TOTAL:")) { CmdPacket c = new CmdPacket("PAT:", CmdCB, false, new CmdResultEvaluator(EvaluatorTeamNM), null); c.EcChannel = ec; ec.CurrentCmdPacket.SubCmdPacket = c; } } }
static public CmdResult DoCmdAct(Command command, Func<CmdResult> task, CmdRequest req, string debugStr, CMDFLAGS flags) { BotClient robot = command._mClient; string sync = command.TaskQueueNameOrNull; bool needResult = (flags & CMDFLAGS.ForceResult) != 0; bool isConsole = (flags & CMDFLAGS.IsConsole) != 0; bool forceAsync = (flags & CMDFLAGS.ForceAsync) != 0; bool forceCompletion = (flags & CMDFLAGS.ForceCompletion) != 0; bool inherit = (flags & CMDFLAGS.Inherit) != 0; bool scriptMode = robot != null && robot.InScriptMode; bool cmdRequestsSync = command.ImpliesSync; bool invokeJoin = scriptMode || cmdRequestsSync; if (needResult) { invokeJoin = true; } if (forceCompletion) { forceAsync = false; } if (forceAsync) { sync = null; needResult = false; invokeJoin = false; } if (invokeJoin) { if (!needResult) { } else { if (robot != null) robot.InvokeJoin(debugStr); } } req.CmdFlags |= flags; if (sync != null) { CmdResult[] res = new CmdResult[1]; ManualResetEvent mre = new ManualResetEvent(false); Abortable tq = null; if (robot == null) { tq = Cogbot.ClientManager.OneAtATimeQueue; } else { tq = robot.GetTaskQueueHandler(sync, true); } tq.Enqueue(() => { try { res[0] = task(); } finally { if (needResult) mre.Set(); } }); if (needResult) mre.WaitOne(); return res[0]; } else { return task(); } //robot.OneAtATimeQueue.Enqueue(cmdStr, () => command.acceptInputWrapper(verb, args, callerID, del)); }