Exemple #1
0
 public InvertLineStartPlugin(IServiceLocator serviceLocator)
 {
     _serviceLocator  = serviceLocator;
     _blockController = serviceLocator.GetInstance <IBlockController>();
     _blockFactory    = serviceLocator.GetInstance <IBlockFactory>();
     _blockHelper     = serviceLocator.GetInstance <IBlockHelper>();
 }
Exemple #2
0
 public GameMechanics(IField field, IBlockFactory blockFactory)
 {
     this.field = field;
     this.blockFactory = blockFactory;
     this.currentBlock = blockFactory.MakeBlock();
     field.SetBlock(currentBlock, new Vector2(0, 0));
 }
Exemple #3
0
    public StoryboardParserTests()
    {
        blockFactory = new FakeBlockFactory();
        dismissNodes = new();
        parsingContext = A.Fake<IParsingContext>(i => i.Strict());
        A.CallTo(() => parsingContext.RegisterDismissNode(A<INode>.Ignored))
            .Invokes(i => dismissNodes.Add(i.Arguments.Get<INode>(0)));
        A.CallTo(() => parsingContext.BlockFactory).Returns(blockFactory);

        rootBlockParser = A.Fake<IRootBlockParser>(i => i.Strict());
        sceneNavigator = A.Fake<ISceneNavigator>(i => i.Strict());
        eventManager = A.Fake<IEventManager>(i => i.Strict());
        randomizer = A.Fake<IRandomizer>(i => i.Strict());
        navigationState = A.Fake<INavigationState>(i => i.Strict());
        variableDictionary = A.Fake<IVariableDictionary>(i => i.Strict());
        blockState = A.Fake<IBlockState>(i => i.Strict());

        var serviceProvider = A.Fake<IServiceProvider>(i => i.Strict());
        A.CallTo(() => serviceProvider.GetService(typeof(IParsingContext))).Returns(parsingContext);
        A.CallTo(() => serviceProvider.GetService(typeof(IRootBlockParser))).Returns(rootBlockParser);
        A.CallTo(() => serviceProvider.GetService(typeof(ISceneNavigator))).Returns(sceneNavigator);
        A.CallTo(() => serviceProvider.GetService(typeof(IEventManager))).Returns(eventManager);
        A.CallTo(() => serviceProvider.GetService(typeof(IRandomizer))).Returns(randomizer);
        A.CallTo(() => serviceProvider.GetService(typeof(INavigationState))).Returns(navigationState);
        A.CallTo(() => serviceProvider.GetService(typeof(IVariableDictionary))).Returns(variableDictionary);
        A.CallTo(() => serviceProvider.GetService(typeof(IBlockState))).Returns(blockState);
        sut = new StoryboardParser(serviceProvider);
    }
 public VirtualDiskStream(string vhdPath)
 {
     this.vhdFile      = new VhdFileFactory().Create(vhdPath);
     this.blockFactory = vhdFile.GetBlockFactory();
     footerRange       = this.blockFactory.GetFooterRange();
     fileDataRange     = IndexRange.FromLength(0, this.Length - footerRange.Length);
 }
Exemple #5
0
        public TaskExecutionContext(ITasklingConfiguration configuration,
                                    ITaskExecutionRepository taskExecutionRepository,
                                    ICriticalSectionRepository criticalSectionRepository,
                                    IBlockFactory blockFactory,
                                    IRangeBlockRepository rangeBlockRepository,
                                    IListBlockRepository listBlockRepository,
                                    IObjectBlockRepository objectBlockRepository,
                                    ICleanUpService cleanUpService,
                                    string applicationName,
                                    string taskName,
                                    TaskExecutionOptions taskExecutionOptions)
        {
            _configuration             = configuration;
            _taskExecutionRepository   = taskExecutionRepository;
            _criticalSectionRepository = criticalSectionRepository;
            _blockFactory          = blockFactory;
            _rangeBlockRepository  = rangeBlockRepository;
            _listBlockRepository   = listBlockRepository;
            _objectBlockRepository = objectBlockRepository;
            _cleanUpService        = cleanUpService;

            _taskExecutionInstance = new TaskExecutionInstance();
            _taskExecutionInstance.ApplicationName = applicationName;
            _taskExecutionInstance.TaskName        = taskName;

            _taskExecutionOptions = taskExecutionOptions;

            _executionHasFailed = false;

            _taskConfiguration = _configuration.GetTaskConfiguration(applicationName, taskName);
        }
 public DifferencingDiskBlockFactory(VhdFile vhdFile)
     : base(vhdFile)
 {
     this.bitMapFactory = new BitMapFactory(vhdFile);
     this.sectorFactory = new SectorFactory(vhdFile, this);
     this.parentBlockFactory = vhdFile.Parent.DiskType != DiskType.Fixed ? vhdFile.Parent.GetBlockFactory() : new FixedDiskBlockFactory(vhdFile.Parent, this.GetBlockSize());
 }
 public VirtualDiskStream(string vhdPath)
 {
     this.vhdFile = new VhdFileFactory().Create(vhdPath);
     this.blockFactory = vhdFile.GetBlockFactory();
     footerRange = this.blockFactory.GetFooterRange();
     fileDataRange = IndexRange.FromLength(0, this.Length - footerRange.Length);
 }
Exemple #8
0
 public CreateBlocksItem(
     string text,
     IBlockFactory factory)
     : base(text)
 {
     Factory = factory;
     Init();
 }
 public ReplaceMemberEmptyBlockItem(
     string text,
     IBlockFactory factory,
     FieldBlock empty)
     : base(text, factory)
 {
     emptyBlock = empty;
 }
    public void InitializeFactoriesAndSetting()
    {
        //blockViewSpawner = Substitute.For<IBlockViewSpawner>();
        blockFactory = new BlockFactory(blockViewSpawner);
        groupFactory = new GroupFactory(blockFactory);

        setting = TestSetting.Get();
    }
 public ReplaceTypeEmptyBlockItem(
     string text,
     IBlockFactory factory,
     TypeEmptyBlock empty)
     : base(text, factory)
 {
     emptyBlock = empty;
 }
Exemple #12
0
 private ComplexFile(string path, FileMode mode)
     : base(path, mode)
 {
     Settings      = DefaultSettings.Instance; //TODO Load settings from zero block
     blockFactory  = BlockFactory.Instance;
     headerFactory = HeaderFactory.Instance;
     TOCs          = GetTOCs();
 }
Exemple #13
0
        public Miner(IBlockFactory blockFactory, IFifoQueue unconfirmedData)
        {
            _blockFactory        = blockFactory;
            _unconfirmedDataFifo = unconfirmedData;
            var genesisBlock = _blockFactory.GenerateGenesisBlock();

            Blockchain = new Blockchain(genesisBlock);
        }
        public ReplaceTypeEmptyBlockItem(
			string text,
			IBlockFactory factory,
			TypeEmptyBlock empty)
            : base(text, factory)
        {
            emptyBlock = empty;
        }
Exemple #15
0
    public void InitializeFactoriesAndSetting()
    {
        //blockViewSpawner = Substitute.For<IBlockViewSpawner>();
        blockFactory = new BlockFactory(blockViewSpawner);
        groupFactory = new GroupFactory(blockFactory);

        setting = TestSetting.Get();
    }
 public static TemplateDescription CreateTemplate(IBlockFactory blockFactory)
 {
     return(new TemplateDescription
     {
         Id = Guid.NewGuid(),
         Group = blockFactory.Category,
         Name = blockFactory.Name,
     });
 }
Exemple #17
0
 public Engine(IBlockFactory blobFactory, IAttackFactory attackFactory,
     IBehaviorFactory behaviorFactory, IReader reader, IWriter writer, IData data)
 {
     this.blobFactory = blobFactory;
     this.attackFactory = attackFactory;
     this.behaviorFactory = behaviorFactory;
     this.reader = reader;
     this.writer = writer;
     this.data = data;
 }
Exemple #18
0
        public Miner(IBlockFactory blockFactory, IFifoQueue unconfirmedData, Miner minerBefore)
        {
            _blockFactory        = blockFactory;
            _unconfirmedDataFifo = unconfirmedData;
            var genesisBlock = _blockFactory.GenerateGenesisBlock();

            Blockchain = new Blockchain(genesisBlock);

            FixPointers(minerBefore);
        }
Exemple #19
0
        public SheetEllipseMode(IServiceLocator serviceLocator, SheetState state)
        {
            this._serviceLocator  = serviceLocator;
            this._blockController = serviceLocator.GetInstance <IBlockController>();
            this._blockFactory    = serviceLocator.GetInstance <IBlockFactory>();
            this._blockHelper     = serviceLocator.GetInstance <IBlockHelper>();
            this._itemController  = serviceLocator.GetInstance <IItemController>();
            this._pointController = serviceLocator.GetInstance <IPointController>();

            this._state = state;
        }
Exemple #20
0
 public BlocksController(SimpleBlockChain blockChain,
                         PeerToPeerService p2pService,
                         ILogger <BlocksController> logger,
                         IBlockFactory <SimpleBlock, string> blockFactory
                         )
 {
     _blockChain   = blockChain ?? throw new ArgumentNullException(nameof(blockChain));
     _p2PService   = p2pService ?? throw new ArgumentNullException(nameof(p2pService));
     _logger       = logger ?? throw new ArgumentNullException(nameof(logger));
     _blockFactory = blockFactory;
 }
Exemple #21
0
    public ChunkSection(IChunk chunk, int index, IServiceProvider serviceProvider)
    {
        Chunk             = chunk;
        Index             = index;
        _serviceProvider  = serviceProvider;
        _blocks           = new IBlock[MaximumBlockAmount];
        _blockFactory     = _serviceProvider.GetRequiredService <IBlockFactory>();
        _registry         = _serviceProvider.GetRequiredService <IRegistry>();
        _blockStorage     = new CompactedLongArray(DefaultBitsPerBlock, MaximumBlockAmount);
        _palette          = new BlockStatePalette(DefaultBitsPerBlock, MaximumBitsPerBlock);
        _palette.Resized += OnPaletteResized;

        Initialize();
    }
Exemple #22
0
        public void ParserShouldCallSBlockFactoryWhenParsingStatements()
        {
            IList <StatementBase> input = new List <StatementBase>();

            input.Add(StatementCreator.CreateMemberStatement("_someString"));

            IBlockFactory factory = Mocker.StrictMock <IBlockFactory>();

            Expect.Call(factory.Create(input)).Return(new [] { new BlockBaseImpl(input) }).Repeat.Once();

            StubBlockFactoryProvider provider = new StubBlockFactoryProvider(factory);

            CalidusBlockParser parser = new CalidusBlockParser(provider);

            Mocker.ReplayAll();

            parser.Parse(input);

            Mocker.VerifyAll();
        }
        public IBlock CreateBlock()
        {
            IBlockFactory block_factory = null;

            switch ((int)random.Next(1, 8))
            {
            case 1:
                block_factory = new BlockOFactory();
                break;

            case 2:
                block_factory = new BlockIFactory();
                break;

            case 3:
                block_factory = new BlockLFactory();
                break;

            case 4:
                block_factory = new BlockLOFactory();
                break;

            case 5:
                block_factory = new BlockSFactory();
                break;

            case 6:
                block_factory = new BlockSOFactory();
                break;

            case 7:
                block_factory = new BlockEFactory();
                break;

            default:
                break;
            }

            return(block_factory.CreateBlock());
        }
        public TasklingClient(IConfigurationReader configurationReader,
            CustomDependencies customDependencies)
        {
            if (customDependencies.TaskRepository == null)
                customDependencies.TaskRepository = new TaskRepository();

            if (customDependencies.Configuration == null)
                _configuration = new TasklingConfiguration(configurationReader);

            if (customDependencies.CommonTokenRepository == null)
                customDependencies.CommonTokenRepository = new CommonTokenRepository();

            if (customDependencies.ExecutionTokenRepository == null)
                customDependencies.ExecutionTokenRepository = new ExecutionTokenRepository(customDependencies.CommonTokenRepository);

            if (customDependencies.EventsRepository == null)
                customDependencies.EventsRepository = new EventsRepository();

            if (customDependencies.TaskExecutionRepository != null)
                _taskExecutionRepository = customDependencies.TaskExecutionRepository;
            else
                _taskExecutionRepository = new TaskExecutionRepository(customDependencies.TaskRepository, customDependencies.ExecutionTokenRepository, customDependencies.EventsRepository);

            if (customDependencies.CriticalSectionRepository != null)
                _criticalSectionRepository = customDependencies.CriticalSectionRepository;
            else
                _criticalSectionRepository = new CriticalSectionRepository(customDependencies.TaskRepository, customDependencies.CommonTokenRepository);

            if (customDependencies.BlockRepository == null)
                customDependencies.BlockRepository = new BlockRepository(customDependencies.TaskRepository);

            if (customDependencies.RangeBlockRepository != null)
                _rangeBlockRepository = customDependencies.RangeBlockRepository;
            else
                _rangeBlockRepository = new RangeBlockRepository(customDependencies.TaskRepository);

            if (customDependencies.ListBlockRepository != null)
                _listBlockRepository = customDependencies.ListBlockRepository;
            else
                _listBlockRepository = new ListBlockRepository(customDependencies.TaskRepository);

            if (customDependencies.ObjectBlockRepository != null)
                _objectBlockRepository = customDependencies.ObjectBlockRepository;
            else
                _objectBlockRepository = new ObjectBlockRepository(customDependencies.TaskRepository);

            if (customDependencies.BlockFactory != null)
                _blockFactory = customDependencies.BlockFactory;
            else
                _blockFactory = new BlockFactory(customDependencies.BlockRepository, _rangeBlockRepository, _listBlockRepository, _objectBlockRepository, _taskExecutionRepository);

            if (customDependencies.CleanUpRepository == null)
                customDependencies.CleanUpRepository = new CleanUpRepository(customDependencies.TaskRepository);

            if (customDependencies.CleanUpService != null)
                _cleanUpService = customDependencies.CleanUpService;
            else
                _cleanUpService = new CleanUpService(_configuration, customDependencies.CleanUpRepository);
        }
Exemple #25
0
 public StubBlockFactoryProvider(IBlockFactory fct)
 {
     _factories = new List <IBlockFactory>();
     _factories.Add(fct);
 }
 // note XL - might add additional connection validation
 public FlowModelBuilder(IBlockFactory blockFactory)
 {
     this._blockFactory = blockFactory;
 }
 public FlowExecutor(Action <IFlowBuilder> flowFactory, IBlockFactory blockFactory = null)
 {
     this._flowFactory  = flowFactory;
     this._blockFactory = blockFactory ?? new DefaultBlockFactory();
 }
Exemple #28
0
 public SheetPageFactory(IServiceLocator serviceLocator)
 {
     this._serviceLocator = serviceLocator;
     this._blockFactory   = serviceLocator.GetInstance <IBlockFactory>();
 }
Exemple #29
0
 public ParsingContextTests()
 {
     blockFactory        = A.Dummy <IBlockFactory>();
     parsingSceneContext = A.Dummy <ParsingSceneContext>();
     sut = new(blockFactory, parsingSceneContext);
 }
Exemple #30
0
 public GroupFactory(IBlockFactory blockFactory, List <IGroupPattern> groupPatternList) : this(blockFactory)
 {
     _groupPatternList = groupPatternList;
 }
Exemple #31
0
 public Block(IBlockFactory blockFactory)
 {
     this.blockFactory = blockFactory;
 }
Exemple #32
0
 public NextBlockFinder(IBlockFactory blockFactory, IHashFilter hashFilter, NodeSettings nodeSettings)
 {
     _blockFactory = blockFactory;
     _hashFilter   = hashFilter;
     _nodeSettings = nodeSettings;
 }
Exemple #33
0
 public GameMechanics(IField field, IBlockFactory blockFactory)
 {
     this.field = field;
     this.blockFactory = blockFactory;
     StartNewBlock();
 }
 public SectorFactory(VhdFile vhdFile, IBlockFactory blockFactory)
 {
     this.vhdFile = vhdFile;
     this.blockFactory = blockFactory;
 }
        public TasklingClient(IConfigurationReader configurationReader,
            ITaskRepository taskRepository = null,
            ITasklingConfiguration configuration = null,
            ITaskExecutionRepository taskExecutionRepository = null,
            IExecutionTokenRepository executionTokenRepository = null,
            ICommonTokenRepository commonTokenRepository = null,
            IEventsRepository eventsRepository = null,
            ICriticalSectionRepository criticalSectionRepository = null,
            IBlockFactory blockFactory = null,
            IBlockRepository blockRepository = null,
            IRangeBlockRepository rangeBlockRepository = null,
            IListBlockRepository listBlockRepository = null,
            IObjectBlockRepository objectBlockRepository = null,
            ICleanUpService cleanUpService = null,
            ICleanUpRepository cleanUpRepository = null)
        {
            if (taskRepository == null)
                taskRepository = new TaskRepository();

            if (configuration == null)
                _configuration = new TasklingConfiguration(configurationReader);

            if (commonTokenRepository == null)
                commonTokenRepository = new CommonTokenRepository();

            if (executionTokenRepository == null)
                executionTokenRepository = new ExecutionTokenRepository(commonTokenRepository);

            if (eventsRepository == null)
                eventsRepository = new EventsRepository();

            if (taskExecutionRepository != null)
                _taskExecutionRepository = taskExecutionRepository;
            else
                _taskExecutionRepository = new TaskExecutionRepository(taskRepository, executionTokenRepository, eventsRepository);

            if (criticalSectionRepository != null)
                _criticalSectionRepository = criticalSectionRepository;
            else
                _criticalSectionRepository = new CriticalSectionRepository(taskRepository, commonTokenRepository);

            if (blockRepository == null)
                blockRepository = new BlockRepository(taskRepository);

            if (rangeBlockRepository != null)
                _rangeBlockRepository = rangeBlockRepository;
            else
                _rangeBlockRepository = new RangeBlockRepository(taskRepository);

            if (listBlockRepository != null)
                _listBlockRepository = listBlockRepository;
            else
                _listBlockRepository = new ListBlockRepository(taskRepository);

            if (objectBlockRepository != null)
                _objectBlockRepository = objectBlockRepository;
            else
                _objectBlockRepository = new ObjectBlockRepository(taskRepository);

            if (blockFactory != null)
                _blockFactory = blockFactory;
            else
                _blockFactory = new BlockFactory(blockRepository, _rangeBlockRepository, _listBlockRepository, _objectBlockRepository, _taskExecutionRepository);

            if (cleanUpRepository == null)
                cleanUpRepository = new CleanUpRepository(taskRepository);

            if (cleanUpService != null)
                _cleanUpService = cleanUpService;
            else
                _cleanUpService = new CleanUpService(_configuration, cleanUpRepository);
        }
Exemple #36
0
 public DifferencingDiskBlockFactory(VhdFile vhdFile) : base(vhdFile)
 {
     this.bitMapFactory      = new BitMapFactory(vhdFile);
     this.sectorFactory      = new SectorFactory(vhdFile, this);
     this.parentBlockFactory = vhdFile.Parent.DiskType != DiskType.Fixed ? vhdFile.Parent.GetBlockFactory() : new FixedDiskBlockFactory(vhdFile.Parent, this.GetBlockSize());
 }
 public Block(IBlockFactory blockFactory)
 {
     this.blockFactory = blockFactory;
 }
Exemple #38
0
 public GroupFactory(IBlockFactory blockFactory)
 {
     _blockFactory = blockFactory;
 }
Exemple #39
0
 public ReplaceBlocksItem(
     string text,
     IBlockFactory factory)
     : base(text, factory)
 {
 }
Exemple #40
0
 public GameMechanics(IField field, IBlockFactory blockFactory)
 {
     this.field = field;
     this.blockFactory = blockFactory;
     field.SetBlock(blockFactory.MakeBlock(), new Vector2(field.Width / 2, 0));
 }
 public BlockTemplateDescriptionViewModel(IViewModelServiceProvider serviceProvider, IBlockFactory blockFactory) : base(serviceProvider, CreateTemplate(blockFactory))
 {
     BlockFactory = blockFactory;
 }
Exemple #42
0
 public EmptyBlockItem(string displayName, IBlockFactory factory)
     : base(displayName, factory)
 {
 }
Exemple #43
0
 public void AddSeparatorType <T>()
 {
     SeparatorFactory = BlockActivatorFactory.CreateFactory <T>();
 }