private void downloadLink_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(this.urlTextBox.Text) && !string.IsNullOrWhiteSpace(this.directoryTextBox.Text) && Directory.Exists(this.directoryTextBox.Text)) { try { UrlProcessor.ValidateURL(this.urlTextBox.Text, this.playlistButton.Highlight); this.downloadPanel = new DownloadPanel(this); this.downloadPanel.CancelDownload = false; this.downloadManager = new DownloadManager(this.playlistButton.Highlight , this.videoButton.Highlight , this.audioQulityBar.Value , this.videoQulityBar.Value , this.directoryTextBox.Text , this.urlTextBox.Text , downloadPanel); downloadPanel.Swipe(true); this.downloadManager.StartDownloading(); } catch (ArgumentException ae) { string errorLabel = this.playlistButton.Highlight ? GlobalMessages.InvalidPlaylistUrl : GlobalMessages.InvalidVideoUrl; MetroMessageBox.Show(this, ae.Message, errorLabel, MessageBoxButtons.OK, MessageBoxIcon.Error, 180); } catch (Exception) { } } }
IEnumerator DownAssetBundle(DownloadPanel panel) { if (downLoadFiles.Count == 0) { GameObject.Destroy(panel.gameObject); StartCoroutine(UpdateMF()); yield break; } string abName = downLoadFiles.Dequeue(); string url = urlParentPath + abName; string localPath = AbManager.pathResolver.BundleCacheDir + "/" + abName; using (UnityWebRequest request = UnityWebRequest.Get(url)) { request.SendWebRequest(); string info = "正在下载第" + (maxDownCount - downLoadFiles.Count) + "/" + maxDownCount + "个更新文件"; while (!request.isDone) { panel.UpdateProcess(info, request.downloadProgress); yield return(null); } CreatFile(localPath, request.downloadHandler.data); StartCoroutine(DownAssetBundle(panel)); } }
private void StaffelBackBtnClick(object sender, EventArgs e) { DownloadPanel.BringToFront(); selectedPanel = "DownloadPanel"; SeitenCountLabel.Visible = true; vorbtn.Visible = true; backbtn.Click -= StaffelBackBtnClick; backbtn.Click += backbtn_Click; }
public void BeginLoadResource(GameObject go) { Debug.Log("Pass BeginLoadResource"); go.transform.SetParent(GameObject.Find("UIRoot").transform); go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; DownloadPanel downloadPanel = go.GetComponent <DownloadPanel>(); StartCoroutine(DownAssetBundle(downloadPanel)); }
protected AbstractDownloader(VideoInfo primeryVideo, VideoInfo secondaryVideo, DownloadPanel downloadPanel, string dirToSave, int audioQulity, string fileFormat) { this.primeryVideo = primeryVideo; this.secondaryVideo = secondaryVideo; this.downloadPanel = downloadPanel; this.dirToSave = dirToSave; this.audioQulity = audioQulity; this.regex = new Regex(Constants.TitlePattern); this.Title = this.primeryVideo.Title; this.fileFormat = fileFormat; this.fileNameModifier = FileModifierStartValue; }
private void MenueBtnClick(object sender, EventArgs e) { Button clickedbtn = sender as Button; switch (clickedbtn.Name) { case "DownloadBtn": DownloadPanel.BringToFront(); selectedPanel = "DownloadPanel"; break; case "DownloadingBtn": DownloadingPanel.BringToFront(); selectedPanel = "DownloadingPanel"; break; case "SettingBtn": SettingPanel.BringToFront(); selectedPanel = "SettingPanel"; break; } }
public DownloadManager(bool isPlaylist , bool isVideo , int audioQulityIndex , int videoQulityIndex , string dirToSave , string url , DownloadPanel downloadPanel) { this.isPlaylist = isPlaylist; this.isVideo = isVideo; this.audioQulityIndex = audioQulityIndex; this.videoQulityIndex = videoQulityIndex; this.dirToSave = dirToSave; this.url = url; this.downloadPanel = downloadPanel; this.urls = new HashSet <string>(); this.presentedVideos = new List <VideoInfo>(); this.videos = new Queue <IEnumerable <VideoInfo> >(); this.preparationWorker = new BackgroundWorker(); this.downloadWorker = new BackgroundWorker(); this.downloadedVideosCount = 0; }
public SingleVideoDownload(VideoInfo primeryVideo, DownloadPanel downloadPanel, string dirToSave) : base(primeryVideo, downloadPanel, dirToSave, Constants.Mp4Format) { }
/// <summary> /// Update the display mode on the progress dialog. /// </summary> /// <param name="updateMode">The update mode.</param> private void UpdateDisplayMode(UpdateMode updateMode) { switch (updateMode) { case UpdateMode.Changes: { _banner = new Banner { Size = new Size(_contentPanel.Width, 42) }; _changeLogPanel = new ChangeLogPanel(_installOptions, _package, _currentVersion) { Name = "ChangesPage", Location = new Point(0, _banner.Size.Height), Size = new Size(_contentPanel.Width, _contentPanel.Height - _banner.Size.Height) }; _updateButton = new Button { BackColor = SystemColors.Control, Text = @"Update", Size = _buttonSize, Location = new Point(_cancelButton0.Left - _buttonSize.Width - 5, _cancelButton0.Location.Y), TabIndex = 0 }; _updateButton.Click += UpdateButton_Click; _contentPanel.Controls.Add(_banner); _banner.UpdateBanner("Update Information", $"Changes in the latest version of {_package.Name}."); _contentPanel.Controls.Remove(_welcomePage); _buttonsPanel.Controls.Remove(_nextButton); _contentPanel.Controls.Add(_changeLogPanel); _buttonsPanel.Controls.Add(_updateButton); break; } case UpdateMode.Download: { _banner.UpdateBanner("Downloading", $"The latest v.{_package.Version} of {_package.Name}."); _contentPanel.Controls.Remove(_changeLogPanel); _buttonsPanel.Controls.Remove(_updateButton); _buttonsPanel.Controls.Add(_installButton); _downloadPanel = new DownloadPanel(_installOptions, _package, _updater) { Location = new Point(0, _banner.Size.Height), Size = new Size(_contentPanel.Width, _contentPanel.Height - _banner.Size.Height) }; _contentPanel.Controls.Add(_downloadPanel); _downloadPanel.DownloadManager.DownloadsCompleted += DownloadFileCompleted; break; } case UpdateMode.Installing: { _banner.UpdateBanner("Installing", $"Updating {_package.Name} to the v.{_package.Version}."); _contentPanel.Controls.Remove(_downloadPanel); _buttonsPanel.Controls.Remove(_installButton); InstallUpdate(); Close(); break; } case UpdateMode.Welcome: { if (!_installOptions.DisplayWelcomePage) { UpdateDisplayMode(UpdateMode.Changes); } break; } default: { throw new ArgumentOutOfRangeException(nameof(updateMode), updateMode, null); } } }
public AudioDownloader(VideoInfo primeryVideo, DownloadPanel downloadPanel, string dirToSave, int audioQulity) : base(primeryVideo, downloadPanel, dirToSave, audioQulity, Constants.Mp3Format) { }
public DualVideoDownload(VideoInfo primeryVideo, VideoInfo secondaryVideo, DownloadPanel downloadPanel, string dirToSave) : base(primeryVideo, secondaryVideo, downloadPanel, dirToSave, Constants.Mp4Format) { }
protected AbstractDownloader(VideoInfo primeryVideo, DownloadPanel downloadPanel, string dirToSave, string fileFormat) : this(primeryVideo, null, downloadPanel, dirToSave, -1, fileFormat) { }