Esempio n. 1
0
		public NoiseEmailHostFilter (TokenStream input, bool tokenize_email_hostname, LinkCallback link_call_back)
			: base (input)
		{
			this.token_stream = input;
			this.tokenize_email_hostname = tokenize_email_hostname;
			this.link_call_back = link_call_back;
		}
Esempio n. 2
0
 public NoiseEmailHostFilter(TokenStream input, bool tokenize_email_hostname, LinkCallback link_call_back)
     : base(input)
 {
     this.token_stream            = input;
     this.tokenize_email_hostname = tokenize_email_hostname;
     this.link_call_back          = link_call_back;
 }
Esempio n. 3
0
        public void LinkResult(IAsyncResult ar)
        {
            AsyncResult  aRes = (AsyncResult)ar;
            LinkCallback el   = (LinkCallback)aRes.AsyncDelegate;

            el.EndInvoke(ar);
            ControlEnabler(false);
        }
Esempio n. 4
0
        private void Start_Click(object sender, System.EventArgs e)
        {
            StopThread = false;
            AsyncCallback cb  = new AsyncCallback(this.LinkResult);
            LinkCallback  lcb = new LinkCallback(this.Link);

            ControlEnabler(true);
            lcb.BeginInvoke(cb, this);
        }
Esempio n. 5
0
 public static extern void gambatte_setlinkcallback(IntPtr core, LinkCallback callback);
Esempio n. 6
0
        public void AddAuthenticator(IWebRequest web, LinkCallback callback)
        {
            HasPhoneCallback hasPhoneCallback = hasPhone =>
            {
                if (hasPhone == PhoneStatus.FamilyView)
                {
                    callback(LinkResult.FamilyViewEnabled);
                    return;
                }
                bool settingNumber = !string.IsNullOrEmpty(this.PhoneNumber);
                if (hasPhone == PhoneStatus.Attached && settingNumber)
                {
                    callback(LinkResult.MustRemovePhoneNumber);
                    return;
                }
                if (hasPhone == PhoneStatus.Detatched && !settingNumber)
                {
                    callback(LinkResult.MustProvidePhoneNumber);
                    return;
                }

                BCallback numberAddedCallback = numberAdded =>
                {
                    if (!numberAdded)
                    {
                        callback(LinkResult.GeneralFailure);
                        return;
                    }

                    var postData = new Dictionary <string, string>();
                    postData["access_token"]       = this.session.OAuthToken;
                    postData["steamid"]            = this.session.SteamID.ToString();
                    postData["authenticator_type"] = "1";
                    postData["device_identifier"]  = this.DeviceID;
                    postData["sms_phone_id"]       = "1";

                    web.MobileLoginRequest(ApiEndpoints.STEAMAPI_BASE + "/ITwoFactorService/AddAuthenticator/v0001", "POST", postData, (response, code) =>
                    {
                        if (response == null || code != HttpStatusCode.OK)
                        {
                            callback(LinkResult.GeneralFailure);
                            return;
                        }

                        var addAuthenticatorResponse = JsonConvert.DeserializeObject <WebResponse <SteamGuardAccount> >(response);
                        if (addAuthenticatorResponse?.Response == null)
                        {
                            callback(LinkResult.GeneralFailure);
                            return;
                        }

                        if (addAuthenticatorResponse.Response.Status == 29)
                        {
                            callback(LinkResult.AuthenticatorPresent);
                            return;
                        }

                        if (addAuthenticatorResponse.Response.Status != 1)
                        {
                            callback(LinkResult.GeneralFailure);
                            return;
                        }

                        this.LinkedAccount = addAuthenticatorResponse.Response;
                        // Force not enrolled at this stage
                        this.LinkedAccount.FullyEnrolled = false;
                        this.LinkedAccount.Session       = this.session;
                        this.LinkedAccount.DeviceID      = this.DeviceID;

                        callback(LinkResult.AwaitingFinalization);
                    });
                };

                if (hasPhone == PhoneStatus.Detatched)
                {
                    this._addPhoneNumber(web, numberAddedCallback);
                }
                else
                {
                    numberAddedCallback(true);
                }
            };

            if (string.IsNullOrEmpty(this.Pin))
            {
                this._hasPhoneAttached(web, hasPhoneCallback);
            }
            else
            {
                this.UnlockFamilyView(web, success =>
                {
                    if (success)
                    {
                        this._hasPhoneAttached(web, hasPhoneCallback);
                    }
                    else
                    {
                        callback(LinkResult.FamilyViewEnabled);
                    }
                });
            }
        }