public static DialLaunchArguments Parse(string arguments)
        {
            try
            {
                DialLaunchArguments dialLaunchArgs = new DialLaunchArguments();

                string[] argswithkeys = arguments.Split('&');

                foreach (string currentArgWithKey in argswithkeys)
                {
                    string key = currentArgWithKey.Split('=')[0];
                    string val = currentArgWithKey.Split('=')[1];
                    switch (key)
                    {
                        case "v": { dialLaunchArgs.VideoId = val; break; }
                        case "t": { dialLaunchArgs.Position = TimeSpan.FromTicks(long.Parse(val)); break; }
                        case "pairingCode": { dialLaunchArgs.PairingCode = val; break; }
                    }
                }
                return dialLaunchArgs;
            }
            catch (Exception ex){
                throw new ArgumentOutOfRangeException(string.Format("Failed to parse DIAL launch arguments: '{0}'", arguments), ex);
                }
        }
Ejemplo n.º 2
0
        public static DialLaunchArguments Parse(string arguments)
        {
            try
            {
                DialLaunchArguments dialLaunchArgs = new DialLaunchArguments();

                string[] argswithkeys = arguments.Split('&');

                foreach (string currentArgWithKey in argswithkeys)
                {
                    string key = currentArgWithKey.Split('=')[0];
                    string val = currentArgWithKey.Split('=')[1];
                    switch (key)
                    {
                    case "v": { dialLaunchArgs.VideoId = val; break; }

                    case "t": { dialLaunchArgs.Position = TimeSpan.FromTicks(long.Parse(val)); break; }

                    case "pairingCode": { dialLaunchArgs.PairingCode = val; break; }
                    }
                }
                return(dialLaunchArgs);
            }
            catch (Exception ex) {
                throw new ArgumentOutOfRangeException(string.Format("Failed to parse DIAL launch arguments: '{0}'", arguments), ex);
            }
        }