示例#1
0
            private void PokemonLoaderSwSh(object sender, EventArgs args)
            {
                if (!System.IO.Directory.Exists(Runtime.PkSwShGamePath))
                {
                    var result = MessageBox.Show("Please set your Pokemon Sword/Shield game path!");
                    if (result == DialogResult.OK)
                    {
                        FolderSelectDialog ofd = new FolderSelectDialog();
                        if (ofd.ShowDialog() == DialogResult.OK)
                        {
                            Runtime.PkSwShGamePath = ofd.SelectedPath;
                            Config.Save();
                        }
                    }
                }

                PokemonLoaderSwShForm form = new PokemonLoaderSwShForm();

                if (form.ShowDialog() == DialogResult.OK)
                {
                    if (form.SelectedPokemon != string.Empty)
                    {
                        string path = $"{Runtime.PkSwShGamePath}/bin/archive/pokemon/{form.SelectedPokemon}";
                        if (System.IO.File.Exists(path))
                        {
                            var file = STFileLoader.OpenFileFormat(path);

                            var currentForm = Runtime.MainForm.ActiveMdiChild;
                            if (currentForm != null && currentForm is ObjectEditor &&
                                Runtime.AddFilesToActiveObjectEditor)
                            {
                                ObjectEditor editor = currentForm as ObjectEditor;
                                editor.AddIArchiveFile(file);
                            }
                            else
                            {
                                ObjectEditor editor = new ObjectEditor();
                                editor.AddIArchiveFile(file);
                                LibraryGUI.CreateMdiWindow(editor);
                            }
                        }
                    }
                }
            }