public static List <SyncFolder> GetFoldersNoWait(this BTSyncClient apiClient) { var foldersTask = apiClient.GetFolders(); foldersTask.Wait(); return(foldersTask.Result); }
public static List <SyncPeer> GetFoldersPeersNoWait(this BTSyncClient apiClient, string secret) { var foldersTask = apiClient.GetFolderPeers(secret); foldersTask.Wait(); return(foldersTask.Result); }
/// <summary> /// Creates new secrets, use for creating new sync directories /// </summary> public void CreateNewSecrets() { BTSyncClient client = Service.CreateApiClient(); var task = client.GenerateSecrets(); task.Wait(); this.ReadWriteSecret = task.Result.ReadWrite; this.ReadOnlySecret = task.Result.ReadOnly; this.EncryptionSecret = task.Result.Encryption; }
public static bool ExistFolder(this BTSyncClient apiClient, string secret) { var folderTask = apiClient.GetFolder(secret); try { folderTask.Wait(); } catch { return(false); } return(true); }
public static bool IsSynched(this BTSyncClient apiClient, string secret, string path) { var peers = apiClient.GetFoldersPeersNoWait(secret); long currentBandwith = 0; if (peers == null) { return(true); } foreach (SyncPeer p in peers) { currentBandwith += p.Upload; currentBandwith += p.Download; } return(currentBandwith == 0); }