public DropboxFilesForm(OAuth2Info oauth, string path, DropboxAccountInfo accountInfo) { InitializeComponent(); Icon = Resources.Dropbox; dropbox = new Dropbox(oauth); dropboxAccountInfo = accountInfo; ilm = new ImageListManager(lvDropboxFiles); if (path != null) { Shown += (sender, e) => OpenDirectory(path); } }
/* OAuth 1.0 * // https://www.dropbox.com/developers/core/docs#request-token * // https://www.dropbox.com/developers/core/docs#authorize * public string GetAuthorizationURL() * { * return GetAuthorizationURL(URLAPI + "/oauth/request_token", URLWEB + "/oauth/authorize", AuthInfo); * } * * // https://www.dropbox.com/developers/core/docs#access-token * public bool GetAccessToken(string verificationCode = null) * { * AuthInfo.AuthVerifier = verificationCode; * return GetAccessToken(URLAPI + "/oauth/access_token", AuthInfo); * } */ #region Dropbox accounts // https://www.dropbox.com/developers/core/docs#account-info public DropboxAccountInfo GetAccountInfo() { DropboxAccountInfo account = null; if (OAuth2Info.CheckOAuth(AuthInfo)) { string response = SendRequest(HttpMethod.GET, URLAccountInfo, headers: GetAuthHeaders()); if (!string.IsNullOrEmpty(response)) { account = JsonConvert.DeserializeObject <DropboxAccountInfo>(response); if (account != null) { AccountInfo = account; } } } return(account); }
public Dropbox(OAuth2Info oauth, DropboxAccountInfo accountInfo) : this(oauth) { AccountInfo = accountInfo; }