Exemple #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            KuaiPan sdk = new KuaiPan();
            string url = sdk.GetAuthorizationUrl();

            Session["oauth_token"] = sdk.Token;
            Session["oauth_token_secret"] = sdk.TokenSecret;

            Response.Redirect(url);
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            KuaiPan sdk = new KuaiPan();
            sdk.Token = Session["oauth_token"].ToString();
            sdk.TokenSecret = Session["oauth_token_secret"].ToString();

            string oauth_verifier = Request.QueryString["oauth_verifier"];
            string oauth_token = Request.QueryString["oauth_token"];
            sdk.Token = Request.QueryString["oauth_token"];
            if (sdk.GetAccessToken())
            {
                Session["oauth_token"] = sdk.Token;
                Session["oauth_token_secret"] = sdk.TokenSecret;
                Response.Redirect("Demo.aspx");
            }
            else
            {
                Response.Write(sdk.ErrMsg);
            }
        }
Exemple #3
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="sdk"></param>
 public OAuth(KuaiPan sdk)
 {
     this.SDK = sdk;
     this._nonce = OAuth.GetOAuthNonce();
     this._timeStamp = OAuth.GetTimeStamp();
 }
Exemple #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.listView.SmallImageList = sysIcons.ImageList;
            this.treeView.ImageList = sysIcons.ImageList;

            this.listView.Columns.Add("columnsName", "名称", 200);
            this.listView.Columns.Add("columnsSize", "大小", 80);
            this.listView.Columns.Add("columnsType", "类型", 120);
            this.listView.Columns.Add("columnsMax", "修改日期", 120);
            bool isneed = true;
            //556a38e8908d480b89f7a3904b36b62e|0a2a7b443ffb4e4ab7b1575829128cd6
            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "config.txt"))
            {
                StreamReader sr = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + "config.txt", System.Text.Encoding.UTF8);
                string str = sr.ReadToEnd();
                if (str.IndexOf("|") > 10)
                {
                    string[] s = str.Split('|');
                    this.SDK = new KuaiPan(s[0], s[1]);
                    isneed = false;
                }
                sr.Close();
            }

            if (isneed)
            {
                this.SDK = new KuaiPan();
                string url = this.SDK.GetAuthorizationUrl();

                Process proc = Process.Start("iexplore.exe", url);
                if (proc != null)
                {
                    MessageBox.Show("授权完请关闭浏览器", "授权提示");
                    proc.WaitForExit();
                }
                if (!this.SDK.GetAccessToken())
                {
                    MessageBox.Show("授权完请关闭浏览器", "授权失败");
                    Application.Exit();
                }
                StreamWriter sw = new System.IO.StreamWriter(AppDomain.CurrentDomain.BaseDirectory + "config.txt", false, new System.Text.UTF8Encoding(false));
                sw.Write(this.SDK.Token + "|" + this.SDK.TokenSecret);
                sw.Close();
            }

            Thread a = new Thread(delegate()
            {
                this.SetAccountInfo();
                this.BeginInvoke(new BeginInvokeDelegate(delegate()
                {
                    this.LoadTree();
                }));
            });
            a.Start();
        }
Exemple #5
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="sdk"></param>
 public OAuth(KuaiPan sdk)
 {
     this.SDK        = sdk;
     this._nonce     = OAuth.GetOAuthNonce();
     this._timeStamp = OAuth.GetTimeStamp();
 }
Exemple #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //sdk = new KuaiPan(Session["oauth_token"].ToString(), Session["oauth_token_secret"].ToString());
     sdk = new KuaiPan("556a38e8908d480b89f7a3904b36b62e", "0a2a7b443ffb4e4ab7b1575829128cd6");
 }
Exemple #7
0
 public KuaiPan()
 {
     sdk = new KuaiPanSDK.KuaiPan("xcRYiOnHwra5Lb5o", "l5sS04iA862dm00u", "0059a7586c815f96a1f8aedd", "b5ffa76e063b4ff58e41e7843feab2ed");
 }