private async void SearchAction() { Uploaders.Clear(); _service = _container.Resolve <IYoutubeChannelService>(); _service.Query = SearchQuery; MoreAction(); }
public UploaderParams(IStorage storage) { Storage = storage; UploadersList = Uploaders.GetUploaders(storage).ToArray(); SelectedUploader = UploadersList.GetByIdOrDefault(Storage.Get <string>(KeySelectedUploader)) ?? UploadersList.First(); }
/// <summary> /// Dispose pattern. /// </summary> /// <param name="isDisposing">Invoked from the dispose method.</param> protected virtual void Dispose(bool isDisposing) { if (Uploaders != null) { Uploaders.Dispose(); Uploaders = null; } }
private async void MoreAction() { if (_service == null) { return; } var next = await _service.FetchNextAsync(); Uploaders.AddRange(next); }
/// <summary> /// データをアップロードします /// </summary> /// <param name="loader">アップロード先のローダー</param> /// <param name="s">アップロードするStream</param> /// <returns>アップロードしたデータに関連付けられたDictionary<string,string></returns> public Dictionary <string, string> UploadData(Uploaders loader, Stream s) { MemoryStream ms = new MemoryStream(); s.CopyTo(ms); var data = this.UploadData(loader, ms.ToArray()); s.Dispose(); ms.Dispose(); return(data); }
private void AddUploader(Uploader uploader) { var typeName = uploader.GetType().Name; if (!UploaderSettings.UploadersInfo.TryGetValue(typeName, out var uploaderInfo)) { UploaderSettings.UploadersInfo.TryAdd(typeName, uploader.Info); uploaderInfo = uploader.Info; } uploader.Info = uploaderInfo; Uploaders.Add(uploader); }
/// <summary> /// データをアップロードします /// </summary> /// <param name="loader">アップロード先のローダー</param> /// <param name="bytes">アップロードするbyte配列</param> /// <returns>アップロードしたデータに関連付けられたDictionary<string,string></returns> public Dictionary <string, string> UploadData(Uploaders loader, byte[] bytes) { switch (loader) { case Uploaders.Imgur: ImgurService ism = new ImgurService(bytes); return(ism.UploadImage()); case Uploaders.Axfc: throw new NotImplementedException(); default: break; } throw new NotSupportedException(); }
/// <summary> /// Configure uploads /// </summary> /// <param name="oneTrueHost">Host. Host and absolute path to the onetrueerror directory</param> /// <param name="appKey">Appkey from the web site</param> /// <param name="sharedSecret">Shared secret from the web site</param> public void Credentials(Uri oneTrueHost, string appKey, string sharedSecret) { if (oneTrueHost == null) { throw new ArgumentNullException("oneTrueHost"); } if (appKey == null) { throw new ArgumentNullException("appKey"); } if (sharedSecret == null) { throw new ArgumentNullException("sharedSecret"); } Uploaders.Register(new UploadToOneTrueError(oneTrueHost, appKey, sharedSecret)); }
private async void ExecuteSeachUploader() { try { Uploaders.Clear(); _service = _container.Resolve <IYoutubeChannelService>(); _service.Query = UploaderSearchQuery; MoreAction(); } catch (Exception e) { //TODO: log _logger.Log(e.Message, Category.Exception, Priority.High); MessageBox.Show("Error occured during search"); } }
private async void MoreAction() { try { if (_service == null) { return; } var next = await _service.FetchNextAsync(); Uploaders.AddRange(next); } catch (Exception e) { _logger.Log(e.Message, Category.Exception, Priority.High); MessageBox.Show("Error occured during search"); } }
/// <summary> /// アップロードのログを書き込みます /// </summary> /// <param name="loader">使用したローダー</param> /// <param name="dic">書き込むデータ</param> public void WriteUploadLog(Uploaders loader, Dictionary <string, string> dic) { switch (loader) { case Uploaders.Imgur: dic.Add("Uploader", "Imgur"); dic.Add("Downpass", "N/A"); dic.Add("Time", DateTime.Now.ToString()); break; case Uploaders.Axfc: dic.Add("Uploader", "Axfc"); dic.Add("Time", DateTime.Now.ToString()); break; default: throw new ArgumentException(); } string writeData = String.Format("{0}<>{1}<>{2}<>{3}<>{4}\r\n", dic["Link"], dic["Uploader"], dic["Downpass"], dic["Delete"], dic["Time"]); File.AppendAllText(gs.OtherFolderPath + "\\upload.txt", writeData); }
/// <summary> /// Configure uploads /// </summary> /// <param name="coderrServerAddress">Host. Host and absolute path to the codeRR server</param> /// <param name="appKey">Appkey from the web site</param> /// <param name="sharedSecret">Shared secret from the web site</param> public void Credentials(Uri coderrServerAddress, string appKey, string sharedSecret) { if (coderrServerAddress == null) { throw new ArgumentNullException(nameof(coderrServerAddress)); } if (appKey == null) { throw new ArgumentNullException(nameof(appKey)); } if (sharedSecret == null) { throw new ArgumentNullException(nameof(sharedSecret)); } if (ApplicationVersion == null) { AssignAssemblyVersion(Assembly.GetCallingAssembly()); } Uploaders.Register(new UploadToCoderr(coderrServerAddress, appKey, sharedSecret)); }
/// <summary> /// データをアップロードします /// </summary> /// <param name="loader">アップロード先のローダー</param> /// <param name="path">アップロードするファイルのパス</param> /// <returns>アップロードしたデータに関連付けられたDictionary<string,string></returns> public Dictionary <string, string> UploadData(Uploaders loader, string path) { return(this.UploadData(loader, File.ReadAllBytes(path))); }