BrawlBuilder.BrawlBuilder.buildWorker_RunWorkerCompleted C# (CSharp) Method

buildWorker_RunWorkerCompleted() private method

private buildWorker_RunWorkerCompleted ( object sender, RunWorkerCompletedEventArgs e ) : void
sender object
e RunWorkerCompletedEventArgs
return void
		private void buildWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
		{
			// Clean up files
			File.Delete(_basePath + @"\Resources\temp.gct");

			if (_exiting)
				Environment.Exit(1);

			// Stop the blinker if it is running
			blinker.CancelAsync();
			while (blinker.IsBusy)
				Thread.Sleep(100);

			// Re-enable controls
			foreach (Control c in Controls)
			{
				if (c != exit && c != build)
				{
					c.Enabled = (bool)c.Tag;
				}
			}

			// Reset status
			SetStatus((string)build.Tag, true);

			Activate();

			// Show success if builder actually finished
			if (_state == State.Finish)
			{
				if (File.Exists(_saveFileName))
				{
					MessageBox.Show("Build Completed!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
				}
				else
				{
					MessageBox.Show("BrawlBuilder did not encounter any errors during the build process, but the output image doesn't seem to exist, which indicates that the build did not complete successfully. Sorry about that.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			else if (!e.Cancelled)
			{
				string message = "";
				switch (_state)
				{
					case State.Analyze:
						message = "Build failed due to an unknown error while patching the GCT file.";
						break;
					case State.Verify:
						message = "Build failed due to an unknown error while verifiying the Brawl image.";
						break;
					case State.Extract:
						message = "Build failed due to an unknown error while extracting the Brawl image.";
						break;
					case State.DeleteSSE:
						message = "Build failed due to an unknown error while deleting Subspace Emissary files.";
						break;
					case State.CopyModFiles:
						message = "Build failed due to an unknown error while copying mod files.";
						break;
					case State.CopyBanner:
						message = "Build failed due to an unknown error while copying the custom banner.";
						break;
					case State.Patch:
						message = "Build failed due to an unknown error while applying the GCT file to the Brawl image.";
						break;
					case State.Build:
						message = "Build failed due to an unkonwn error while building the modded Brawl image.";
						break;
					default:
						message = "Build failed due to an unknown error.";
						break;
				}

				MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
		}