コード例 #1
0
        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>();
        }
コード例 #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());
        }
コード例 #3
0
 public void Dispose()
 {
     if (Directory.Exists(_outputDir))
     {
         Directory.Delete(_outputDir, true);
     }
     _manager = null;
 }
コード例 #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;
        }
コード例 #5
0
ファイル: Engine.cs プロジェクト: vadsiraly/ClickerGame
        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);
            };
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: skaarup/Draupner
        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);
            }
        }
コード例 #7
0
ファイル: CrudGenerator.cs プロジェクト: skaarup/Draupner
 public CrudGenerator(IGeneratorManager generatorManager)
     : base(command, description)
 {
     this.generatorManager = generatorManager;
 }
コード例 #8
0
 public StartProcessingBatchHandler(IGeneratorManager generatorManager)
 {
     this.generatorManager = generatorManager;
 }
コード例 #9
0
        public void SetUp()
        {
            generatorManagerMock = MockRepository.GenerateMock<IGeneratorManager>();

            crudGenerator = new CrudGenerator(generatorManagerMock);
        }