예제 #1
0
        public Downloader(string Url, string FileTarget, System.Windows.Forms.Timer timer = null)
        {
            try
            {
                if (Url.IndexOf("://www.youtube.com") > 0)
                {
                    Classes.YoutubeLink yt = new Classes.YoutubeLink(Url);
                    Url = yt.getDownloadLink();
                }
                this.Url = Url;
                FileInfo();
                this.FileTarget = FileTarget + FileName;


                chunks    = new Chunks(Url, FileSize);
                scheduler = new Scheduler(chunks);

                IsStateCompleted = false; State = CoreState.Create;

                if (timer != null)
                {
                    timerTracker       = timer;
                    timerTracker.Tick += DownloadTracker_Tick;
                    FirstTime          = DateTime.Now;
                }

                IsStateCompleted = false; State = CoreState.Idle;
            }
            catch (Exception e)
            {
                IsStateCompleted = false; State = CoreState.Error;

                Error = e;

                IsStateCompleted = true;
            }
        }
예제 #2
0
 public Scheduler(Chunks chunks)
 {
     Chunks = chunks;
 }