public static Command Create(string str) { Command command = null; if (!string.IsNullOrEmpty(str)) { int indexCmd = str.IndexOf("("); string commandName = str.Substring(0, indexCmd); int indexPmrs = str.LastIndexOf(")"); string allParameters = str.Substring(indexCmd + 1, indexPmrs - indexCmd - 1); string[] pmrs = null; if (!string.IsNullOrEmpty(allParameters)) { pmrs = commandName == "s" ? pmrs = new string[] { allParameters } // String transfer command "s" always has only one parameter : allParameters.Split(new char[] { ',' }); } int uniqueCounter = -1; if (!int.TryParse(str.Substring(indexPmrs + 1, str.Length - indexPmrs - 1), out uniqueCounter)) uniqueCounter = -1; command = new Command(commandName, pmrs, uniqueCounter); } return command; }
private void skype_MessageStatus(ChatMessage message, TChatMessageStatus status) { if (status == TChatMessageStatus.cmsReceived) { // Get commands as text messages from User Skype Driver SkypeAutoHelper.Command command = SkypeAutoHelper.Command.Create(message.Body); switch (command.Name) { case "screenbounds": UserData.Instance.ScreenBounds = new Size(int.Parse(command.Params[0]), int.Parse(command.Params[1])); break; } SkypeAutomation.SkypeObj.ClearChatHistory(); } }
private void skype_MessageStatus(ChatMessage message, TChatMessageStatus status) { if (status == TChatMessageStatus.cmsReceived) { try { SkypeAutoHelper.Command command = SkypeAutoHelper.Command.Create(message.Body); if (command != null && command.UniqueCounter != uniqueMsgCount) { uniqueMsgCount = command.UniqueCounter; Do(command.Name, command.Params); } } catch (Exception e) { } SkypeAutomation.SkypeObj.ClearChatHistory(); } }