Esempio n. 1
0
		private void button2_Click(object sender, EventArgs e)
		{
			string pin = textBox_PIN.Text;
			OAuthTokenResponse res = OAuthUtility.GetAccessToken(
				ConsumerKey, ConsumerSecret, oatr.Token, pin);
			string AccessToken = res.Token;
			string AccessTokenSecret = res.TokenSecret;
			textBox_Output.Text += "Accesss Token: " + AccessToken + " Have gotten\r\n";
			textBox_Output.Text += "Accesss Token Secret: " + AccessTokenSecret + " Have gotten\r\n";
			result = new ExtendedOAuthTokens().Create(AccessToken, AccessTokenSecret, "");
			bool error=false;
			int trycount=0;
			do{
				try
				{
					var a = TwitterAccount.VerifyCredentials(result.OAuthTokens).ResponseObject.ScreenName;
					result.UserName = a;
					error = false;
				}
				catch{error = true;}
				finally
				{
					trycount++;
				}
			}
			while(error && trycount < 5);
			if(error)
			{
				MessageBox.Show("Failed to get your account data.please try later.");
				this.Close();
			}
			button3.Enabled = true;
		}
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            string             pin = textBox_PIN.Text;
            OAuthTokenResponse res = OAuthUtility.GetAccessToken(
                ConsumerKey, ConsumerSecret, oatr.Token, pin);
            string AccessToken       = res.Token;
            string AccessTokenSecret = res.TokenSecret;

            textBox_Output.Text += "Accesss Token: " + AccessToken + " Have gotten\r\n";
            textBox_Output.Text += "Accesss Token Secret: " + AccessTokenSecret + " Have gotten\r\n";
            result = new ExtendedOAuthTokens().Create(AccessToken, AccessTokenSecret, "");
            bool error    = false;
            int  trycount = 0;

            do
            {
                try
                {
                    var a = TwitterAccount.VerifyCredentials(result.OAuthTokens).ResponseObject.ScreenName;
                    result.UserName = a;
                    error           = false;
                }
                catch { error = true; }
                finally
                {
                    trycount++;
                }
            }while(error && trycount < 5);
            if (error)
            {
                MessageBox.Show("Failed to get your account data.please try later.");
                this.Close();
            }
            button3.Enabled = true;
        }
Esempio n. 3
0
        public static Dictionary <string, ExtendedOAuthTokens> Read(string path)
        {
            if (!File.Exists(path))
            {
                new FileInfo(path).Directory.Create();
                File.Create(path).Dispose();
            }
            var d    = new Dictionary <string, ExtendedOAuthTokens>();
            var read = Rc.CutString(";", Rc.loadData(path));

            foreach (var s in read)
            {
                var add = new ExtendedOAuthTokens().Create(Rc.CutString(",", s)[1], Rc.CutString(",", s)[2], Rc.CutString(",", s)[0]);
                d[Rc.CutString(",", s)[0]] = add;
            }
            return(d);
        }
Esempio n. 4
0
		public static Dictionary<string, ExtendedOAuthTokens> Read(string path)
		{
			if (!File.Exists(path))
			{
				new FileInfo(path).Directory.Create();
				File.Create(path).Dispose();
			}
			var d = new Dictionary<string, ExtendedOAuthTokens>();
			var read = Rc.CutString(";", Rc.loadData(path));
			foreach (var s in read)
			{
				var add = new ExtendedOAuthTokens().Create(Rc.CutString(",", s)[1], Rc.CutString(",", s)[2], Rc.CutString(",", s)[0]);
				d[Rc.CutString(",", s)[0]] = add;
			}
			return d;
		}