Exemple #1
0
        public FileDownloader(String downloadUrl, CompleteHandler c, ProgressHandler p)
        {
            completed = c;
            progress  = p;

            string tempPath = System.IO.Path.GetTempPath();

            destinationFile = tempPath + downloadUrl.Remove(downloadUrl.LastIndexOf('/'));
            destinationFile = tempPath + @"\ManokInstaller.exe";

            File.Delete(destinationFile);

            url = downloadUrl;
            WorkerReportsProgress      = true;
            WorkerSupportsCancellation = true;
            WorkerReportsProgress      = true;



            DoWork += FileDownloader_DoWork;

            RunWorkerCompleted +=
                new System.ComponentModel.RunWorkerCompletedEventHandler(this.DownloadComplete);

            ProgressChanged +=
                new ProgressChangedEventHandler(this.ProgressUpdate);

            RunWorkerAsync();
        }
Exemple #2
0
        public CheckUpdates(String versionUrl, FileDownloader.CompleteHandler c)
        {
            completed      = c;
            url            = versionUrl;
            currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            String ourFileName = System.Reflection.Assembly.GetExecutingAssembly().Location;
            MD5    md5p        = MD5CryptoServiceProvider.Create();

            byte[] md5 = md5p.ComputeHash(ReadBinaryFile(ourFileName));
            // Console.WriteLine("MD5 Hash for {0} is {1}", sFileName, ToHexa(md5));
            url += "?v=" + currentVersion + "&h=" + ToHexa(md5) + "&p=" + System.Web.HttpUtility.UrlEncode(ourFileName);
            TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));

            int timestamp = (int)t.TotalSeconds;

            url += "&t=" + timestamp.ToString();
            WorkerReportsProgress      = true;
            WorkerSupportsCancellation = true;

            DoWork             += CheckUpdates_DoWork;
            RunWorkerCompleted +=
                new System.ComponentModel.RunWorkerCompletedEventHandler(this.VersionCheckComplete);
            RunWorkerAsync();
        }
Exemple #3
0
        public void addTask(System.ComponentModel.DoWorkEventHandler doWork, System.ComponentModel.RunWorkerCompletedEventHandler runCompleted, Hashtable arguments, bool prioritaire)
        {
            aTask tache = new aTask();

            tache.doWorkHandler       = doWork;
            tache.runCompletedHandler = runCompleted;
            tache.arguments           = arguments;
            addTask(tache, prioritaire);
        }
Exemple #4
0
 public void sendEmail(string new_from, string new_to, string new_reply_to, string new_title,string new_body, RunWorkerCompletedEventHandler target)
 {
     this.DoWork += new System.ComponentModel.DoWorkEventHandler(sendEmail);
     RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(target);
     from = new_from;
     to = new_to;
     reply_to = new_reply_to;
     body = new_body;
     title = new_title;
     this.RunWorkerAsync();
 }
Exemple #5
0
 public void sendEmail(string new_from, string new_to, string new_reply_to, string new_title, string new_body, RunWorkerCompletedEventHandler target)
 {
     this.DoWork        += new System.ComponentModel.DoWorkEventHandler(sendEmail);
     RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(target);
     from     = new_from;
     to       = new_to;
     reply_to = new_reply_to;
     body     = new_body;
     title    = new_title;
     this.RunWorkerAsync();
 }
        public void Start()
        {
            this.currentMd5     = GetOurMd5();
            this.checkUpdateUrl = GetUpdateUrl();

            WorkerReportsProgress      = true;
            WorkerSupportsCancellation = true;

            DoWork             += CheckForUpdates_DoWork;
            RunWorkerCompleted +=
                new System.ComponentModel.RunWorkerCompletedEventHandler(this.VersionCheckComplete);
            RunWorkerAsync();
        }
Exemple #7
0
 public void checkAvailability(RunWorkerCompletedEventHandler target)
 {
     this.DoWork += new System.ComponentModel.DoWorkEventHandler(checkAvailability);
     RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(target);
     this.RunWorkerAsync();
 }
Exemple #8
0
 public void addTask(System.ComponentModel.DoWorkEventHandler doWork, System.ComponentModel.RunWorkerCompletedEventHandler runCompleted, Hashtable arguments)
 {
     addTask(doWork, runCompleted, arguments, false);
 }
Exemple #9
0
 public void addTask(System.ComponentModel.DoWorkEventHandler doWork, System.ComponentModel.RunWorkerCompletedEventHandler runCompleted)
 {
     addTask(doWork, runCompleted, null, false);
 }
Exemple #10
0
 public void checkAvailability(RunWorkerCompletedEventHandler target)
 {
     this.DoWork        += new System.ComponentModel.DoWorkEventHandler(checkAvailability);
     RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(target);
     this.RunWorkerAsync();
 }