Beispiel #1
0
        void StartupStep5()
        {
            // FIXME: This somehow broke after themeing. All of this will run but it isn't passed
            // to the patching window for some reason. Currently all below code has been modified
            // and moved to the patching window itself to 'fix' it for now.


            /*
             * This is going to get a little hectic...
             *
             * Things which need to be done here (in order)
             * - We need to determine the user's OS. Is it Vista/7? Or is it Windows 8(.1)/10?
             * - We need to download the correct patch to our Golden Ticket 'Downloads' folder
             * -- FIXME: We should verify the MD5 of the zip before trying to use it
             * - Unzip all files to the Golden Ticket 'Temp' folder
             * -- FIXME: We should verify the MD5 of all individual files before trying to use them
             * - Place all files from our 'Temp' directory in the game installation directory
             */

            string winVer = machineInfo.WindowsVersion();

            if (winVer.Contains("Windows Vista") || winVer.Contains("Windows 7"))
            {
                // Patch for Vista/7
                PatchingWindowBottom patchingWindowBottom = new PatchingWindowBottom();
                PatchingWindow       patchingWindow       = new PatchingWindow();
                patchingWindow.patchToDownload = 1;
                patchingWindowBottom.ShowDialog(this);
                return; // ShowDialog has closed. We're done.
            }

            if (winVer.Contains("Windows 8") || winVer.Contains("Windows 8.1") || winVer.Contains("Windows 10"))
            {
                // Patch for 8/8.1/10
                PatchingWindowBottom patchingWindowBottom = new PatchingWindowBottom();
                PatchingWindow       patchingWindow       = new PatchingWindow();
                patchingWindow.patchToDownload = 2;
                patchingWindowBottom.ShowDialog(this);
                return; // ShowDialog has closed. We're done.
            }

            // Just in case there's some freak accident where this doesn't return ANY of our expected Windows versions, let's flip out!
            if (!winVer.Contains("Windows Vista") & !winVer.Contains("Windows 7") & !winVer.Contains("Windows 8")
                & !winVer.Contains("Windows 8.1") & !winVer.Contains("Windows 10"))
            {
                // Set error code to 3 and stop the launcher
                errorCode = 3;
                LauncherStartup.CancelAsync();
            }
        }
Beispiel #2
0
        void StartupStep2()
        {
            // We need to make changes to allow us to modify the game folder without admin rights...
            // But before doing so, let's try to create a file in the game directory. If it gets
            // an UnauthorizedAccess exception, then we'll run PermissionFix.

            bool dirPermsCorrect = pathUtils.InstallDirPermissionsAreCorrect();

            if (dirPermsCorrect == false)
            {
                // Permissions aren't correct. We need to tell the user and let him/her choose if they want us to fix that.

                DialogResult userAnswer;

                userAnswer = MessageBox.Show(this, "It appears that Golden Ticket does not have the necessary permissions to make" +
                                             " changes to the game. We can fix this by using our open source tool 'PermissionFix'." +
                                             Environment.NewLine + Environment.NewLine + "Clicking 'Yes' will allow us to make" +
                                             " these changes. A UAC request will popup afterwards. Please select 'Yes' on it."
                                             + Environment.NewLine + Environment.NewLine + "Clicking 'No' below will not allow the" +
                                             " launcher to continue in it's attempt to make the game compatible!",
                                             "Cannot make changes to the game!",
                                             MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (userAnswer == DialogResult.No)
                {
                    // User declined to run PermissionFix
                    errorCode = 2;
                    LauncherStartup.CancelAsync();
                }
                else
                {
                    // User said yes to running PermissionFix!
                    Process process = Process.Start(Application.StartupPath + "\\PermissionFix.exe");
                    while (!process.HasExited)
                    {
                        // Sleep for 1/4th a second and wait for PermissionFix to run...
                        Thread.Sleep(250);
                    }
                    return; // PermissionFix ran!
                }
            }
            return; // End of step 2!
        }
Beispiel #3
0
        void StartupStep1()
        {
            // Step 1: Check install directory!

            // Get install location for the game
            gameDirectory = gameInfo.GetInstallLocationFromReg();
            // Get location the launcher is running from
            launcherDirectory = pathUtils.GetLauncherDir();
            // Compare the two

            // Fix Issue #6 -- Launcher is sad if the game directory and reg location have mismatch case.
            // Instead of using a straight 'if (string != string)', use 'string.Equals' so that we can ignore case.
            if (!launcherDirectory.Equals(gameDirectory, StringComparison.OrdinalIgnoreCase))
            {
                // Launcher isn't running in the game directory. Freak out!
                errorCode = 1;
                LauncherStartup.CancelAsync();
            }
            return; // We're good, step 2 please!
        }