public static YebobCommandCall Parse(string commandStr) { if (string.IsNullOrEmpty(commandStr)) { return(null); //throw new ArgumentNullException("commandStr"); } string[] split = commandStr.Split('/'); if (split.Length < 3) { return(null); } YebobCommandCall commandCallParameters = new YebobCommandCall(); commandCallParameters.Service = split[0]; commandCallParameters.Action = split[1]; commandCallParameters.CallbackId = split[2]; commandCallParameters.Args = split.Length <= 3 ? String.Empty : String.Join("/", split.Skip(3)); // sanity check for illegal names // was failing with :: // CordovaCommandResult :: 1, Device1, {"status":1,"message":"{\"name\":\"XD..... if (commandCallParameters.Service.IndexOfAny(new char[] { '@', ':', ',', '!', ' ' }) > -1) { return(null); } return(commandCallParameters); }
public static YebobCommandCall Parse(string commandStr) { if (string.IsNullOrEmpty(commandStr)) { return null; //throw new ArgumentNullException("commandStr"); } string[] split = commandStr.Split('/'); if (split.Length < 3) { return null; } YebobCommandCall commandCallParameters = new YebobCommandCall(); commandCallParameters.Service = split[0]; commandCallParameters.Action = split[1]; commandCallParameters.CallbackId = split[2]; commandCallParameters.Args = split.Length <= 3 ? String.Empty : String.Join("/", split.Skip(3)); // sanity check for illegal names // was failing with :: // CordovaCommandResult :: 1, Device1, {"status":1,"message":"{\"name\":\"XD..... if (commandCallParameters.Service.IndexOfAny(new char[] { '@', ':', ',', '!', ' ' }) > -1) { return null; } return commandCallParameters; }
public void ProcessCommand(YebobCommandCall commandCallParams) { if (commandCallParams == null) { throw new ArgumentNullException("commandCallParams"); } }
void YebobBrowser_ScriptNotify(object sender, NotifyEventArgs e) { string commandStr = e.Value; if (commandStr.IndexOf("Orientation") == 0) { this.orientationHelper.HandleCommand(commandStr); return; } YebobCommandCall commandCallParams = YebobCommandCall.Parse(commandStr); if (commandCallParams == null) { // ERROR Debug.WriteLine("ScriptNotify :: " + commandStr); } else { this.nativeExecution.ProcessCommand(commandCallParams); } }