示例#1
0
 public Block CreateSeparator()
 {
     if (SeparatorFactory == null)
     {
         return(null);
     }
     return(SeparatorFactory.CreateBlock());
 }
示例#2
0
 void MigrateNextBlockToContainer()
 {
     if (!m_block_container.AddBlock(m_block_next))
     {
         IsGameOver = true;
     }
     m_block_next = m_random_factory.CreateBlock();
 }
示例#3
0
 public string CreateDirectory(string name, string localizationId)
 {
     try
     {
         var fileHeader   = headerFactory.CreateDirectory(name);
         TOC tocForHeader = GetTOCForHeader(fileHeader, localizationId);
         fileHeader.BlockNumber = BlockNumber;
         WriteNewTOC();
         tocForHeader.AddFileHeader(fileHeader);
         Position = (tocForHeader.BlockNumber * Settings.BlockSize);
         Write(blockFactory.CreateBlock(tocForHeader), 0, Settings.BlockSize);
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
     return("The directory was created successfully");
 }
示例#4
0
        public async void Post([FromBody] string value)
        {
            SimpleBlock lastBlock = _blockChain.LatestBlock;
            SimpleBlock newBlock  = _blockFactory.CreateBlock(lastBlock, value);

            _blockChain.Add(newBlock);
            await _p2PService.Broadcast(_p2PService.ResponseLatestMessage());

            string s = JsonConvert.SerializeObject(newBlock);

            _logger.LogInformation("Block added: " + s);
        }
示例#5
0
        public XBlock Deserialize(ISheet sheet, XBlock parent, ItemBlock blockItem, double thickness)
        {
            var block = _blockFactory.CreateBlock(blockItem.Id,
                                                  blockItem.X,
                                                  blockItem.Y,
                                                  blockItem.Width,
                                                  blockItem.Height,
                                                  blockItem.DataId,
                                                  blockItem.Name,
                                                  blockItem.Backgroud);

            foreach (var textItem in blockItem.Texts)
            {
                Deserialize(sheet, block, textItem);
            }

            foreach (var imageItem in blockItem.Images)
            {
                Deserialize(sheet, block, imageItem);
            }

            foreach (var lineItem in blockItem.Lines)
            {
                Deserialize(sheet, block, lineItem, thickness);
            }

            foreach (var rectangleItem in blockItem.Rectangles)
            {
                Deserialize(sheet, block, rectangleItem, thickness);
            }

            foreach (var ellipseItem in blockItem.Ellipses)
            {
                Deserialize(sheet, block, ellipseItem, thickness);
            }

            foreach (var childBlockItem in blockItem.Blocks)
            {
                Deserialize(sheet, block, childBlockItem, thickness);
            }

            foreach (var pointItem in blockItem.Points)
            {
                Deserialize(sheet, block, pointItem, thickness);
            }

            parent.Blocks.Add(block);

            return(block);
        }
示例#6
0
    private void Initialize()
    {
        for (int x = 0; x < Size; x++)
        {
            for (int y = 0; y < Size; y++)
            {
                for (int z = 0; z < Size; z++)
                {
                    int    blockIndex = GetBlockIndex(x, y, z);
                    IBlock block      = _blockFactory.CreateBlock(BlockType.Air, x, y, z, Chunk);

                    _blocks[blockIndex]       = block;
                    _blockStorage[blockIndex] = _palette.SetState(block.State.Id);
                }
            }
        }
    }