コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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
        private void guiHome_FormClosing(object sender, FormClosingEventArgs e)
        {
            LaunchManager.GameProcess?.Dispose();

            // reset
            SettingsManager.InvalidateXmlData();
            HistoryManager.RestorePatchedFiles();
            HistoryManager.Delete();

            // dispose loggers so we can delete empty logs
            AppContextManager.Dispose();
            SettingsManager.Dispose();
            HistoryManager.Dispose();
            LaunchManager.Dispose();
            PatchManager.Dispose();
            PreferencesManager.Dispose();
        }
コード例 #4
0
        public LaunchManager()
        {
            this.Initialize();

            State = Bindable.Variable(LaunchManagerState.Idle);

            // TODO: is this needed on windows?
            // the following is needed on linux... the current directory must be the Mono executable, which is bad.
            string assemblyLocation = Assembly.GetExecutingAssembly().Location;
            string assemblyFolder   = Path.GetDirectoryName(assemblyLocation);

            Environment.CurrentDirectory = assemblyFolder;

            // also sets up AppContextManager
            PatchManager.Initialize();

            // TODO: could just Thread.Sleep instead of calling it again, but LiteDB migration is on roadmap, so whatever
            AppContextManager.Setup();
        }
コード例 #5
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();
        }