public bool AddURL(Uri argUri, string argDestFolder, string argDestFilename, bool argDownloadImages, string argLinkTypes, int argTimerSeconds, string argUserName, string argPassword, string argName, bool hiddenWatch)
 {
     try {
         foreach (WatchThread thread in this.watchThreadList)
         {
             if (thread.threadURI == argUri)
             {
                 return(false);
             }
         }
         if (((argDestFilename.Contains(@"\") || argDestFilename.Contains("/")) || (argDestFilename.Contains(":") || argDestFilename.Contains("*"))) || ((argDestFilename.Contains("?") || argDestFilename.Contains("\"")) || ((argDestFilename.Contains("<") || argDestFilename.Contains(">")) || argDestFilename.Contains("|"))))
         {
             return(false);
         }
         WatchThread item = new WatchThread(this.theDownloadManager, this)
         {
             threadURI  = argUri,
             threadURL  = argUri.ToString(),
             destFile   = argDestFilename,
             destFolder = argDestFolder
         };
         int startIndex = argDestFolder.LastIndexOf(@"\") + 1;
         if (startIndex < 0)
         {
             startIndex = 0;
         }
         item.destSubFolder          = argDestFolder.Substring(startIndex);
         item.destFullPath           = Path.Combine(item.destFolder, argDestFilename);
         item.updateInterval         = argTimerSeconds;
         item.overrideUpdateInterval = true;
         item.overrideDownloadPath   = true;
         item.overrideSubFolder      = true;
         item.downloadLinkTypes      = argLinkTypes;
         item.downloadImages         = argDownloadImages;
         item.hiddenWatch            = hiddenWatch;
         item.username   = EncDec.Encrypt(argUserName, item.threadURL);
         item.password   = EncDec.Encrypt(argPassword, item.threadURL);
         item.threadName = argName;
         item.RegisterDebugLog(this.debugLogText);
         item.watchThreadManager      = this;
         item.RefreshListViewCallback = this.RefreshListViewCallback;
         item.SetupViewItem();
         this.watchThreadList.Add(item);
         this.debugLogText.AddLine("URL Added: " + item.threadURL);
         item.StartRunning();
     } catch (Exception exception) {
         this.debugLogText.AddLine("Error in AddURL.\r\n" + exception.Message);
         return(false);
     }
     return(true);
 }
Esempio n. 2
0
 public DownloadItem(Uri argUri, string argFullPath, bool argIsThread, WatchThread argWatcher, string argUserName, string argPassword)
 {
     try {
         this.itemUri           = argUri;
         this.fullPath          = argFullPath;
         this.retries           = 0;
         this.isThread          = argIsThread;
         this.watchThread       = argWatcher;
         this.completed         = false;
         this.started           = false;
         this.isInDownloadQueue = false;
         this.username          = argUserName;
         this.password          = argPassword;
         this.dltViewItem       = new DownloaderTaskViewItem();
     } catch (Exception exception) {
         MessageBox.Show("Erorr in DownloadItem constructor, throwing.\r\n" + exception.Message);
     }
 }
Esempio n. 3
0
 public DownloadItem(Uri argUri, string argFullPath, bool argIsThread, WatchThread argWatcher, string argUserName, string argPassword)
 {
     try {
     this.itemUri = argUri;
     this.fullPath = argFullPath;
     this.retries = 0;
     this.isThread = argIsThread;
     this.watchThread = argWatcher;
     this.completed = false;
     this.started = false;
     this.isInDownloadQueue = false;
     this.username = argUserName;
     this.password = argPassword;
     this.dltViewItem = new DownloaderTaskViewItem();
       } catch (Exception exception) {
     MessageBox.Show("Erorr in DownloadItem constructor, throwing.\r\n" + exception.Message);
       }
 }
Esempio n. 4
0
        public windowAddAdvanced(WatchThread argWatchThread)
        {
            this.InitializeComponent();
            base.Title                = "Properties";
            this.watchThread          = argWatchThread;
            this.txtURL.Text          = this.watchThread.threadURL;
            this.txtDestFolder.Text   = this.watchThread.destFolder;
            this.txtDestFilename.Text = this.watchThread.destFile;
            TimeSpan span = TimeSpan.FromMilliseconds((double)this.watchThread.updateInterval);

            this.timePicker1.SelectedHour    = span.Hours;
            this.timePicker1.SelectedMinute  = span.Minutes;
            this.timePicker1.SelectedSecond  = span.Seconds;
            this.chkDownloadImages.IsChecked = new bool?(this.watchThread.downloadImages);
            this.txtLinkTypes.Text           = this.watchThread.downloadLinkTypes;
            this.txtUserName.Text            = EncDec.Decrypt(this.watchThread.username, this.watchThread.threadURL);
            this.passPassword.Password       = EncDec.Decrypt(this.watchThread.password, this.watchThread.threadURL);
            this.txtName.Text = this.watchThread.threadName;
        }
Esempio n. 5
0
 public void RemoveMyItems(WatchThread argWT)
 {
     try {
         List <DownloadItem> list = new List <DownloadItem>();
         foreach (DownloadItem item in this.lstDownloadItemList)
         {
             if (item.watchThread == argWT)
             {
                 list.Add(item);
             }
         }
         foreach (DownloadItem item2 in list)
         {
             if (item2.started)
             {
                 item2.downloaderTask.CancelDownload();
             }
             item2.isInDownloadQueue = false;
             this.lstDownloadItemList.Remove(item2);
         }
     } catch (Exception exception) {
         MessageBox.Show("*******************Error RemoveMyItems.\r\n" + exception.Message);
     }
 }
Esempio n. 6
0
 public void RemoveMyItems(WatchThread argWT)
 {
     try {
     List<DownloadItem> list = new List<DownloadItem>();
     foreach (DownloadItem item in this.lstDownloadItemList) {
       if (item.watchThread == argWT) {
     list.Add(item);
       }
     }
     foreach (DownloadItem item2 in list) {
       if (item2.started) {
     item2.downloaderTask.CancelDownload();
       }
       item2.isInDownloadQueue = false;
       this.lstDownloadItemList.Remove(item2);
     }
       } catch (Exception exception) {
     MessageBox.Show("*******************Error RemoveMyItems.\r\n" + exception.Message);
       }
 }
 public bool AddURL(Uri argUri, string argDestFolder, string argDestFilename, bool argDownloadImages, string argLinkTypes, int argTimerSeconds, string argUserName, string argPassword, string argName, bool hiddenWatch)
 {
     try {
     foreach (WatchThread thread in this.watchThreadList) {
       if (thread.threadURI == argUri) {
     return false;
       }
     }
     if (((argDestFilename.Contains(@"\") || argDestFilename.Contains("/")) || (argDestFilename.Contains(":") || argDestFilename.Contains("*"))) || ((argDestFilename.Contains("?") || argDestFilename.Contains("\"")) || ((argDestFilename.Contains("<") || argDestFilename.Contains(">")) || argDestFilename.Contains("|")))) {
       return false;
     }
     WatchThread item = new WatchThread(this.theDownloadManager, this)
     {
       threadURI = argUri,
       threadURL = argUri.ToString(),
       destFile = argDestFilename,
       destFolder = argDestFolder
     };
     int startIndex = argDestFolder.LastIndexOf(@"\") + 1;
     if (startIndex < 0) {
       startIndex = 0;
     }
     item.destSubFolder = argDestFolder.Substring(startIndex);
     item.destFullPath = Path.Combine(item.destFolder, argDestFilename);
     item.updateInterval = argTimerSeconds;
     item.overrideUpdateInterval = true;
     item.overrideDownloadPath = true;
     item.overrideSubFolder = true;
     item.downloadLinkTypes = argLinkTypes;
     item.downloadImages = argDownloadImages;
     item.hiddenWatch = hiddenWatch;
     item.username = EncDec.Encrypt(argUserName, item.threadURL);
     item.password = EncDec.Encrypt(argPassword, item.threadURL);
     item.threadName = argName;
     item.RegisterDebugLog(this.debugLogText);
     item.watchThreadManager = this;
     item.RefreshListViewCallback = this.RefreshListViewCallback;
     item.SetupViewItem();
     this.watchThreadList.Add(item);
     this.debugLogText.AddLine("URL Added: " + item.threadURL);
     item.StartRunning();
       } catch (Exception exception) {
     this.debugLogText.AddLine("Error in AddURL.\r\n" + exception.Message);
     return false;
       }
       return true;
 }