/// <summary> /// Connect Waveface to Dropbox /// </summary> /// <param name="quota"></param> /// <exception cref="Wammer.Station.Management.DropboxNoSyncFolderException"> /// Dropbox sync folder does not exist /// </exception> /// <exception cref="Wammer.Station.Management.WrongAccountException"> /// Link to inconsistent Dropbox account /// </exception> /// <exception cref="Wammer.Station.Management.DropboxNotInstalledException"> /// Dropbox is not installed /// </exception> public static void ConnectDropbox(long quota) { try { if (!DropboxHelper.IsInstalled()) { throw new DropboxNotInstalledException("Dropbox is not installed"); } string folder = DropboxHelper.GetSyncFolder(); CloudResponse res = CloudServer.request <CloudResponse>( new WebClient(), StationMgmtURL + "cloudstorage/dropbox/connect", new Dictionary <object, object> { { "quota", quota }, { "folder", folder } }, true ); } catch (Cloud.WammerCloudException e) { ExtractApiRetMsg(e); throw; } }
/// <summary> /// Update Dropbox quota for Waveface /// </summary> /// <param name="quota"></param> /// <exception cref="Wammer.Station.Management.DropboxNotConnectedException"> /// Waveface has not connected to Dropbox /// </exception> /// <exception cref="Wammer.Station.Management.DropboxNotInstalledException"> /// Dropbox is not installed /// </exception> public static void UpdateDropbox(long quota) { try { if (!DropboxHelper.IsInstalled()) { throw new DropboxNotInstalledException("Dropbox is not installed"); } CloudResponse res = CloudServer.request <CloudResponse>( new WebClient(), StationMgmtURL + "cloudstorage/dropbox/update", new Dictionary <object, object> { { "quota", quota } }, true ); } catch (Cloud.WammerCloudException e) { ExtractApiRetMsg(e); throw; } }
/// <summary> /// List all detected cloud storages /// </summary> public static List <StorageStatus> DetectCloudStorage() { List <StorageStatus> cloudstorages = new List <StorageStatus>(); if (DropboxHelper.IsInstalled()) { // currently only support one driver Model.Driver driver = Model.DriverCollection.Instance.FindOne(); Model.CloudStorage cloudstorage = Model.CloudStorageCollection.Instance.FindOne(Query.EQ("Type", "dropbox")); if (cloudstorage != null) { cloudstorages.Add(new StorageStatus { type = "dropbox", connected = true, quota = cloudstorage.Quota, used = new DropboxFileStorage(driver, cloudstorage).GetUsedSize() } ); } else { cloudstorages.Add(new StorageStatus { type = "dropbox", connected = false } ); } } return(cloudstorages); }