using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.IO; using System.Runtime.InteropServices; using System.Text.RegularExpressions; using System.Threading; using System.Windows.Forms; namespace Megaget { public abstract class Downloader { protected string m_Url; protected WebClientEx m_wc; protected ulong m_ExpectedSize; protected ulong m_FileSize; protected string m_FileName; protected string m_Type; protected DownloadState m_State; protected string m_SiteId; protected Thread m_GoThread; protected int m_WaitTime; protected string m_Incomingfolder; private int m_Progress; private int m_ProgressWait; private int m_ToWait; protected bool m_Cancelled; protected SortedList<DateTime, long> m_SpeedArray; private double m_InstantSpeed; private long m_Received; private long m_SessionReceived; protected DateTime m_StartTime; protected DateTime m_LastProgressUpdated; private string m_Password; private string m_PageUrl; private int m_Priority; protected int m_Fails; protected DateTime m_FailedDate; protected static bool m_IsPremium; protected string m_ErrorMsg; protected bool m_RequestingCaptcha; private bool m_MustRefresh; private int m_InterchangeableUpdateDelay; private string m_Hoster; private string m_extractedPath; private string m_Category; public ListViewItem ListItem; public int Fails { get { return this.m_Fails; } } public DateTime FailedDate { get { return this.m_FailedDate; } } public int WaitRanking { get { int result; if (this.m_State == DownloadState.GettingLink) { if (this.m_RequestingCaptcha) { result = 300; } else { result = -1; } } else { result = this.m_WaitTime; } return result; } } internal string Cat { get { if (this.m_Category == null) { return string.Empty; } return this.m_Category; } } public bool RequestingCaptcha { get { return this.m_RequestingCaptcha; } set { this.m_RequestingCaptcha = value; this.m_UpdateListItem(); } } public string ExtractedPath { set { this.m_extractedPath = value; } } public string Hoster { get { return this.m_Hoster; } } public bool MustRefresh { get { return this.m_MustRefresh; } } public virtual bool IsPremiun { get { return Downloader.m_IsPremium; } } public int Priority { get { return this.m_Priority; } set { this.m_Priority = value; this.m_UpdateListItem(); } } public long Received { get { return this.m_Received; } } public string PageUrl { get { return this.m_PageUrl; } set { this.m_PageUrl = value; } } public string Password { get { return this.m_Password; } set { this.m_Password = value; this.m_UpdateListItem(); } } public string SiteId { get { return this.m_SiteId; } } public DownloadState State { get { return this.m_State; } } public int Progress { get { if (this.m_State == DownloadState.Complete) { return 100; } return this.m_Progress; } } public int ProgressWait { get { return this.m_ProgressWait; } } public int WaitTime { get { return this.m_WaitTime; } } public ulong Size { get { return this.m_ExpectedSize; } } public double Speed { get { TimeSpan timeSpan = DateTime.UtcNow - this.m_StartTime; return (double)this.m_SessionReceived / timeSpan.TotalSeconds / 1024.0; } } public double InstantSpeed { get { this.m_UpdateSpeed(); return this.m_InstantSpeed; } } public string Incomingfolder { get { return this.m_Incomingfolder; } } public string FullPathFile { get { return Path.Combine(this.m_Incomingfolder, this.m_FileName); } } public string FileName { get { return this.m_FileName; } set { if (value == null) { this.m_FileName = string.Empty; return; } this.m_FileName = Utils.#=qzXhFVbajZ3DWUxrdkDZryXF74Jhxqmru3mZyVwZXGhU=(value.Trim()).Trim(); } } public string Url { get { return this.m_Url; } } public Downloader(LinkInfo link, bool loaded) { this.m_ErrorMsg = string.Empty; this.m_Password = string.Empty; this.m_Url = link.Link; this.FileName = link.FileName; this.m_ExpectedSize = link.Size; this.m_SiteId = link.Type; this.m_PageUrl = link.PageUrl; this.m_Priority = link.Priority; this.m_State = link.DownloadState; this.m_Fails = 0; this.m_InterchangeableUpdateDelay = 0; this.m_FailedDate = DateTime.MinValue; this.m_SessionReceived = 0L; this.m_Hoster = link.Type; this.m_RequestingCaptcha = false; this.m_Category = link.Category; if (loaded) { if (link.Password != null) { this.m_Password = link.Password; } if (this.m_State == DownloadState.GettingLink || this.m_State == DownloadState.Waiting || this.m_State == DownloadState.DownloadError || this.m_State == DownloadState.Downloading) { this.m_State = DownloadState.Queued; } if (this.m_State == DownloadState.Complete) { this.m_Received = (long)this.m_ExpectedSize; this.m_Progress = 100; } this.m_Incomingfolder = link.LoadedPath; if (!Directory.Exists(this.m_Incomingfolder)) { Log.Instance.DoLog(Log.LogImportance.Normal, this.m_Incomingfolder + #=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851844476) + this.m_FileName); this.m_Incomingfolder = TheConfig.Instance.Config.GetString(#=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851802745)); } try { if (File.Exists(Path.Combine(this.m_Incomingfolder, this.m_FileName + #=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851804683)))) { FileInfo fileInfo = new FileInfo(Path.Combine(this.m_Incomingfolder, this.m_FileName + #=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851804683))); long length = fileInfo.Length; this.m_Received = fileInfo.Length; this.m_Progress = (int)(100L * length / (long)this.m_ExpectedSize); } goto IL_2F2; } catch { goto IL_2F2; } } if (link.LoadedPath != null && link.LoadedPath.Length > 0) { this.m_Incomingfolder = link.LoadedPath; if (!Directory.Exists(this.m_Incomingfolder)) { try { Directory.CreateDirectory(this.m_Incomingfolder); } catch { } if (!Directory.Exists(this.m_Incomingfolder)) { this.m_Incomingfolder = TheConfig.Instance.Config.GetString(#=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851802745)); Log.Instance.DoLog(Log.LogImportance.Normal, this.m_Incomingfolder + #=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851844476) + this.m_FileName); } } } else { this.m_Incomingfolder = TheConfig.Instance.Config.GetString(#=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851802745)); } IL_2F2: this.ListItem = new ListViewItem(new string[] { link.FileName, link.Link, Utils.#=qcSIX6t21wQ3lzALFTFTy9w==(this.m_State), (this.m_Received > 0L) ? Utils.#=qbVUVk9aGbsTNs_ORp45Jr39hrHuZZQjTqs8iwB7U4kM=(this.m_Received, (long)link.Size) : Utils.#=qZ7pJs0yDkJ7cPHDmuyFjNQ==((long)link.Size), string.Empty, string.Empty, this.m_Incomingfolder, this.m_Password, string.Empty, Utils.#=q2EtpZQ_UT8GTHAWm8UVq3sZjB7jf3p6gPPO8MlGGgAA=(this.m_Priority) }); this.ListItem.Tag = this; this.m_Cancelled = false; this.m_UpdateListItem(); } public static string MatchAndReplace(string text, string regexp, string replace) { Regex regex = new Regex(regexp, RegexOptions.IgnoreCase | RegexOptions.Singleline); Match match = regex.Match(text); if (match.Success) { return match.Result(replace); } return string.Empty; } public void DownloadUrl() { this.m_Cancelled = false; this.m_LastProgressUpdated = DateTime.MinValue; this.m_StartTime = DateTime.MinValue; this.m_SpeedArray = new SortedList<DateTime, long>(); this.m_wc = new WebClientEx(); this.m_wc.DownloadProgressChanged += new #=qlSvNlmnLrQc9cf_zVOihQwkhUIfhAKouKv_R5mYmdM_SjR0aRvK_At4iGEwVOp09(this.m_wc_DownloadProgressChanged); this.m_wc.DownloadFileCompleted += new AsyncCompletedEventHandler(this.m_wc_DownloadFileCompleted); this.m_ErrorMsg = string.Empty; this.m_State = DownloadState.GettingLink; try { this.m_UpdateListItem(); } catch { } this.Hoster == #=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851794624); ThreadPool.QueueUserWorkItem(new WaitCallback(this.m_go)); } protected void m_UpdateSpeed() { try { goto IL_29; while (true) { Downloader obj; try { DateTime utcNow = DateTime.UtcNow; if (this.m_SpeedArray == null) { break; } this.m_SpeedArray[utcNow] = this.m_SessionReceived; double num = 0.0; List<DateTime> list = new List<DateTime>(); for (int i = this.m_SpeedArray.Count - 1; i >= 0; i--) { DateTime dateTime = this.m_SpeedArray.Keys[i]; TimeSpan timeSpan = utcNow - dateTime; if (timeSpan.TotalSeconds >= 7.0) { long num2 = this.m_SpeedArray.Values[i]; long num3 = this.m_SessionReceived - num2; if (num == 0.0) { num = (double)num3 / timeSpan.TotalSeconds / 1024.0; } list.Add(dateTime); } } if (num == 0.0) { TimeSpan timeSpan2 = this.m_SpeedArray.Keys[this.m_SpeedArray.Count - 1] - this.m_SpeedArray.Keys[0]; if (timeSpan2.TotalSeconds >= 4.0) { long num4 = this.m_SpeedArray.Values[this.m_SpeedArray.Count - 1]; long num5 = this.m_SpeedArray.Values[0]; num = (double)(num4 - num5) / timeSpan2.TotalSeconds / 1024.0; } else { num = this.Speed; } } if (!double.IsInfinity(num)) { this.m_InstantSpeed = num; } foreach (DateTime current in list) { this.m_SpeedArray.Remove(current); } break; IL_29: goto IL_05; } finally { Monitor.Exit(obj); } break; IL_05: obj = this; Monitor.Enter(this); } } catch { } } private void m_wc_DownloadProgressChanged(object sender, #=qupV9QhoRvQxijeiu6py$dGIVkskaneiwidgK8vCBvCvRpgxOV3ptYfJVm3W2El$L e) { if (this.m_StartTime == DateTime.MinValue) { this.m_StartTime = DateTime.UtcNow; } if (DateTime.UtcNow - this.m_LastProgressUpdated > new TimeSpan(0, 0, 0, 0, 300) || e.#=qFfzKNIEN_xN3uz1WzPtudC1s4WewpBWt$mfERLDXL3Y= == 100) { this.m_Progress = e.#=qFfzKNIEN_xN3uz1WzPtudC1s4WewpBWt$mfERLDXL3Y=; this.m_FileSize = (ulong)e.#=qBYRfdYfi4KqLK96TGw6tqcJpMS3tm5gIk2BVUtHqnac=; if (this.m_FileSize != this.m_ExpectedSize) { this.m_ExpectedSize = this.m_FileSize; } #=qMGT9u9lKl46KbHHdehV$rg==.#=qfiCtdcdSJrt$SkFksdUMog==().#=qe2mYMM$H1tvf9FMwIhX9xg==().#=qlhnfyh1R5hYoODm$fJ85Qg==(this.m_Hoster, (ulong)(e.#=qITRM8RxugMDeoH55Wf86LDDliw2Zbk$ybV3$cAxeRH4= - this.m_SessionReceived)); this.m_Received = e.#=qUlWfqSFsRBCye0USeCEv9w==; this.m_SessionReceived = e.#=qITRM8RxugMDeoH55Wf86LDDliw2Zbk$ybV3$cAxeRH4=; this.m_UpdateListItem(); this.m_UpdateSpeed(); this.m_InterchangeableUpdateDelay++; if (this.m_InterchangeableUpdateDelay > 3) { int num = #=qMGT9u9lKl46KbHHdehV$rg==.#=qfiCtdcdSJrt$SkFksdUMog==().#=qAOX4eTU7USz22V7zg_NtP9tk6wMpTxwts3iXu6T852s=(this, e); this.m_InterchangeableUpdateDelay = ((num > 0) ? 0 : -7); } this.m_LastProgressUpdated = DateTime.UtcNow; } } private bool m_InternalWait(int seconds) { if (seconds <= 0) { return true; } this.m_ToWait = seconds; this.m_WaitTime = seconds; this.m_State = DownloadState.Waiting; while (this.m_WaitTime > 0) { float num = ((float)this.m_ToWait - (float)this.m_WaitTime) / (float)this.m_ToWait * 100f; this.m_ProgressWait = (int)num; Thread.Sleep(1000); this.m_WaitTime--; this.m_UpdateListItem(); if (this.m_Cancelled) { return false; } } return true; } protected bool m_DoWait(int seconds) { if (!this.m_InternalWait(seconds)) { if (this.m_State != DownloadState.Queued) { this.m_State = DownloadState.Stopped; } this.m_UpdateListItem(); return false; } this.m_State = DownloadState.GettingLink; this.m_UpdateListItem(); return true; } protected bool m_DoRetryWait(int seconds) { if (!this.m_DoWait(seconds)) { if (this.m_State != DownloadState.Queued) { this.m_State = DownloadState.Stopped; } this.m_UpdateListItem(); return false; } this.m_State = DownloadState.GettingLink; this.m_ErrorMsg = string.Empty; this.m_UpdateListItem(); ThreadPool.QueueUserWorkItem(new WaitCallback(this.m_go)); return true; } public void UpdateItem() { this.m_UpdateListItem(); } protected void m_UpdateListItem() { this.m_MustRefresh = true; } public ListViewItem RebuildItem() { this.ListItem = new ListViewItem(new string[] { this.m_FileName, this.m_Url, Utils.#=qcSIX6t21wQ3lzALFTFTy9w==(this.m_State), (this.m_Received > 0L) ? Utils.#=qbVUVk9aGbsTNs_ORp45Jr39hrHuZZQjTqs8iwB7U4kM=(this.m_Received, (long)this.m_FileSize) : Utils.#=qZ7pJs0yDkJ7cPHDmuyFjNQ==((long)this.m_FileSize), string.Empty, string.Empty, this.m_Incomingfolder, this.m_Password, string.Empty, Utils.#=q2EtpZQ_UT8GTHAWm8UVq3sZjB7jf3p6gPPO8MlGGgAA=(this.m_Priority) }); this.ListItem.Tag = this; this.Refresh(); return this.ListItem; } public void Refresh() { this.m_MustRefresh = false; if (this.ListItem.SubItems[0].Text != this.m_FileName) { this.ListItem.SubItems[0].Text = this.m_FileName; } if (this.ListItem.SubItems[1].Text != this.m_Url) { this.ListItem.SubItems[1].Text = this.m_Url; } string text = Utils.#=qcSIX6t21wQ3lzALFTFTy9w==(this.m_State); if (this.m_ErrorMsg != null && this.m_ErrorMsg.Length > 0) { text = text + #=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851815202) + this.m_ErrorMsg; } if (this.m_RequestingCaptcha && this.m_State == DownloadState.GettingLink) { text = #=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851844386); } if (this.ListItem.SubItems[2].Text != text) { this.ListItem.SubItems[2].Text = text; } if (this.m_State == DownloadState.Waiting) { string arg_178_0 = this.ListItem.SubItems[2].Text; int waitTime = this.WaitTime; if (arg_178_0 != waitTime.ToString()) { ListViewItem.ListViewSubItem arg_1A2_0 = this.ListItem.SubItems[2]; int waitTime2 = this.WaitTime; arg_1A2_0.Text = waitTime2.ToString(); } } if (this.ListItem.SubItems[3].Text != Utils.#=qbVUVk9aGbsTNs_ORp45Jr39hrHuZZQjTqs8iwB7U4kM=(this.m_Received, (long)this.m_ExpectedSize)) { this.ListItem.SubItems[3].Text = Utils.#=qbVUVk9aGbsTNs_ORp45Jr39hrHuZZQjTqs8iwB7U4kM=(this.m_Received, (long)this.m_ExpectedSize); } if (this.m_State == DownloadState.Downloading) { this.m_UpdateSpeed(); this.ListItem.SubItems[5].Text = Utils.#=qtW3ht30dc7BF7fsm7BYLhg==(this.m_InstantSpeed); if (this.IsPremiun) { this.ListItem.ForeColor = Color.Blue; } string text2 = #=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851815996); if (this.m_InstantSpeed > 0.30000001192092896 && this.m_FileSize > 0uL) { try { TimeSpan #=qcD10Q$oz7kMDFIWirca_dg== = TimeSpan.FromSeconds((this.m_FileSize - (ulong)this.m_Received) / 1024uL / this.m_InstantSpeed); if (#=qcD10Q$oz7kMDFIWirca_dg==.Days <= 99) { text2 = Utils.#=qOR4vXrfQzTzquVM3hbdp6m3FGA_tTkVLTpGb55yF6mQ=(#=qcD10Q$oz7kMDFIWirca_dg==); } } catch { } } this.ListItem.SubItems[8].Text = text2; } else { if (this.ListItem.SubItems[5].Text.Length > 0) { this.ListItem.SubItems[5].Text = string.Empty; } this.ListItem.SubItems[8].Text = string.Empty; } if (this.ListItem.SubItems[6].Text != this.m_Incomingfolder) { this.ListItem.SubItems[6].Text = this.m_Incomingfolder; } if (this.ListItem.SubItems[7].Text != this.m_Password) { this.ListItem.SubItems[7].Text = this.m_Password; } if (this.ListItem.SubItems.Count > 7 && this.ListItem.SubItems[9].Text != Utils.#=q2EtpZQ_UT8GTHAWm8UVq3sZjB7jf3p6gPPO8MlGGgAA=(this.m_Priority)) { this.ListItem.SubItems[9].Text = Utils.#=q2EtpZQ_UT8GTHAWm8UVq3sZjB7jf3p6gPPO8MlGGgAA=(this.m_Priority); } } public void CheckAvaibility(string url) { this.m_Url = url; if (this.m_wc == null) { this.m_wc = new WebClientEx(); } } protected abstract void m_go(object stateInfo); public abstract string GetTOSLink(); protected virtual bool m_HandleDownloadError(Exception error) { return false; } protected void m_wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { this.m_ErrorMsg = string.Empty; this.m_SessionReceived = 0L; this.m_SpeedArray.Clear(); this.m_UpdateSpeed(); if (e.Cancelled) { if (this.m_State == DownloadState.Stopped) { goto IL_199; } try { File.Delete(this.FullPathFile + #=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851804683)); goto IL_199; } catch { goto IL_199; } } if (e.Error == null) { this.m_State = DownloadState.Complete; this.m_UpdateListItem(); Log.Instance.DoLog(Log.LogImportance.Status, #=qRw9y4579M7VyQxzteyl2hKagqbxy3JiFW$TGgbbDtE4=.#=q6gdJmR33bgpM8p6owWz9Uw==().#=qH9nCbEOk6QPqHvpoyBvAjQ==(#=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851844568), new string[] { this.m_FileName })); #=qMGT9u9lKl46KbHHdehV$rg==.#=qfiCtdcdSJrt$SkFksdUMog==().#=qoxirzCiHXcBMMbc1f5l44ekav_6govp8$9QAReCTR4c=(this); #=qMGT9u9lKl46KbHHdehV$rg==.#=qfiCtdcdSJrt$SkFksdUMog==().#=qhZAhE5_RxOp9W4hpvwVH3A==(); if (TheConfig.Instance.Config.GetBool(#=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851834389))) { #=qOP$0WXG_8GKCeIpzbeT0OC457LO9Rl0iGeI9lG4Zr1M=.#=qtH1WjGKqtNCEf1kVPC7k4Q==().#=qlWE6VpmqtCjWwaM_AiMiow==(this); } #=qMGT9u9lKl46KbHHdehV$rg==.#=qfiCtdcdSJrt$SkFksdUMog==().#=qyRSNJ9n3c$WosqZxCQ8uTQ==.#=qFccOVZdnMiOVnE4FHl_MRw==(this); this.m_CheckShutDown(); } else { if (!this.m_HandleDownloadError(e.Error)) { this.m_SetFailed(); } if (e.Error is IOException) { this.m_ErrorMsg = e.Error.Message.Trim(); Log.Instance.DoLog(Log.LogImportance.Status, e.Error.Message + #=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851805618) + this.m_FileName); int hRForException = Marshal.GetHRForException(e.Error); if (hRForException != -2146232800) { this.m_State = DownloadState.Stopped; this.m_UpdateListItem(); } } } IL_199: this.m_UpdateListItem(); } public void Stop() { if (this.m_State == DownloadState.Stopped) { return; } if (this.m_State == DownloadState.Complete) { return; } if (this.m_State == DownloadState.Downloading) { this.m_State = DownloadState.Stopped; this.m_wc.CancelAsync(); } else { if (this.m_State == DownloadState.DownloadError) { this.m_State = DownloadState.Stopped; } else { if (this.m_State == DownloadState.Queued) { this.m_State = DownloadState.Stopped; } else { if (this.m_State == DownloadState.Waiting) { this.m_State = DownloadState.Stopped; this.m_Cancelled = true; } else { if (this.m_State == DownloadState.GettingLink) { this.m_Cancelled = true; this.m_State = DownloadState.Stopped; if (this.m_wc != null) { this.m_wc.CancelAsync(); } if (this.m_RequestingCaptcha) { #=qMGT9u9lKl46KbHHdehV$rg==.#=qfiCtdcdSJrt$SkFksdUMog==().#=q05n0qMOwF7Vs7NX8W8oK7Ou2Atqwf1MgB1Wb7gaJar8=(this); } } } } } } this.m_UpdateListItem(); #=qMGT9u9lKl46KbHHdehV$rg==.#=qfiCtdcdSJrt$SkFksdUMog==().#=qhZAhE5_RxOp9W4hpvwVH3A==(); } public void Cancel() { if (this.m_State != DownloadState.Waiting && this.State != DownloadState.DownloadError) { if (this.State != DownloadState.Stopped) { goto IL_54; } } try { File.Delete(this.FullPathFile + #=q6agXXPacuhxFUQRBU2kIjDXlNY5o4HZ7i3gPOpY_uaJlWu8jFMhErz3DRXUOid4f.#=qLbLmXavFoaMnC2lVKdHqwA==(-1851804683)); } catch { } IL_54: if (this.m_State == DownloadState.Complete) { return; } if (this.m_State == DownloadState.Downloading) { this.m_wc.CancelAsync(); } else { if (this.m_State == DownloadState.DownloadError) { this.m_State = DownloadState.Stopped; } else { if (this.m_State == DownloadState.Waiting) { this.m_State = DownloadState.Stopped; this.m_Cancelled = true; } else { if (this.m_State == DownloadState.GettingLink) { this.m_Cancelled = true; this.m_State = DownloadState.Stopped; if (this.m_wc != null) { this.m_wc.CancelAsync(); } if (this.m_RequestingCaptcha) { #=qMGT9u9lKl46KbHHdehV$rg==.#=qfiCtdcdSJrt$SkFksdUMog==().#=q05n0qMOwF7Vs7NX8W8oK7Ou2Atqwf1MgB1Wb7gaJar8=(this); } } } } } this.m_UpdateListItem(); #=qMGT9u9lKl46KbHHdehV$rg==.#=qfiCtdcdSJrt$SkFksdUMog==().#=qOsaWRMmvsRs4rPwJeKiEwA==(this); } public void ReDownload() { this.Stop(); if (this.m_State == DownloadState.Complete) { this.m_State = DownloadState.Stopped; } this.Start(); } public void Start() { if (this.m_State == DownloadState.Complete) { return; } if (this.m_State == DownloadState.Downloading) { return; } if (this.m_State == DownloadState.DownloadError) { this.m_Cancelled = false; this.m_State = DownloadState.Queued; } else { if (this.m_State == DownloadState.Queued) { return; } if (this.m_State == DownloadState.Waiting) { return; } if (this.m_State == DownloadState.GettingLink) { return; } if (this.m_State == DownloadState.Stopped) { this.m_Cancelled = false; this.m_State = DownloadState.Queued; } } this.m_UpdateListItem(); #=qMGT9u9lKl46KbHHdehV$rg==.#=qfiCtdcdSJrt$SkFksdUMog==().#=qhZAhE5_RxOp9W4hpvwVH3A==(); } internal void SetSpeedWait(double p) { if (this.m_wc != null) { this.m_wc.WaitTime = p; } } public static int Compare(Downloader x, Downloader y) { if (x.Priority == y.Priority) { return 0; } if (x.Priority > y.Priority) { return 1; } return -1; } public virtual int GetMaxDownloads() { return 1; } public virtual int GetMaxPremiumDownloads() { return 10; } protected void m_SetFailed() { if (this.m_State == DownloadState.Queued && this.m_Cancelled) { this.m_UpdateListItem(); } else { if (this.m_State != DownloadState.Stopped) { this.m_Fails++; this.m_FailedDate = DateTime.Now; this.m_State = DownloadState.DownloadError; this.m_UpdateListItem(); } } this.m_CheckShutDown(); } private void m_CheckShutDown() { if (#=qMGT9u9lKl46KbHHdehV$rg==.#=qfiCtdcdSJrt$SkFksdUMog==().#=qiPPbkvbkcWEaNmMOsHyXZQ==()) { if (this.ListItem.ListView != null && this.ListItem.ListView.InvokeRequired) { MethodInvoker method = new MethodInvoker(this.m_CheckShutDown); this.ListItem.ListView.BeginInvoke(method); return; } Utils.#=qGsXiS7EPv3Dh1ObqzsgC9A==(); } } public void MarkAsCompleted() { this.m_State = DownloadState.Complete; this.m_UpdateListItem(); } internal void UpdateDownloaded(#=qupV9QhoRvQxijeiu6py$dGIVkskaneiwidgK8vCBvCvRpgxOV3ptYfJVm3W2El$L e) { this.m_Progress = e.#=qFfzKNIEN_xN3uz1WzPtudC1s4WewpBWt$mfERLDXL3Y=; this.m_FileSize = (ulong)e.#=qBYRfdYfi4KqLK96TGw6tqcJpMS3tm5gIk2BVUtHqnac=; if (this.m_FileSize != this.m_ExpectedSize) { this.m_ExpectedSize = this.m_FileSize; } this.m_Received = e.#=qUlWfqSFsRBCye0USeCEv9w==; this.m_UpdateListItem(); this.m_LastProgressUpdated = DateTime.UtcNow; } internal void Requeue() { if (this.m_State == DownloadState.DownloadError) { this.m_State = DownloadState.Queued; } else { if (this.m_State == DownloadState.Queued) { this.m_State = DownloadState.Queued; } else { if (this.m_State == DownloadState.Waiting) { this.m_State = DownloadState.Queued; this.m_Cancelled = true; } else { if (this.m_State == DownloadState.GettingLink) { this.m_Cancelled = true; this.m_State = DownloadState.Queued; if (this.m_wc != null) { this.m_wc.CancelAsync(); } if (this.m_RequestingCaptcha) { #=qMGT9u9lKl46KbHHdehV$rg==.#=qfiCtdcdSJrt$SkFksdUMog==().#=q05n0qMOwF7Vs7NX8W8oK7Ou2Atqwf1MgB1Wb7gaJar8=(this); } } } } } this.m_UpdateListItem(); } } }