Пример #1
0
 /// <summary>
 /// Parse a query string into a System.Collections.Generic.Dictionary
 /// </summary>
 /// <param name="uri">Uri to parse query string from</param>
 public static Dictionary<string, string> ParseQueryString(this Uri uri)
 {
     WwwFormUrlDecoder decoder = new WwwFormUrlDecoder(uri.Query);
     return decoder.ToDictionary(x => x.Name, x => x.Value);
 }
        internal void HandleUri(Uri uri)
        {
            Dictionary<string, string> query = new Dictionary<string, string>();
            if (uri.Query.Length > 0)
            {
                WwwFormUrlDecoder decoder = new WwwFormUrlDecoder(uri.Query);
                query = decoder.ToDictionary(x => x.Name, x => x.Value);
            }

            switch (uri.Host)
            {
                case "settitle":
                    // I'm not entirely sure if this is applicable
                    // Sets values like title=Confirmations or title=Chat
                    break;
                case "lostauth":
                    LogoutButton_Click(null, null);
                    break;
                case "steamguard":
                    if (query["op"] != "conftag") break;

                    account.GenerateConfirmationQueryParams(async response =>
                    {
                        string[] args = { "window.SGHandler.update('" + response + "', 'ok');" };
                        await ConfirmationWeb.InvokeScriptAsync("eval", args);
                    }, query["arg1"]);

                    break;
                default:
                    Debug.WriteLine("Unhandled uri: " + uri.AbsoluteUri);
                    break;
            }
        }
        private Dictionary<string, string> ParseQueryString(Uri uri)
        {

            WwwFormUrlDecoder decoder = new WwwFormUrlDecoder(uri.Query);
            return decoder.ToDictionary(x => x.Name, x => x.Value);
        }