void DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                this.client = null;
                this.DeleteFile(this.Target + this.FileName);
                this.DeleteFile(this.Target + @"temp\");
                return;
            }
            else if (e.Error != null)
            {
                Globals.Error.Show(e.Error.Message);
            }
            else
            {
                tDownloader.Text     = "Decompressing " + (this.Count + 1) + " of " + this.FileList.Length + "...";
                this.bCancel.Enabled = false;
                if (this.FileName.Contains(".zip"))
                {
                    Decompress.ExtractZip(this.Target, this.FileName, true);
                }
                else if (this.FileName.Contains(".msi"))
                {
                    Decompress.ExtractMsi(this.Target, this.FileName);
                }
                this.bCancel.Enabled = true;
            }

            this.DeleteFile(this.Target + this.FileName);

            this.NextFile();
        }
예제 #2
0
        private void DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            this.client = null;
            this.DeleteFile(Globals.AppFolder + "tmp");

            if (e.Error != null)
            {
                Globals.Error.Show(e.Error.Message);
            }
            else
            {
                Decompress.ExtractZip(Globals.AppFolder, "tmp.zip", true);

                Globals.LastServersDBMod = this.LastModified.ToString();
                Config.SaveSetting("LastServersDBMod", Globals.LastServersDBMod);

                LoadDataBase(Globals.AppFolder + @"servers.db", ref Globals.dbServ);

                Globals.AddToLog("Servers database successfully updated.");
            }


            string[] fileList = Directory.GetFiles(Globals.AppFolder + "tmp\\");

            string file2;

            foreach (string file in fileList)
            {
                file2 = Path.GetFileName(file);

                if (System.IO.File.Exists(Globals.AppFolder + file2))
                {
                    File.Delete(Globals.AppFolder + file2);
                }

                File.Move(Globals.AppFolder + "tmp\\" + file2, Globals.AppFolder + file2);
            }

            this.DeleteFile(Globals.AppFolder + "tmp.zip");
            this.DeleteFile(Globals.AppFolder + "tmp");
        }