Example #1
0
        public void SetupUI()
        {
            fllist.Controls.Clear();

            int heightMultiplier = 0;

            for (int i = 0; i < DownloadManager.Downloads.Length; i++)
            {
                var dctrl = new DownloadControl(i);
                if (heightMultiplier < 10)
                {
                    heightMultiplier++;
                }

                fllist.Controls.Add(dctrl);
                dctrl.Show();
            }

            if (heightMultiplier == 0)
            {
                heightMultiplier = 1;
            }

            this.ParentForm.Height = 150 * heightMultiplier;
        }
Example #2
0
        private async void DownloadComplete(object sender, EventArgs e)
        {
            DownloadControl control = null;

            if (sender is DownloadControl)
            {
                control = sender as DownloadControl;
            }
            if (control == null)
            {
                return;
            }
            control.Episode.Downloaded = true;
            if (/*_CameFromControlList
                 * &&*/!string.IsNullOrEmpty(control.Episode.GUID))
            {
                var episode = Subscriptions.GetEpisodeFromGuid(control.Episode.GUID);
                if (episode != null)
                {
                    episode.Downloaded     = true;
                    episode.LocalFilePath  = control.Episode.LocalFilePath;
                    episode.LocalFileToken = control.Episode.LocalFileToken;
                }
            }
            await Task.Delay(1000);

            await RemoveDownloadControlAsync(control);

            control.Dispose();
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="agApiControl"></param>
        private void download(ApiControl agApiControl)
        {
            DownloadControl wkDownloadControl = new DownloadControl(agApiControl.PostInfoList, txtFolder.Text);

            wkDownloadControl.ProgressChanged += new EventHandler(DownloadControl_ProgressChanged);

            wkDownloadControl.DownloadEnd += new EventHandler(DownloadControl_DownloadEnd);

            wkDownloadControl.ImageDonload();
        }
Example #4
0
        private async Task RemoveDownloadControlAsync(DownloadControl control)
        {
            await Task.Delay(1000);

            MainStackPanel.Children.Remove(control);
            control.Dispose();
            if (MainStackPanel.Children.Count == 0)
            {
                FinishAllDownloads();
            }
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void DownloadControl_ProgressChanged(object sender, EventArgs e)
        {
            DownloadControl wkDownloadControl = (DownloadControl)sender;

            downloadProgress.CountUp(wkDownloadControl.Offset, string.Format("画像をダウンロード中です...{0}/{1}", wkDownloadControl.Offset, wkDownloadControl.TotalPosts));

            if (downloadProgress.Cancel)
            {
                wkDownloadControl.DownloadCacnel();
            }
        }
Example #6
0
        private async void DownloadCancelled(object sender, EventArgs e)
        {
            DownloadControl control = null;

            if (sender is DownloadControl)
            {
                control = sender as DownloadControl;
            }
            if (control == null)
            {
                return;
            }
            await RemoveDownloadControlAsync(control);

            control.Dispose();
        }
Example #7
0
        public void WatchDownloadPercentage(IntPtr windowPointer, Task <bool> downloadTask)
        {
            double percent = 0.0;

            while (!downloadTask.IsCanceled && !downloadTask.IsCompleted && !downloadTask.IsFaulted)
            {
                percent = DownloadControl.GetInstance().PercentDownloaded;

                if (percent < 1.0 && !downloadTask.IsCompleted)
                {
                    TaskbarUtils.SetTaskbarItemProgress(windowPointer, TaskbarProgressBarState.Normal, percent);
                }
                else if (!downloadTask.IsCompleted)
                {
                    TaskbarUtils.SetTaskbarItemProgress(windowPointer, TaskbarProgressBarState.Indeterminate, 1.0);
                    break;
                }
            }
        }
Example #8
0
        public Task <bool> DownloadVersionAsync(string downloadVersion, IntPtr windowPointer)
        {
            var downloadTask = Task.Factory.StartNew(new Func <bool>(() =>
            {
                if (!string.IsNullOrWhiteSpace(downloadVersion))
                {
                    return(DownloadControl.GetInstance().DownloadVersion(downloadVersion));
                }
                else
                {
                    return(false);
                }
            }));

            downloadTask.Start();

            var watchPercentageTask = Task.Factory.StartNew(new Action(() => WatchDownloadPercentage(windowPointer, downloadTask)));

            watchPercentageTask.Start();

            return(downloadTask);
        }
Example #9
0
 private void Awake()
 {
     Instance = this;
 }
Example #10
0
 private void StopDownloads()
 {
     DownloadControl.GetInstance().StopAllDownloads();
     StartControl.GetInstance().StopAllDownloads();
 }
Example #11
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            this.backgroundWorker.ReportProgress(1, LanguageManager.GetText(LanguageEnum.LauncherOldVersionChecking));
            Thread.Sleep(100);

            if (Properties.Settings.Default.UpgradeRequired == true)
            {
                this.backgroundWorker.ReportProgress(5, LanguageManager.GetText(LanguageEnum.LauncherOldVersionSettings));

                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeRequired = false;
                Properties.Settings.Default.Save();
            }

            this.backgroundWorker.ReportProgress(10, LanguageManager.GetText(LanguageEnum.LauncherFilesChecking));
            Thread.Sleep(100);

            string JSONString = string.Empty;

            using (WebClient webClient = new WebClient())
            {
                JSONString = webClient.DownloadString("https://raw.githubusercontent.com/WopsS/PawnPlus/master/Information.json");
            }

            ApplicationJSON applicationJSON = JsonConvert.DeserializeObject <ApplicationJSON>(JSONString);

            if (Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Pawn")) == false || Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Pawn", "include")) == false)
            {
                Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Pawn", "include"));

                FileInfo fileInfo = null;
                string   TemporaryFolder = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()), OurPAWNFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Pawn");
                string   SAMPZIPPath = Path.Combine(TemporaryFolder, applicationJSON.SAMPZIPName), CompilerZIPPath = Path.Combine(TemporaryFolder, applicationJSON.CompilerZIPName);
                Directory.CreateDirectory(TemporaryFolder);

                DownloadHandler downloadHandler = new DownloadHandler(new Tuple <Uri, string>[]
                {
                    Tuple.Create(new Uri(applicationJSON.SAMPFilesLink + "/" + applicationJSON.SAMPZIPName), SAMPZIPPath),
                    Tuple.Create(new Uri(applicationJSON.CompilerLink + "/" + applicationJSON.CompilerZIPName), CompilerZIPPath),
                });

                downloadHandler.DownloadProgressChanged  += DownloadHandler_DownloadProgressChanged;
                downloadHandler.DownloadProgressComplete += DownloadHandler_DownloadProgressComplete;

                this.backgroundWorker.ReportProgress(15, LanguageManager.GetText(LanguageEnum.LauncherFilesDownloadingServer));
                Thread.Sleep(500);

                this.Invoke(new MethodInvoker(delegate
                {
                    this.downloadControl = new DownloadControl();

                    this.Height = 190;
                    this.controlsPanel.Controls.Clear();
                    this.controlsPanel.Controls.Add(this.downloadControl);
                }));

                downloadHandler.Start(); // Download SA-MP files.
                fileInfo = new FileInfo(SAMPZIPPath);

                if (File.Exists(SAMPZIPPath) == true && fileInfo.Length > 0)
                {
                    this.backgroundWorker.ReportProgress(15, LanguageManager.GetText(LanguageEnum.LauncherFilesUnpackingServer));
                    Thread.Sleep(1000);

                    ZipArchive Archive = ZipArchive.Open(SAMPZIPPath);

                    foreach (ZipArchiveEntry archiveEntry in Archive.Entries)
                    {
                        if (archiveEntry.IsDirectory == false)
                        {
                            archiveEntry.WriteToDirectory(TemporaryFolder, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
                        }
                    }

                    Archive.Dispose();

                    this.backgroundWorker.ReportProgress(15, LanguageManager.GetText(LanguageEnum.LauncherFilesCopyingServer));
                    Thread.Sleep(1000);

                    // Let's copy server includes.
                    string[] Files = Directory.GetFiles(Path.Combine(TemporaryFolder, "pawno", "include"));

                    foreach (string CurrentFile in Files)
                    {
                        File.Copy(CurrentFile, Path.Combine(OurPAWNFolder, "include", Path.GetFileName(CurrentFile)), true);
                    }

                    this.backgroundWorker.ReportProgress(15, LanguageManager.GetText(LanguageEnum.LauncherFilesCopiedServer));
                    Thread.Sleep(1000);
                }
                else
                {
                    this.backgroundWorker.ReportProgress(15, LanguageManager.GetText(LanguageEnum.LauncherFilesErrorServer));
                    Thread.Sleep(2000);
                }

                this.backgroundWorker.ReportProgress(15, LanguageManager.GetText(LanguageEnum.LauncherFilesDownloadingCompiler));
                Thread.Sleep(500);

                this.Invoke(new MethodInvoker(delegate
                {
                    this.downloadControl = new DownloadControl();

                    this.Height = 190;
                    this.controlsPanel.Controls.Clear();
                    this.controlsPanel.Controls.Add(this.downloadControl);
                }));

                downloadHandler.Start(); // Download ZEEX compiler files.
                fileInfo = new FileInfo(CompilerZIPPath);

                if (File.Exists(CompilerZIPPath) == true && fileInfo.Length > 0)
                {
                    this.backgroundWorker.ReportProgress(15, LanguageManager.GetText(LanguageEnum.LauncherFilesUnpackingCompiler));
                    Thread.Sleep(1000);

                    ZipArchive Archive = ZipArchive.Open(CompilerZIPPath);

                    foreach (ZipArchiveEntry archiveEntry in Archive.Entries)
                    {
                        if (archiveEntry.IsDirectory == false)
                        {
                            archiveEntry.WriteToDirectory(TemporaryFolder, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
                        }
                    }

                    Archive.Dispose();

                    this.backgroundWorker.ReportProgress(15, LanguageManager.GetText(LanguageEnum.LauncherFilesCopyingCompiler));
                    Thread.Sleep(1000);

                    // Let's copy PAWN files.
                    File.Copy(Path.Combine(TemporaryFolder, CompilerZIPPath.Remove(CompilerZIPPath.Length - 4), "bin", "pawnc.dll"), Path.Combine(OurPAWNFolder, Path.GetFileName("pawnc.dll")), true);
                    File.Copy(Path.Combine(TemporaryFolder, CompilerZIPPath.Remove(CompilerZIPPath.Length - 4), "bin", "pawncc.exe"), Path.Combine(OurPAWNFolder, Path.GetFileName("pawncc.exe")), true);

                    this.backgroundWorker.ReportProgress(15, LanguageManager.GetText(LanguageEnum.LauncherFilesCopiedCompiler));
                    Thread.Sleep(1000);
                }
                else
                {
                    this.backgroundWorker.ReportProgress(15, LanguageManager.GetText(LanguageEnum.LauncherFilesErrorCompiler));
                    Thread.Sleep(2000);
                }

                // Let's delete the temporary folder, we don't need it from now.
                Directory.Delete(TemporaryFolder, true);

                downloadHandler.DownloadProgressChanged  -= DownloadHandler_DownloadProgressChanged;
                downloadHandler.DownloadProgressComplete -= DownloadHandler_DownloadProgressComplete;
            }

            Thread.Sleep(50);

            this.backgroundWorker.ReportProgress(99, LanguageManager.GetText(LanguageEnum.LauncherStartingUp));
            Thread.Sleep(100);

            this.backgroundWorker.ReportProgress(100);
        }
Example #12
0
 public DownloadFormcs()
 {
     InitializeComponent();
     trl = new DownloadControl();
     this.StartPosition = FormStartPosition.CenterParent;
 }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            _aboutButton         = new Button();
            _taskCreatorButton   = new Button();
            _settingsButton      = new Button();
            _additionalsButton   = new Button();
            _downloadControl     = new DownloadControl(this);
            _logRichTextBox      = new LoggerRichTextBox();
            _queueRequestListBox = new AdvancedListBox();
            _helpToolTip         = new HelpToolTip();
            _pageControl         = new PageControl <Control>();
            SuspendLayout();

            _pageControl.Size = new Size(LayoutGUI.DownloadControlSizeWidth,
                                         LayoutGUI.MainFormSizeHeight - LayoutGUI.ButtonSizeHeight - LayoutGUI.DistanceBetweenControls);
            _pageControl.Location  = new Point(0, LayoutGUI.ButtonSizeHeight + 1);
            _pageControl.Font      = new Font(Font.Name, Font.Size + 2);
            _pageControl.Position  = TabAlignment.Bottom;
            _pageControl.Alignment = ContentAlignment.BottomCenter;
            _pageControl.NextPageButton.Enabled     = false;
            _pageControl.PreviousPageButton.Enabled = false;
            _pageControl.PageValueLabel.Enabled     = false;
            _pageControl.NextPageButton.Visible     = false;
            _pageControl.PreviousPageButton.Visible = false;
            _pageControl.PageValueLabel.Visible     = false;
            _pageControl.Add(_downloadControl);
            //
            //DownloadControl
            //
            _downloadControl.Location        = new Point(0, 0);
            _downloadControl.Size            = new Size(_pageControl.Size.Width, _pageControl.Size.Height - _pageControl.ButtonHeight);
            _downloadControl.VisibleChanged += (sender, args) => UpdateText();
            //
            // taskCreatorButton
            //
            _taskCreatorButton.Location = new Point(0, 0);
            _taskCreatorButton.Size     = new Size(LayoutGUI.ButtonSizeWidth, LayoutGUI.ButtonSizeHeight);
            _taskCreatorButton.Image    = new Bitmap(Images.Lineal.Plus, new Size(LayoutGUI.ButtonSizeWidth / 2, LayoutGUI.ButtonSizeHeight / 2));
            _taskCreatorButton.UseVisualStyleBackColor = true;
            _taskCreatorButton.Enabled = Globals.APIKey.IsValid;
            _taskCreatorButton.Click  += (sender, args) =>
            {
                if (_downloadControl.CurrentTasks < DownloadControl.MaximumTasks &&
                    (ModifierKeys == Keys.Control || ModifierKeys == (Keys.Shift | Keys.Control)))
                {
                    _downloadControl.AddDownloadTaskControl();
                    return;
                }

                OpenTaskCreatorForm(ModifierKeys.HasFlag(Keys.Shift));
            };
            Globals.APIKey.Changed += () => { _taskCreatorButton.Enabled = Globals.APIKey.IsValid; };
            Globals.APIKey.Changed += () =>
            {
                if (Globals.APIKey.IsValid && _downloadControl.CurrentTasks <= 0)
                {
                    _downloadControl.AddDownloadTaskControl();
                }
            };
            //
            // settingsButton
            //
            _settingsButton.Size     = new Size(LayoutGUI.ButtonSizeWidth, LayoutGUI.ButtonSizeHeight);
            _settingsButton.Location = new Point(LayoutGUI.MainFormSizeWidth - _settingsButton.Size.Width, 0);
            _settingsButton.Image    = new Bitmap(Images.Line.Settings, new Size(LayoutGUI.ButtonSizeWidth / 2, LayoutGUI.ButtonSizeHeight / 2));
            _settingsButton.UseVisualStyleBackColor = true;
            _settingsButton.Click += (sender, args) => { _settingsForm.ShowDialog(); };
            //
            // additionalsButton
            //
            _additionalsButton.Size     = new Size(LayoutGUI.ButtonSizeWidth, LayoutGUI.ButtonSizeHeight);
            _additionalsButton.Location = new Point(LayoutGUI.MainFormSizeWidth - _settingsButton.Size.Width - _additionalsButton.Size.Width, 0);
            _additionalsButton.Image    = new Bitmap(Images.Line.Tech, new Size(LayoutGUI.ButtonSizeWidth / 2, LayoutGUI.ButtonSizeHeight / 2));
            _additionalsButton.UseVisualStyleBackColor = true;
            _additionalsButton.Click += (sender, args) => { _additionalsForm.ShowDialog(); };
            //
            // aboutButton
            //
            _aboutButton.Size     = new Size(LayoutGUI.ButtonSizeWidth, LayoutGUI.ButtonSizeHeight);
            _aboutButton.Location =
                new Point(LayoutGUI.MainFormSizeWidth - _settingsButton.Size.Width - _additionalsButton.Size.Width - _aboutButton.Size.Width, 0);
            _aboutButton.UseVisualStyleBackColor = true;
            _aboutButton.Image  = new Bitmap(Images.Basic.Question, new Size(LayoutGUI.ButtonSizeWidth / 2, LayoutGUI.ButtonSizeHeight / 2));
            _aboutButton.Click += (sender, args) =>
            {
                new MessageForm(ModifierKeys == Keys.Shift ? Globals.Localization.FirstKnowText : Globals.Localization.AboutProgramText,
                                Globals.Localization.AboutProgramTitle, Images.Basic.Information, Resource.icon.ToBitmap(), MessageBoxButtons.OK,
                                new[] { Globals.Localization.Close }).ShowDialog();
            };

            _logRichTextBox.Size     = new Size(LayoutGUI.MainFormLoggerRichTextBoxSizeWidth - 2, LayoutGUI.MainFormLoggerRichTextBoxSizeHeight);
            _logRichTextBox.Location = new Point(LayoutGUI.MainFormSizeWidth - _logRichTextBox.Size.Width - LayoutGUI.QueueRequestListBoxWidth,
                                                 LayoutGUI.MainFormSizeHeight - _logRichTextBox.Size.Height - _pageControl.ButtonHeight - LayoutGUI.DistanceBetweenControls + 1);
            _logRichTextBox.BorderStyle = BorderStyle.None;
            _logRichTextBox.ScrollBars  = RichTextBoxScrollBars.None;
            _logRichTextBox.Reversed    = false;
            _logRichTextBox.BorderStyle = BorderStyle.Fixed3D;
            Globals.Logger.Logged      += _logRichTextBox.Log;

            _queueRequestListBox.Size             = new Size(LayoutGUI.QueueRequestListBoxWidth, _logRichTextBox.Size.Height);
            _queueRequestListBox.Location         = new Point(_logRichTextBox.Location.X + _logRichTextBox.Size.Width, _logRichTextBox.Location.Y);
            _queueRequestListBox.AddButton.Click += (sender, args) =>
            {
                OpenTaskCreatorForm(ModifierKeys.HasFlag(Keys.Shift));
            };
            _queueRequestListBox.ListBox.ItemAdded += (index, obj) =>
            {
                if (obj is DownloadRequest request)
                {
                    AddedRequest?.Invoke(request);
                }
            };

            //
            // MainForm
            //
            AutoScaleDimensions = new SizeF(7F, 15F);
            AutoScaleMode       = AutoScaleMode.Font;
            ClientSize          = new Size(LayoutGUI.MainFormSizeWidth, LayoutGUI.MainFormSizeHeight);
            FormBorderStyle     = FormBorderStyle.FixedSingle;
            MaximizeBox         = false;
            Controls.Add(_logRichTextBox);
            Controls.Add(_queueRequestListBox);
            Controls.Add(_aboutButton);
            Controls.Add(_additionalsButton);
            Controls.Add(_taskCreatorButton);
            Controls.Add(_settingsButton);
            Controls.Add(_pageControl);
            Icon   = Resource.icon;
            Shown += OnForm_Shown;
            Globals.APIKey.Changed += OnAPIKeyChanged;
            OnAPIKeyChanged();
            JsonAPI.OnExceptionResponce += code =>
            {
                switch (code)
                {
                case HttpStatusCode.Forbidden:
                case HttpStatusCode.Unauthorized:
                    new MessageForm(Globals.Localization.CurrentAPIKeyInvalid, Globals.Localization.APIKeyInvalid, Images.Basic.Error, Images.Basic.Error)
                    .ShowDialog();
                    _settingsForm.ResetAPI();
                    _settingsForm.ShowDialog();
                    break;

                default:
                    new MessageForm($"{Globals.Localization.UnknownError}: {code}", Globals.Localization.UnknownError, Images.Basic.Error,
                                    Images.Basic.Error).ShowDialog();
                    break;
                }
            };
            ResumeLayout();
        }
Example #14
0
        private void DownloadPawnFiles()
        {
            try
            {
                this.backgroundWorker.ReportProgress(10, Localization.Text_CheckingFiles);
                Thread.Sleep(100);

                string JSONString = string.Empty;

                using (WebClient webClient = new WebClient())
                {
                    JSONString = webClient.DownloadString("https://raw.githubusercontent.com/WopsS/PawnPlus/master/Information.json");
                }

                InformationJSON applicationJSON = JsonConvert.DeserializeObject <InformationJSON>(JSONString);

                FileInfo fileInfo = null;

                string TemporaryFolder = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
                string SAMPZIPPath = Path.Combine(TemporaryFolder, applicationJSON.SAMPZIPName), CompilerZIPPath = Path.Combine(TemporaryFolder, applicationJSON.CompilerZIPName);

                Directory.CreateDirectory(TemporaryFolder);

                DownloadHandler downloadHandler = new DownloadHandler(new Tuple <Uri, string>[]
                {
                    Tuple.Create(new Uri(applicationJSON.SAMPFilesLink + "/" + applicationJSON.SAMPZIPName), SAMPZIPPath),
                    Tuple.Create(new Uri(applicationJSON.CompilerLink + "/" + applicationJSON.CompilerZIPName), CompilerZIPPath),
                });

                downloadHandler.ProgressChanged += this.DownloadHandler_DownloadProgressChanged;
                downloadHandler.FileCompleted   += this.DownloadHandler_DownloadProgressComplete;

                this.backgroundWorker.ReportProgress(15, Localization.Text_ServerFilesDownloading);
                Thread.Sleep(500);

                this.Invoke(new MethodInvoker(delegate
                {
                    this.downloadControl = new DownloadControl();

                    this.Height = 190;
                    this.controlsPanel.Controls.Clear();
                    this.controlsPanel.Controls.Add(this.downloadControl);
                }));

                downloadHandler.Start(); // Download SA-MP files.
                fileInfo = new FileInfo(SAMPZIPPath);

                if (File.Exists(SAMPZIPPath) == true && fileInfo.Length > 0)
                {
                    this.backgroundWorker.ReportProgress(15, Localization.Text_ServerFilesUnpacking);
                    Thread.Sleep(1000);

                    ZipArchive Archive = ZipArchive.Open(SAMPZIPPath);

                    foreach (ZipArchiveEntry archiveEntry in Archive.Entries)
                    {
                        if (archiveEntry.IsDirectory == false)
                        {
                            archiveEntry.WriteToDirectory(TemporaryFolder, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
                        }
                    }

                    Archive.Dispose();

                    this.backgroundWorker.ReportProgress(15, Localization.Text_ServerFilesCopying);
                    Thread.Sleep(1000);

                    // Let's copy server includes.
                    string[] Files = Directory.GetFiles(Path.Combine(TemporaryFolder, "pawno", "include"));

                    foreach (string CurrentFile in Files)
                    {
                        File.Copy(CurrentFile, Path.Combine(ApplicationData.IncludesDirectory, Path.GetFileName(CurrentFile)), true);
                    }

                    this.backgroundWorker.ReportProgress(15, Localization.Text_ServerFilesCopied);
                    Thread.Sleep(1000);
                }
                else
                {
                    this.backgroundWorker.ReportProgress(15, Localization.Text_ServerFilesError);
                    Thread.Sleep(2000);
                }

                this.backgroundWorker.ReportProgress(15, Localization.Text_CompilerFilesDownloading);
                Thread.Sleep(500);

                this.Invoke(new MethodInvoker(delegate
                {
                    this.downloadControl = new DownloadControl();

                    this.Height = 190;
                    this.controlsPanel.Controls.Clear();
                    this.controlsPanel.Controls.Add(this.downloadControl);
                }));

                downloadHandler.Start(); // Download ZEEX compiler files.
                fileInfo = new FileInfo(CompilerZIPPath);

                if (File.Exists(CompilerZIPPath) == true && fileInfo.Length > 0)
                {
                    this.backgroundWorker.ReportProgress(15, Localization.Text_CompilerFilesUnpacking);
                    Thread.Sleep(1000);

                    ZipArchive Archive = ZipArchive.Open(CompilerZIPPath);

                    foreach (ZipArchiveEntry archiveEntry in Archive.Entries)
                    {
                        if (archiveEntry.IsDirectory == false)
                        {
                            archiveEntry.WriteToDirectory(TemporaryFolder, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
                        }
                    }

                    Archive.Dispose();

                    this.backgroundWorker.ReportProgress(15, Localization.Text_CompilerFilesCopying);
                    Thread.Sleep(1000);

                    // Let's copy PAWN files.
                    File.Copy(Path.Combine(TemporaryFolder, CompilerZIPPath.Remove(CompilerZIPPath.Length - 4), "bin", "pawnc.dll"), Path.Combine(ApplicationData.PawnDirectory, Path.GetFileName("pawnc.dll")), true);
                    File.Copy(Path.Combine(TemporaryFolder, CompilerZIPPath.Remove(CompilerZIPPath.Length - 4), "bin", "pawncc.exe"), Path.Combine(ApplicationData.PawnDirectory, Path.GetFileName("pawncc.exe")), true);

                    this.backgroundWorker.ReportProgress(15, Localization.Text_CompilerFilesCopied);
                    Thread.Sleep(1000);
                }
                else
                {
                    this.backgroundWorker.ReportProgress(15, Localization.Text_CompilerFilesError);
                    Thread.Sleep(2000);
                }

                // Let's delete the temporary folder, we don't need it from now.
                Directory.Delete(TemporaryFolder, true);

                downloadHandler.Dispose();

                Thread.Sleep(50);
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandledException(ex);
            }
        }