Exemple #1
0
        public void Process(ITemplate template)
        {
            var chunk = _chunkLoader.Load(template).ToList();

            _parsings[template.FilePath] = new Parsing
            {
                Master        = chunk.Master(),
                ViewModelType = chunk.ViewModel(),
                Namespaces    = chunk.Namespaces()
            };
        }
Exemple #2
0
        /// <summary> Loads the chunks from memory. </summary>
        private void LoadChunks()
        {
            const int half = NumberOfChunksWide / 2;

            // create the upper edge
            for (int x = -half; x < half; x++)
            {
                Chunk chunk = _loader.Load(new ChunkCoordinate(x, -half));
                Chunks[chunk.Coordinate.Index] = chunk;
            }

            // create the lower edge
            for (int z = -half + 1; z < half; z++)
            {
                Chunk chunk = _loader.Load(new ChunkCoordinate(-half, z));
                Chunks[chunk.Coordinate.Index] = chunk;
            }

            // create the rest (and link the neighbor nodes
            for (int x = -half + 1; x < half; x++)
            {
                for (int z = -half + 1; z < half; z++)
                {
                    var centerNode = _loader.Load(new ChunkCoordinate(x, z));
                    Chunks[centerNode.Coordinate.Index] = centerNode;

                    var nodeToLeft = Chunks[new ChunkCoordinate(x - 1, z).Index];
                    var nodeAbove  = Chunks[new ChunkCoordinate(x, z - 1).Index];

                    Chunk.LinkHorizontally(nodeToLeft, centerNode);
                    Chunk.LinkVertically(centerNode, nodeAbove);
                }
            }

            foreach (var chunk in Chunks)
            {
                chunk.Changed += OnChunkChanged;
            }
        }
        private BindRequest createBindRequest(ITemplate template, ITemplateRegistry templateRegistry)
        {
            var chunks = _chunkLoader.Load(template);

            return(new BindRequest
            {
                Target = template,
                Types = _types,
                TemplateRegistry = templateRegistry,
                Master = chunks.Master(),
                ViewModelType = chunks.ViewModel(),
                Namespaces = chunks.Namespaces(),
                Logger = SparkLogger.Default()
            });
        }