public static CordovaCommandCall Parse(string commandStr)
{
if (string.IsNullOrEmpty(commandStr))
{
return null;
//throw new ArgumentNullException("commandStr");
}
string[] split = commandStr.Split('/');
if (split.Length < 3)
{
return null;
}
CordovaCommandCall commandCallParameters = new CordovaCommandCall();
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;
}