public PokemonGeneratorRunnerTests()
        {
            _contentDir = Directory.GetCurrentDirectory();
            _outputDir  = Path.Combine(_contentDir, $"Test-{Guid.NewGuid()}");
            _opts       = new PersistentConfig
            {
                Options = new ProgramOptions
                {
                    PlayerOne = new PlayerOptions
                    {
                        GameVersion        = PokemonGame.Gold.ToString(),
                        InputSaveLocation  = Path.Combine(_contentDir, "gold.sav"),
                        OutputSaveLocation = Path.Combine(_outputDir, "out1.sav"),
                        Name = "Test1"
                    },
                    PlayerTwo = new PlayerOptions
                    {
                        GameVersion        = PokemonGame.Gold.ToString(),
                        InputSaveLocation  = Path.Combine(_contentDir, "gold.sav"),
                        OutputSaveLocation = Path.Combine(_outputDir, "out2.sav"),
                        Name = "Test2"
                    },
                    Level = 100
                }
            };

            AppDomain.CurrentDomain.SetData("DataDirectory", _contentDir);
            var options = DependencyInjector.Get <IOptions <PersistentConfig> >();

            options.Value.Options = _opts.Options;
            _manager      = DependencyInjector.Get <IGeneratorManager>();
            _deserializer = DependencyInjector.Get <ISaveFileRepository>();
        }
Ejemplo n.º 2
0
        public MainWindow(
            IGeneratorManager generatorManager,
            IOptions <PersistentConfig> options,
            IP64ConfigRepository ip64ConfigRepository,
            INRageConfigRepository inRageConfigRepository,
            IConfigRepository configRepository,
            IPokeGeneratorOptionsValidator optionsValidator)
        {
            _generatorManager       = generatorManager;
            _inRageConfigRepository = inRageConfigRepository;
            _configRepository       = configRepository;
            _ip64ConfigRepository   = ip64ConfigRepository;
            _optionsValidator       = optionsValidator;
            _options = options;

            // Init
            InitializeComponent();
            GroupBoxPlayerOneOptions.Player = 1;
            GroupBoxPlayerTwoOptions.Player = 2;

            // Data Bind
            MainWindowBindingSource.DataSource  = _options.Value.Options;
            GroupBoxPlayerOneOptions.DataSource = _options.Value.Options.PlayerOne;
            GroupBoxPlayerTwoOptions.DataSource = _options.Value.Options.PlayerTwo;

            // Listen to children opening windows
            GroupBoxPlayerOneOptions.WindowOpenedEvent += ChildWindowOpenedEvent;
            GroupBoxPlayerTwoOptions.WindowOpenedEvent += ChildWindowOpenedEvent;

            GroupBoxPlayerOneOptions.WindowClosedEvent += ChildWindowClosedEvent;
            GroupBoxPlayerTwoOptions.WindowClosedEvent += ChildWindowClosedEvent;

            // Register keys
            RegisterHotKey(Handle, 0, (int)KeyModifier.Control, Keys.F12.GetHashCode());
        }
 public void Dispose()
 {
     if (Directory.Exists(_outputDir))
     {
         Directory.Delete(_outputDir, true);
     }
     _manager = null;
 }
Ejemplo n.º 4
0
        public ProcessorService(IGeneratorManager generatorManager,
                                IMultiplierManager multiplierManager,
                                IBatchRepository batchRepository,
                                ILogger <ProcessorService> logger)
        {
            _generatorManager  = generatorManager;
            _multiplierManager = multiplierManager;
            _batchRepository   = batchRepository;
            _logger            = logger;

            _generatorManager.GeneratorEventHandler   += GeneratorCallback;
            _multiplierManager.MultiplierEventHandler += MultiplierCallback;
        }
Ejemplo n.º 5
0
        public Engine()
        {
            _currentValue     = new Value(0, 0);
            LastExecution     = DateTime.Now;
            ValuePerTick      = new Value(0, 0);
            BaseValuePerTick  = new Value(0, 0);
            BaseValuePerClick = new Value(10, 0);
            ValuePerClick     = new Value(10, 0);

            _purchasedAdditiveBonuses       = new List <Bonus>();
            _purchasedMultiplicativeBonuses = new List <Bonus>();

            _generatorManager = new GeneratorManager();

            CurrentValueChanged += (s, e) =>
            {
                _generatorManager.Update(CurrentValue);
            };
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            try
            {
                Ioc.Configure();
                generatorManager = Ioc.Container.Resolve<IGeneratorManager>();

                if (args.Length == 0)
                {
                    ShowHelp();
                    return;
                }

                string command = FindCommand(args);
                var generatorArgs = args.Skip(1).ToList();

                generatorManager.ExecuteGenerator(command, generatorArgs);
            } catch(EntityNotFoundException e)
            {
                Console.WriteLine(e.Message);
            } catch(GeneratorNotFoundException e)
            {
                Console.WriteLine(e.Message);
            }
            catch (ConfigurationFileNotFoundException e)
            {
                Console.WriteLine(e.Message + ". Are you sure this is a scaffolded project?");
            } catch(EntityParsingException e)
            {
                Console.WriteLine("Error parsing exception: " + e.Message);
            } catch(IllegalGeneratorArgs e)
            {
                Console.WriteLine("Incorrect number of arguments");
                Console.WriteLine(e.Message);
            }
        }
Ejemplo n.º 7
0
 public CrudGenerator(IGeneratorManager generatorManager)
     : base(command, description)
 {
     this.generatorManager = generatorManager;
 }
Ejemplo n.º 8
0
 public StartProcessingBatchHandler(IGeneratorManager generatorManager)
 {
     this.generatorManager = generatorManager;
 }
Ejemplo n.º 9
0
        public void SetUp()
        {
            generatorManagerMock = MockRepository.GenerateMock<IGeneratorManager>();

            crudGenerator = new CrudGenerator(generatorManagerMock);
        }