private void ButtonDownload_Click(object sender, EventArgs e)
        {
            switch (CurrentState)
            {
            case State.Idle:
                CurrentState = State.RTPatch;
                _nextState   = NextState.Download;
                RTPatcher.Run(ComboBoxLanguages.SelectedItem as Language);

                break;

            case State.Download:
                ButtonDownload.Text = StringLoader.GetText("button_cancelling");
                Downloader.Cancel();

                break;

            case State.Patch:
                ButtonDownload.Text = StringLoader.GetText("button_cancelling");
                Patcher.Cancel();

                break;

            case State.RTPatch:
                ButtonDownload.Text = StringLoader.GetText("button_cancelling");
                RTPatcher.Cancel();

                break;
            }
        }
        private void ForceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Language language = ComboBoxLanguages.SelectedItem as Language;

            ResetTranslation(language);

            CurrentState = State.RTPatch;
            _nextState   = NextState.Download;
            RTPatcher.Run(language);
        }
        private void ButtonStartRaw_Click(object sender, EventArgs e)
        {
            switch (CurrentState)
            {
            case State.Idle:
                CurrentState = State.RTPatch;
                _nextState   = NextState.PlayRaw;
                RTPatcher.Run(ComboBoxLanguages.SelectedItem as Language);

                break;
            }
        }
        private void ButtonPlay_Click(object sender, EventArgs e)
        {
            switch (CurrentState)
            {
            case State.Idle:
                CurrentState = State.RTPatch;
                _nextState   = NextState.Play;
                RTPatcher.Run(ComboBoxLanguages.SelectedItem as Language);

                break;

            case State.WaitClient:
                ButtonPlay.Text = StringLoader.GetText("button_cancelling");
                GameStarter.Cancel();

                break;
            }
        }
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason.In(CloseReason.ApplicationExitCall, CloseReason.WindowsShutDown))
            {
                Logger.Info($"{Text} closing abnormally. Reason=[{e.CloseReason.ToString()}]");
                CurrentState = State.Idle;
                RTPatcher.Cancel();
                Downloader.Cancel();
                Patcher.Cancel();
                GameStarter.Cancel();
            }
            else if (!CurrentState.In(State.Idle, State.RegionNotInstalled))
            {
                MsgBox.Error(StringLoader.GetText("exception_cannot_close", AssemblyAccessor.Title));

                e.Cancel = true;
            }
            else
            {
                Logger.Info($"{Text} closing. Reason=[{e.CloseReason.ToString()}]");
            }
        }
Example #6
0
        internal MainForm()
        {
            this.Downloader = new Downloader();
            this.Downloader.DownloaderProgressChanged += this.Downloader_DownloaderProgressChanged;
            this.Downloader.DownloaderCompleted       += this.Downloader_DownloaderCompleted;

            this.Patcher = new Patcher();
            this.Patcher.PatcherProgressChanged += this.Patcher_PatcherProgressChanged;
            this.Patcher.PatcherCompleted       += this.Patcher_PatcherCompleted;

            this.RTPatcher = new RTPatcher();
            this.RTPatcher.RTPatcherDownloadProgressChanged += this.RTPatcher_DownloadProgressChanged;
            this.RTPatcher.RTPatcherProgressChanged         += this.RTPatcher_ProgressChanged;
            this.RTPatcher.RTPatcherCompleted += this.RTPatcher_Completed;

            this.GameStarter = new GameStarter();
            this.GameStarter.GameStarterProgressChanged += this.GameStarter_GameStarterProgressChanged;
            this.GameStarter.GameStarterCompleted       += this.GameStarter_GameStarterCompleted;

            InitializeComponent();
            InitializeTextComponent();

            Logger.Info($"[{this.Text}] starting in UI Language [{UserSettings.UILanguageCode}]; Patcher Folder [{UserSettings.PatcherPath}]");
        }