Example #1
0
        public void StartDownload(DownloadProperties NewCurrent)
        {
            Current = NewCurrent;
            DetermineDownloadProperties(ref Current);
            Current.FileDownloaded = false;

            DownloadFileThreadRunning = true;
            DownloadFileThreadPause   = false;
            DownloadProcessThread     = null;

            switch (Current.DownloadType)
            {
            case "http":
                DownloadProcessThread = new Thread(new ThreadStart(DownloadFileProcessHTTP));
                break;

            case "ftp":
                DownloadProcessThread = new Thread(new ThreadStart(DownloadFileProcessFTP));
                break;

            case "file":     // localfile
                DownloadProcessThread = new Thread(new ThreadStart(DownloadFileProcessFile));
                break;

            default:
                DownloadProcessThread = new Thread(new ThreadStart(DownloadFileProcessFile));
                break;
            }
            DownloadProcessThread.Start();
        }
Example #2
0
        void DetermineDownloadProperties(ref DownloadProperties Result)
        {
            Uri CurrentDownloadUri = new Uri(Result.FullURL);

            Result.DownloadType = CurrentDownloadUri.Scheme;

            Result.Filename = CurrentDownloadUri.Segments[CurrentDownloadUri.Segments.Length - 1];
            Result.ReferURL = Result.FullURL.Substring(0, Result.FullURL.Length - Result.Filename.Length);
        }