예제 #1
0
        private static void DownloadMGDB(object o, EventArgs e)
        {
            if (Directory.Exists(MGDatabasePath))
            {
                var result = WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "MGDB already exists!", "Update MGDB?");
                if (result != DialogResult.Yes)
                {
                    return;
                }
                DeleteDirectory(MGDatabasePath); // Adding events will be handled by the next conditional
            }
            if (Directory.Exists(MGDatabasePath))
            {
                return;
            }

            var prompt = WinFormsUtil.Prompt(MessageBoxButtons.YesNo,
                                             "Download entire database?",
                                             "Download the entire database, which includes past generation events?",
                                             "Selecting No will download only the public release of the database.");

            var entire = prompt == DialogResult.Yes;

            EventsGallery.DownloadMGDBFromGitHub(MGDatabasePath, entire);
            WinFormsUtil.Alert("Download Finished");
            EncounterEvent.RefreshMGDB(MGDatabasePath);
        }
예제 #2
0
 static LegalityTest()
 {
     if (!EncounterEvent.Initialized)
     {
         EncounterEvent.RefreshMGDB();
     }
 }
예제 #3
0
        public static void RunLivingDexTests()
        {
            EncounterEvent.RefreshMGDB(Path.Combine(Directory.GetCurrentDirectory(), "mgdb"));
            RibbonStrings.ResetDictionary(GameInfo.Strings.ribbons);
            var  dir = Directory.GetCurrentDirectory();
            bool legalizer_settings = Legalizer.EnableEasterEggs;
            bool ribbon_settings    = APILegality.SetAllLegalRibbons;
            int  set_timeout        = APILegality.Timeout;
            bool inc_forms          = ModLogic.IncludeForms;
            bool set_shiny          = ModLogic.SetShiny;

            Legalizer.EnableEasterEggs     = false;
            APILegality.SetAllLegalRibbons = false;
            APILegality.Timeout            = 99999;
            var result_f_f = TestLivingDex(false, false, out bool p1);
            var result_f_t = TestLivingDex(false, true, out bool p2);
            var result_t_f = TestLivingDex(true, false, out bool p3);
            var result_t_t = TestLivingDex(true, true, out bool p4);
            var passed     = p1 && p2 && p3 && p4;

            Legalizer.EnableEasterEggs     = legalizer_settings;
            APILegality.SetAllLegalRibbons = ribbon_settings;
            APILegality.Timeout            = set_timeout;
            ModLogic.IncludeForms          = inc_forms;
            ModLogic.SetShiny = set_shiny;
            Directory.CreateDirectory(Path.Combine(dir, "logs"));

            var res = Status(result_f_f, false, false) + Environment.NewLine +
                      Status(result_t_f, true, false) + Environment.NewLine +
                      Status(result_f_t, false, true) + Environment.NewLine +
                      Status(result_t_t, true, true);

            File.WriteAllText(Path.Combine(dir, "logs", "output_livingdex.txt"), res);
            passed.Should().BeTrue($"Living Dex Successfully Genned (Output: \n\n{res}\n\n)");
        }
예제 #4
0
 static EncounterLearn()
 {
     if (!EncounterEvent.Initialized)
     {
         EncounterEvent.RefreshMGDB();
     }
 }
예제 #5
0
 static GeneratorTests()
 {
     if (!EncounterEvent.Initialized)
     {
         EncounterEvent.RefreshMGDB();
     }
 }
예제 #6
0
 static ShowdownSetTests()
 {
     if (!EncounterEvent.Initialized)
     {
         EncounterEvent.RefreshMGDB();
     }
 }
예제 #7
0
 private static void InitializeAutoLegality(LegalitySettings cfg)
 {
     Task.Run(InitializeCoreStrings);
     Task.Run(() => EncounterEvent.RefreshMGDB());
     InitializeTrainerDatabase(cfg);
     InitializeSettings(cfg);
 }
예제 #8
0
 private static void InitializePKHeXEnvironment()
 {
     if (!EncounterEvent.Initialized)
     {
         EncounterEvent.RefreshMGDB();
     }
     RibbonStrings.ResetDictionary(GameInfo.Strings.ribbons);
 }
    private async Task InitializeAsync(CancellationToken cancellationToken)
    {
        await Task.WhenAll(
            Task.Run(() => EncounterEvent.RefreshMGDB("./mgdb"), cancellationToken),
            Task.Run(InitializeTrainerDatabase, cancellationToken));

        Initialized = true;
    }
        private static void InitializeAutoLegality(PokeTradeHubConfig cfg)
        {
            Task.Run(InitializeCoreStrings);
            Task.Run(() => EncounterEvent.RefreshMGDB());
            InitializeTrainerDatabase(cfg);
            InitializeSettings(cfg);

            // Legalizer.AllowBruteForce = false;
        }
 private static void InitializeAutoLegality(LegalitySettings cfg)
 {
     InitializeCoreStrings();
     if (!EncounterEvent.Initialized)
     {
         EncounterEvent.RefreshMGDB(cfg.MGDBPath);
     }
     InitializeTrainerDatabase(cfg);
     InitializeSettings(cfg);
 }
예제 #12
0
        static LegalityTest()
        {
            if (EncounterEvent.Initialized)
            {
                return;
            }

            RibbonStrings.ResetDictionary(GameInfo.Strings.ribbons);
            EncounterEvent.RefreshMGDB();
        }
예제 #13
0
 private static void InitializeAutoLegality(LegalitySettings cfg)
 {
     InitializeCoreStrings();
     if (!EncounterEvent.Initialized)
     {
         EncounterEvent.RefreshMGDB();
     }
     InitializeTrainerDatabase(cfg);
     InitializeSettings(cfg);
     // Legalizer.AllowBruteForce = false;
 }
예제 #14
0
        //[Theory]
        //[InlineData(B2, true, true)]
        //[InlineData(B, true, true)]
        //[InlineData(Pt, true, true)]
#pragma warning disable xUnit1013 // Only for internal debugging
        public static void VerifyManually(GameVersion s, bool includeforms, bool shiny)
#pragma warning restore xUnit1013 // Only for internal debugging
        {
            EncounterEvent.RefreshMGDB(Path.Combine(Directory.GetCurrentDirectory(), "mgdb"));
            RibbonStrings.ResetDictionary(GameInfo.Strings.ribbons);
            APILegality.Timeout = 99999;
            var passed = true;
            var res    = s.SingleSaveTest(includeforms, shiny, ref passed);

            passed.Should().BeTrue();
        }
예제 #15
0
 public static void InitializePKHeXEnvironment()
 {
     if (Initialized)
     {
         return;
     }
     if (!EncounterEvent.Initialized)
     {
         EncounterEvent.RefreshMGDB();
     }
     RibbonStrings.ResetDictionary(GameInfo.Strings.ribbons);
     Initialized = true;
 }
예제 #16
0
        public Startup(IConfiguration configuration)
        {
            // Initalize everything needed
            Helpers.MoveType.MT = File.ReadAllLines("./Moves.csv").Skip(1).Select(m => Helpers.MoveType.ReadCsv(m)).ToList();
            Helpers.Sprite.loadJSON();
            EncounterEvent.RefreshMGDB(string.Empty);
            RibbonStrings.ResetDictionary(GameInfo.Strings.ribbons);

            /*LegalityAnalysis.ChangeLocalizationStrings.
             * LegalityAnalysis.MoveStrings = GameInfo.Strings.movelist;
             * LegalityAnalysis.SpeciesStrings = GameInfo.Strings.specieslist;*/

            Configuration = configuration;
        }
예제 #17
0
        public Main()
        {
            Form splash = null; // popup a splash screen in another thread

            new Task(() => (splash = new SplashScreen()).ShowDialog()).Start();
            new Task(() => EncounterEvent.RefreshMGDB(MGDatabasePath)).Start();
            string[] args = Environment.GetCommandLineArgs();
            FormLoadInitialSettings(args, out bool showChangelog, out bool BAKprompt);

            InitializeComponent();
            C_SAV.SetEditEnvironment(new SaveDataEditor <PictureBox>(null, PKME_Tabs));
            FormLoadAddEvents();
            #if DEBUG // translation updater -- all controls are added at this point -- call translate now
            if (DevUtil.IsUpdatingTranslations)
            {
                WinFormsUtil.TranslateInterface(this, CurrentLanguage); // Translate the UI to language.
            }
            #endif
            FormInitializeSecond();

            FormLoadCustomBackupPaths();
            FormLoadInitialFiles(args);
            FormLoadCheckForUpdates();
            FormLoadPlugins();

            BringToFront();
            WindowState = FormWindowState.Minimized;
            Show();
            WindowState = FormWindowState.Normal;
            splash.Invoke((MethodInvoker)(() => splash.Close())); // splash closes
            if (HaX)
            {
                PKMConverter.AllowIncompatibleConversion = true;
                WinFormsUtil.Alert(MsgProgramIllegalModeActive, MsgProgramIllegalModeBehave);
            }
            else if (showChangelog)
            {
                ShowAboutDialog(1);
            }

            if (BAKprompt && !Directory.Exists(BackupPath))
            {
                PromptBackup();
            }
        }
예제 #18
0
 public static void InitializePKHeXEnvironment()
 {
     lock (_lock)
     {
         if (Initialized)
         {
             return;
         }
         if (!EncounterEvent.Initialized)
         {
             EncounterEvent.RefreshMGDB();
         }
         RibbonStrings.ResetDictionary(GameInfo.Strings.ribbons);
         Legalizer.EnableEasterEggs     = false;
         APILegality.SetAllLegalRibbons = false;
         APILegality.Timeout            = 99999;
         Initialized = true;
     }
 }
예제 #19
0
        private static void Main()
        {
#if !DEBUG
            // Add the event handler for handling UI thread exceptions to the event.
            Application.ThreadException += UIThreadException;

            // Set the unhandled exception mode to force all Windows Forms errors to go through our handler.
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            // Add the event handler for handling non-UI thread exceptions to the event.
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
#endif
            // Run the application
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var splash = new SplashScreen();
            new Task(() => splash.ShowDialog()).Start();
            new Task(() => EncounterEvent.RefreshMGDB(WinForms.Main.MGDatabasePath)).Start();
            var main = new Main();
            splash.Invoke(() => splash.ForceClose());
            Application.Run(main);
        }
예제 #20
0
        static void Main(string[] args)
        {
            string appPath = Environment.CurrentDirectory;

            mt = File.ReadAllLines("./coreconsole/Moves.csv").Skip(1).Select(m => MoveType.ReadCsv(m)).ToList();

            if (args.Contains("-server"))
            {
                // Init the database
                EncounterEvent.RefreshMGDB(string.Empty);
                RibbonStrings.ResetDictionary(GameInfo.Strings.ribbons);
                LegalityAnalysis.MoveStrings    = GameInfo.Strings.movelist;
                LegalityAnalysis.SpeciesStrings = GameInfo.Strings.specieslist;
                moveNames = Util.GetMovesList(GameLanguage.DefaultLanguage);
                // Init Move Types DB

                var server1 = new Server();
                server1.Server_start(7272, "legality_check", false);
                var server2 = new Server();
                server2.Server_start(7273, "info_get", false);
                var server3 = new Server();
                server3.Server_start(7274, "legal_fix", false);
                var server4 = new Server();
                server4.Server_start(7275, "bot_info", true);
            }
            else
            {
                Initialize(args);
                if (args.Contains("-l"))
                {
                    // Legality API calls
                    var lc = new LegalityCheck(pk);
                    if (args.Contains("--verbose"))
                    {
                        Console.WriteLine(lc.VerboseReport);
                    }
                    else
                    {
                        Console.WriteLine(lc.Report);
                    }
                }
                if (args.Contains("-alm"))
                {
                    if (!args.Contains("--version"))
                    {
                        Console.WriteLine("Specify version with the [--version] tag");
                    }
                    else
                    {
                        var alm = new AutoLegality(pk, args[Array.IndexOf(args, "--version") + 1]);
                        if (alm != null)
                        {
                            if (!args.Contains("-o"))
                            {
                                string output = Util.CleanFileName(alm.GetLegalPKM().FileName);
                                File.WriteAllBytes(Path.Combine(appPath, "output", output), alm.GetLegalPKM().DecryptedBoxData);
                            }
                            else
                            {
                                string output = GetOutputPath(args);
                                File.WriteAllBytes(output, alm.GetLegalPKM().DecryptedBoxData);
                            }
                        }
                        else
                        {
                            Console.WriteLine("Invalid version");
                        }
                    }
                }
            }
        }
예제 #21
0
 static ShowdownSetTests()
 {
     // Initialize the Mystery Gift Databases for generating
     EncounterEvent.RefreshMGDB();
 }