Exemplo n.º 1
0
        // update game executable
        private static void ExeOps(int seed, SpoilerFile spoilerFile)
        {
            Debug.WriteLine("exe ops start");
            while (true && !Globals.Remastered)
            {
                try
                {
                    // draw point shuffle
                    if (Properties.Settings.Default.DrawPointShuffle)
                    {
                        var shuffle = DrawPointShuffle.Randomise(seed);
                        if (Properties.Settings.Default.SpoilerFile)
                        {
                            spoilerFile.AddDrawPoints(shuffle);
                        }
                        DrawPointShuffle.GeneratePatch(shuffle).Apply(Globals.ExePath);
                    }
                    else
                    {
                        DrawPointShuffle.RemovePatch(Globals.ExePath);
                    }

                    break;
                }
                catch (Exception x)
                {
                    if (x is IOException || x is UnauthorizedAccessException || x is FileNotFoundException)
                    {
                        if (HandleFileException(Globals.ExePath) == false)
                        {
                            break;
                        }
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            Debug.WriteLine("exe ops end");
        }
Exemplo n.º 2
0
        // update menu archive
        private static void MenuOps(int seed, SpoilerFile spoilerFile, State settings)
        {
            Debug.WriteLine("menu ops start");
            while (true)
            {
                try
                {
                    CreateOrRestoreArchiveBackup(Globals.MenuPath);
                    var menuSource = new FileSource(Globals.MenuPath);

                    // preset names
                    if (settings.NameEnable)
                    {
                        PresetNames.Apply(menuSource, settings);
                    }

                    // shop shuffle
                    if (settings.ShopEnable)
                    {
                        var shuffle = ShopShuffle.Randomise(seed, settings);
                        if (settings.SpoilerFile)
                        {
                            spoilerFile.AddShops(shuffle);
                        }
                        ShopShuffle.Apply(menuSource, shuffle);
                    }

                    // draw point shuffle
                    if (!Globals.Remastered)
                    {
                        if (settings.DrawPointEnable)
                        {
                            var shuffle = DrawPointShuffle.Randomise(seed, settings);
                            if (settings.SpoilerFile)
                            {
                                spoilerFile.AddDrawPoints(shuffle);
                            }
                            DrawPointShuffle.Apply(menuSource, shuffle);
                        }
                        else
                        {
                            DrawPointShuffle.RemovePatch(Globals.ExePath);
                        }
                    }

                    if (settings.NameEnable || settings.ShopEnable || (settings.DrawPointEnable && !Globals.Remastered))
                    {
                        menuSource.Encode();
                    }

                    break;
                }
                catch (Exception x)
                {
                    if (x is IOException || x is UnauthorizedAccessException || x is FileNotFoundException)
                    {
                        if (HandleFileException(Globals.MenuPath) == false)
                        {
                            break;
                        }
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            Debug.WriteLine("menu ops end");
        }