Exemple #1
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");
        }