コード例 #1
0
ファイル: GameUpdater.cs プロジェクト: eskielez/GameLauncher
        private void ContentFilesDownloadFinished(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                var message = Localization.GetText("GameUpdater.Message.CannotReadContentFile");

#pragma warning disable CS0162
                if (LauncherSetup.IS_CHANGELOG_HTML)
                {
                    //only wrap in HTML if we already expect an HTML document
                    message = message.WrapAsHTML();
                }
#pragma warning restore CS0162

                ChangelogLoaded?.Invoke(message);
                UpdateFailed?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                if (File.Exists("content.changes"))
                {
                    ChangelogLoaded?.Invoke(File.ReadAllText("content.changes"));
                }
                StatusUpdate?.Invoke(Localization.GetText("GameUpdater.Status.CheckingLocalFiles"));
                GameVersionDetected?.Invoke(contentFile.GameVersion);

                fileCheckWorker                     = new BackgroundWorker();
                fileCheckWorker.DoWork             += CheckFiles;
                fileCheckWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.CheckFilesFinished);
                fileCheckWorker.RunWorkerAsync();
            }
        }
コード例 #2
0
        private void HandleUpdateFailed(string updateFailureErrorMessage)
        {
            if (IsTaskbarSupported())
            {
                tbp.SetState(WindowManager.GetWindowHandle(), TaskbarProgress.TaskbarStates.NoProgress);
            }

            UpdateFailed?.Invoke(this, new UpdateFailureEventArgs(updateFailureErrorMessage));
        }
コード例 #3
0
 private void FailThread()
 {
     lock (GUILocker)
     {
         Worker     = null;
         InProgress = false;
     }
     UpdateFailed?.Invoke(this, EventArgs.Empty);
 }
コード例 #4
0
ファイル: FormImportReport.cs プロジェクト: rotovibe/engage
 private void FormImportReport_Load(object sender, EventArgs e)
 {
     this.dataGridView1.DataSource = this.dataSetImportReport.ImportResult;
     lblTotalValue.Text            = Total.ToString();
     lblInsertPassedValue.Text     = InsertPassed.ToString();
     lblInsertFailedValue.Text     = InsertFailed.ToString();
     lblUpdatePassedValue.Text     = UpdatePassed.ToString();
     lblUpdatedFailedValue.Text    = UpdateFailed.ToString();
     lblUpdatedSkippedValue.Text   = skippedRow.ToString();
 }
コード例 #5
0
        private async void _webClient_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            if (!_updating)
            {
                return;
            }

            if (e.Error != null || e.Cancelled)
            {
                UpdateFailed?.Invoke();
                return;
            }

            await Task.Delay(1000);

            ProcessUpdate();
        }
コード例 #6
0
ファイル: UpdateMan.cs プロジェクト: ModuleArt/quick-library
 public static void OnUpdateFailed(UpdateFailedEventArgs ufea)
 {
     UpdateFailed?.Invoke(null, ufea);
 }
コード例 #7
0
        private void PerformUpdateInternal()
        {
            UpdaterLogger.Log("Performing update.");

            CreateTemporaryDirectory();

            UpdateMirror updateMirror = updateMirrors[lastUpdateMirrorId];

            char dsc = Path.DirectorySeparatorChar;

            string buildPath         = localBuildInfo.BuildPath;
            string downloadDirectory = buildPath + TEMPORARY_UPDATER_DIRECTORY + dsc;

            List <RemoteFileInfo> filesToDownload = GatherFilesToDownload(buildPath, downloadDirectory);

            CleanUpDownloadDirectory(filesToDownload, downloadDirectory);

            UpdaterLogger.Log("Creating downloader.");

            UpdateDownloader downloader = new UpdateDownloader();

            downloader.DownloadProgress += Downloader_DownloadProgress;
            UpdateDownloadResult result = downloader.DownloadUpdates(buildPath, downloadDirectory, filesToDownload, updateMirror);

            downloader.DownloadProgress -= Downloader_DownloadProgress;

            lock (locker)
            {
                updateInProgress = false;
            }

            switch (result.UpdateDownloadResultState)
            {
            case UpdateDownloadResultType.CANCELLED:
                UpdateCancelled?.Invoke(this, EventArgs.Empty);
                return;

            case UpdateDownloadResultType.COMPLETED:
                // If a new second-stage updater was downloaded, update it
                // first before launching it

                string originalSecondStageUpdaterPath = localBuildInfo.BuildPath + SecondStageUpdaterPath;

                string updatedSecondStageUpdaterPath = localBuildInfo.BuildPath +
                                                       TEMPORARY_UPDATER_DIRECTORY + dsc +
                                                       SecondStageUpdaterPath;

                if (File.Exists(updatedSecondStageUpdaterPath))
                {
                    File.Delete(originalSecondStageUpdaterPath);
                    File.Move(updatedSecondStageUpdaterPath, originalSecondStageUpdaterPath);
                }

                // Also update the second-stage updater's config file

                string originalSecondStageConfigPath = Path.GetDirectoryName(originalSecondStageUpdaterPath)
                                                       + dsc + SECOND_STAGE_UPDATER_CONFIGURATION_FILE;

                string updatedSecondStageConfigPath = Path.GetDirectoryName(updatedSecondStageUpdaterPath)
                                                      + dsc + SECOND_STAGE_UPDATER_CONFIGURATION_FILE;

                if (File.Exists(updatedSecondStageConfigPath))
                {
                    File.Delete(originalSecondStageConfigPath);
                    File.Move(updatedSecondStageConfigPath, originalSecondStageConfigPath);
                }

                // Generate local build information file
                LocalBuildInfo newBuildInfo = LocalBuildInfoFromRemoteBuildInfo();
                newBuildInfo.Write(localBuildInfo.BuildPath + TEMPORARY_UPDATER_DIRECTORY + dsc + LOCAL_BUILD_INFO_FILE);

                Process.Start(originalSecondStageUpdaterPath);

                // No null checking necessary here, it's actually better to
                // crash the application in case this is not subscribed to
                DownloadCompleted.Invoke(this, EventArgs.Empty);
                return;

            case UpdateDownloadResultType.FAILED:
                UpdateFailed?.Invoke(this, new UpdateFailureEventArgs(result.ErrorDescription));
                return;
            }
        }
コード例 #8
0
 private void OnUpdateFailed()
 {
     UpdateFailed?.Invoke(this, null);
 }
コード例 #9
0
 protected virtual void OnUpdateFailed(UpdateFailedArgs e) => UpdateFailed?.Invoke(this, e);
コード例 #10
0
 internal void OnUpdateFailed()
 {
     Log.Warning($"Server {this.ID:00} Updated Failed.");
     UpdateFailed.Invoke(this, null);
 }