public static bool SendControlsSeq(IPCManager ipcManager, string address, bool useControlDelay) { int fails = 0; string codeControl; while (address.Length > 0) { codeControl = GetNextTokenMove(ref address, ":"); if (codeControl != null) { if (!ipcManager.SendControl(codeControl)) { fails++; } if (PeekNextDelim(address, ":") && useControlDelay) { Thread.Sleep(AppSettings.controlDelay); } } } return(fails == 0); }
public static bool SendControls(IPCManager ipcManager, string address, bool useControlDelay) { if (!address.Contains("=") && address.Contains(":") && rxControlSeq.IsMatch(address)) { return(SendControlsSeq(ipcManager, address, useControlDelay)); } else if (!address.Contains("=") && !address.Contains(":")) { return(ipcManager.SendControl(address)); } int fails = 0; string codeControl; string codeParam; while (address.Length > 0) { codeControl = GetNextTokenMove(ref address, "="); if (address.Length == 0) { if (!ipcManager.SendControl(codeControl)) { fails++; } } while (address.Length > 0 && !PeekNextDelim(address, "=")) { codeParam = GetNextTokenMove(ref address, ":"); if (!ipcManager.SendControl(codeControl, codeParam)) { fails++; } if (useControlDelay) { Thread.Sleep(AppSettings.controlDelay); } } } return(fails == 0); }