private void btnClientPath_Click(object sender, EventArgs e)
        {
            DialogResult result = AppContextManager.AskPath(new ClientFolderBrowserDialogSettings {
                Description = Resources.SelectClientFolder
            });

            if (result == DialogResult.OK)
            {
                LaunchManager.SetClientIcon();
                this.ShowOrFocus();
            }
        }
        private void btnGamePath_Click(object sender, EventArgs e)
        {
            DialogResult result = AppContextManager.AskPath(new GameFolderBrowserDialogSettings
            {
                Description = string.Format(Resources.SelectExecutableFolderFormat, AppContextManager.Context.Value.Executable.Name)
            });

            if (result == DialogResult.OK)
            {
                LaunchManager.SetClientIcon();
                this.ShowOrFocus();
            }
        }
示例#3
0
        public static void Initialize()
        {
            // we need to run setup here so we can combine the registry path with the executable filename
            Logger.Debug("Trying to set up AppContextManager for first time. Due to serialization speed, this could fail. Retry after initializing PatchManager.");
            AppContextManager.Setup();

            // try to get game path from xml settings
            string gamePath = SettingsManager.XmlData.GamePath;

            if (!File.Exists(gamePath))
            {
                // try to get game path from windows registry
                if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                {
                    if (string.IsNullOrEmpty(gamePath) || !Directory.Exists(gamePath))
                    {
                        gamePath = SettingsManager.GetGamePathFromRegistry();
                        SettingsManager.XmlData.GamePath = gamePath;
                    }
                }

                // try to get game path from user
                if (string.IsNullOrEmpty(gamePath) || !Directory.Exists(gamePath))
                {
                    DialogResult result = AppContextManager.AskPath(new GameFolderBrowserDialogSettings
                    {
                        Description = "Select folder containing game executable"
                    });

                    if (result == DialogResult.Cancel)
                    {
                        LaunchManager.Exit();
                    }
                }
            }

            AddPatchesFromFolder();
        }