public async Task <bool> AddTask(NewDownloadModels newDownloadModels) { ISynologyConnection syno = _scope.ServiceProvider.GetService <ISynologyConnection>(); if (!string.IsNullOrEmpty(newDownloadModels.Uri)) { TaskCreateParameters request = new TaskCreateParameters() { Destination = newDownloadModels.Destination, Password = newDownloadModels.Password, UnzipPassword = newDownloadModels.UnzipPassword, Username = newDownloadModels.Username, File = newDownloadModels.Uri, }; ResultData result = await syno.DownloadStation().Task().CreateAsync(request); return(result.Success); } else { var result = await syno.DownloadStation().Task().CreatePostAsync(new TaskCreateParametersPost { Filename = newDownloadModels.File, Destination = newDownloadModels.Destination, File = new byte[0], }); } return(false); }
public async Task <bool> ResumeTask(string ID) { ISynologyConnection syno = _scope.ServiceProvider.GetService <ISynologyConnection>(); ResultData <IEnumerable <ITaskMinimalResult> > result = await syno.DownloadStation().Task().ResumeAsync(new[] { ID }); return(result.Success); }
public async Task <ITaskListResult> GetTask() { ISynologyConnection syno = _scope.ServiceProvider.GetService <ISynologyConnection>(); ResultData <ITaskListResult> dsResTasks = await syno.DownloadStation().Task().ListAsync(new TaskListParameters { Additional = TaskDetailsType.Detail | TaskDetailsType.Transfer | TaskDetailsType.File | TaskDetailsType.Tracker | TaskDetailsType.Peer }); return(dsResTasks.Data); }
public async Task <IStatisticResult> GetCurrentSpeed() { ISynologyConnection syno = _scope.ServiceProvider.GetService <ISynologyConnection>(); var result = await syno.DownloadStation().Statistic().InfoAsync(); if (result.Success) { return(result.Data); } else { return(null); } }
public async Task <IConfigResult> GetSettings() { ISynologyConnection syno = _scope.ServiceProvider.GetService <ISynologyConnection>(); ResultData <IConfigResult> result = (await syno.DownloadStation().Info().ConfigAsync()); if (result.Success) { return(result.Data); } else { return(null); } }
public async Task <bool> SetSettings(IConfigResult config) { ISynologyConnection syno = _scope.ServiceProvider.GetService <ISynologyConnection>(); ResultData result = (await syno.DownloadStation().Info().SetConfigAsync(new Synology.DownloadStation.Info.Parameters.SetConfigParameters { KbpsTorrentMaxDownload = config.TorrentMaxDownload, KbpsTorrentMaxUpload = config.TorrentMaxUpload, KbpsEmuleMaxDownload = config.EmuleMaxDownload, KbpsEmuleMaxUpload = config.EmuleMaxUpload, KbpsNzbMaxDownload = config.NzbMaxDownload, KbpsHttpMaxDownload = config.HttpMaxDownload, KbpsFtpMaxDownload = config.FtpMaxDownload, EmuleEnabled = config.EmuleEnabled, UnzipEnabled = config.UnzipServiceEnabled, DefaultDestination = config.DefaultDestination, EmuleDefaultDestination = config.EmuleDefaultDestination } )); return(result.Success); }