Пример #1
0
 private void InitializeGamePath()
 {
     gamePath = new GamePath(Settings.GamePath.Load());
     if (gamePath.IsValid)
     {
         TextBoxGamePath.Text = gamePath.RootDir;
         Log.Info("遊戲路徑: " + gamePath.RootDir);
     }
     else if (!String.IsNullOrEmpty(gamePath.RootDir))
     {
         Log.Warn("Invalid game path loaded from registry.");
         Settings.GamePath.Delete();
     }
 }
        private void OnButtonSelectGamePathClicked(object sender, EventArgs args)
        {
            if (SelectGamePathDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var gamePath = new GamePath(SelectGamePathDialog.SelectedPath);

            if (gamePath.IsValid)
            {
                this.gamePath        = gamePath;
                TextBoxGamePath.Text = gamePath.RootDir;
                Log.Info("遊戲路徑設定為: " + gamePath.RootDir);
            }
            else
            {
                var text    = "此資料夾不存在: " + gamePath.UpkDir;
                var caption = "遊戲路徑不正確";
                MessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }