private void RunIntegrityCheck_OnClick(object s, RoutedEventArgs e)
        {
            var window   = new IntegrityCheckProgressWindow();
            var progress = new Progress <IntegrityCheck.IntegrityCheckProgress>();

            progress.ProgressChanged += (sender, checkProgress) => window.UpdateProgress(checkProgress);

            var gamePath = new DirectoryInfo(ViewModel.GamePath);

            if (Repository.Ffxiv.IsBaseVer(gamePath))
            {
                CustomMessageBox.Show(Loc.Localize("IntegrityCheckBase", "The game is not installed to the path you specified.\nPlease install the game before running an integrity check."), "XIVLauncher", parentWindow: Window.GetWindow(this));
                return;
            }

            Task.Run(async() => await IntegrityCheck.CompareIntegrityAsync(progress, gamePath)).ContinueWith(task =>
            {
                window.Dispatcher.Invoke(() => window.Close());

                string saveIntegrityPath = Path.Combine(Paths.RoamingPath, "integrityreport.txt");
#if DEBUG
                Log.Information("Saving integrity to " + saveIntegrityPath);
#endif
                File.WriteAllText(saveIntegrityPath, task.Result.report);

                this.Dispatcher.Invoke(() =>
                {
                    switch (task.Result.compareResult)
                    {
                    case IntegrityCheck.CompareResult.ReferenceNotFound:
                        CustomMessageBox.Show(Loc.Localize("IntegrityCheckImpossible",
                                                           "There is no reference report yet for this game version. Please try again later."),
                                              "XIVLauncher", MessageBoxButton.OK, MessageBoxImage.Asterisk, parentWindow: Window.GetWindow(this));
                        return;

                    case IntegrityCheck.CompareResult.ReferenceFetchFailure:
                        CustomMessageBox.Show(Loc.Localize("IntegrityCheckNetworkError",
                                                           "Failed to download reference files for checking integrity. Check your internet connection and try again."),
                                              "XIVLauncher", MessageBoxButton.OK, MessageBoxImage.Error, parentWindow: Window.GetWindow(this));
                        return;

                    case IntegrityCheck.CompareResult.Invalid:
                        CustomMessageBox.Show(Loc.Localize("IntegrityCheckFailed",
                                                           "Some game files seem to be modified or corrupted. \n\nIf you use TexTools mods, this is an expected result.\n\nIf you do not use mods, right click the \"Login\" button on the XIVLauncher start page and choose \"Repair game\"."),
                                              "XIVLauncher", MessageBoxButton.OK, MessageBoxImage.Exclamation, showReportLinks: true, parentWindow: Window.GetWindow(this));
                        break;

                    case IntegrityCheck.CompareResult.Valid:
                        CustomMessageBox.Show(Loc.Localize("IntegrityCheckValid", "Your game install seems to be valid."), "XIVLauncher", MessageBoxButton.OK,
                                              MessageBoxImage.Asterisk, parentWindow: Window.GetWindow(this));
                        break;
                    }
                });
            });

            window.ShowDialog();
        }
        private void RunIntegrityCheck_OnClick(object s, RoutedEventArgs e)
        {
            var window   = new IntegrityCheckProgressWindow();
            var progress = new Progress <IntegrityCheck.IntegrityCheckProgress>();

            progress.ProgressChanged += (sender, checkProgress) => window.UpdateProgress(checkProgress);

            Task.Run(async() => await IntegrityCheck.CompareIntegrityAsync(progress, App.Settings.GamePath)).ContinueWith(task =>
            {
                window.Dispatcher.Invoke(() => window.Close());

                switch (task.Result.compareResult)
                {
                case IntegrityCheck.CompareResult.NoServer:
                    MessageBox.Show(Loc.Localize("IntegrityCheckImpossible",
                                                 "There is no reference report yet for this game version. Please try again later."),
                                    "XIVLauncher", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    return;

                case IntegrityCheck.CompareResult.Invalid:
                    {
                        File.WriteAllText("integrityreport.txt", task.Result.report);
                        var result = MessageBox.Show(Loc.Localize("IntegrityCheckFailed",
                                                                  "Some game files seem to be modified or corrupted. Please check the \"integrityreport.txt\" file in the XIVLauncher folder for more information.\n\nDo you want to reset the game to the last patch? This will allow you to patch it again, likely fixing the issues you are encountering."),
                                                     "XIVLauncher", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);

                        if (result == MessageBoxResult.Yes)
                        {
                            var verFile = Path.Combine(App.Settings.GamePath.FullName, "game", "ffxivgame.ver");

                            File.Delete(verFile);
                            File.WriteAllText(verFile, task.Result.remoteIntegrity.LastGameVersion);

                            Process.Start(Path.Combine(ViewModel.GamePath, "boot", "ffxivboot.exe"));
                            Environment.Exit(0);
                        }

                        break;
                    }

                case IntegrityCheck.CompareResult.Valid:
                    MessageBox.Show(Loc.Localize("IntegrityCheckValid", "Your game install seems to be valid."), "XIVLauncher", MessageBoxButton.OK,
                                    MessageBoxImage.Asterisk);
                    break;
                }
            });

            window.ShowDialog();
        }
示例#3
0
        private void RunIntegrityCheck_OnClick(object s, RoutedEventArgs e)
        {
            var window   = new IntegrityCheckProgressWindow();
            var progress = new Progress <IntegrityCheck.IntegrityCheckProgress>();

            progress.ProgressChanged += (sender, checkProgress) => window.UpdateProgress(checkProgress);

            var gamePath = new DirectoryInfo(ViewModel.GamePath);

            Task.Run(async() => await IntegrityCheck.CompareIntegrityAsync(progress, gamePath)).ContinueWith(task =>
            {
                window.Dispatcher.Invoke(() => window.Close());

                switch (task.Result.compareResult)
                {
                case IntegrityCheck.CompareResult.NoServer:
                    CustomMessageBox.Show(Loc.Localize("IntegrityCheckImpossible",
                                                       "There is no reference report yet for this game version. Please try again later."),
                                          "XIVLauncher", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    return;

                case IntegrityCheck.CompareResult.Invalid:
                    {
                        File.WriteAllText("integrityreport.txt", task.Result.report);
                        CustomMessageBox.Show(Loc.Localize("IntegrityCheckFailed",
                                                           "Some game files seem to be modified or corrupted. Please check the \"integrityreport.txt\" file in the XIVLauncher folder for more information.\n\nIf you use TexTools mods, this is an expected result.\n\nIf you do not use mods, please reinstall your game."),
                                              "XIVLauncher", MessageBoxButton.OK, MessageBoxImage.Exclamation);

                        break;
                    }

                case IntegrityCheck.CompareResult.Valid:
                    CustomMessageBox.Show(Loc.Localize("IntegrityCheckValid", "Your game install seems to be valid."), "XIVLauncher", MessageBoxButton.OK,
                                          MessageBoxImage.Asterisk);
                    break;
                }
            });

            window.ShowDialog();
        }