Пример #1
0
        /// <summary>
        /// Lors du début d'un téléchargement
        /// </summary>
        /// <param name="d">Download qui débute</param>
        public static void downloader_OnDownloadStart(Download d)
        {
            //fUpdater.SetPackage(Path.GetFileName(Path.GetDirectoryName(d.DownloadFile)));

            //string toto = d.DownloadFile;
            //int inx = toto.IndexOf("\\", DTC.Common.Paths.GetLocalPackagesDir()));
            fUpdater.SetPackage(d.package);
            fUpdater.SetLabel("Téléchargement de " + Path.GetFileName(d.DownloadFile));
        }
Пример #2
0
        /// <summary>
        /// Lors de la fin d'un téléchargement
        /// </summary>
        /// <param name="d">Download qui termine</param>
        public static void downloader_OnDownloadComplete(Download d)
        {
            // Trucs a faire apres le dl, genre verifs md5, decompression archive etc etc...
            switch (d.type)
            {
                case "package":

                    //decompression
                    try
                    {
                        fUpdater.SetPackage(d.package);
                        fUpdater.SetLabel("Décompression de " + Path.GetFileName(d.DownloadFile));

                        Ionic.Zip.ZipFile zipF = new Ionic.Zip.ZipFile(d.DownloadFile);
                        zipF.ExtractAll(Paths.GetLocalPackagesDir());
                    }
                    catch (Ionic.Zip.ZipException Z)
                    {
                        Console.WriteLine("ERREUR ZIP !");
                        Console.WriteLine(Z.Message);
                    }
                    catch (Exception E)
                    {
                        Console.WriteLine("ERREUR ZIP INCONNUE !");
                        Console.WriteLine(E.Message);
                    }

                    // verif MAj ?

                    //ClientPackages.Get();
                    //Program.DoWork(false, true);
                    //

                    //todo: virer le .zip si ok ou si md5 incorrect

                    break;

                case "file":
                    //todo: verif MD5 ?
                    break;

                default:
                    //Inconnu ???
                    break;

            }
        }
Пример #3
0
 /// <summary>
 /// Lors d'une erreur de Download
 /// </summary>
 /// <param name="d">Download en erreur</param>
 public static void downloader_OnDownloadError(Download d)
 {
     Console.WriteLine("ERREUR DOWNLOAD !");
 }
Пример #4
0
 public void downloader_DownloadStarted(Download d)
 {
     this.SetText(d.DownloadUrl);
 }