Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            StructureParser       parser    = new StructureParser(this.richTextBox1.Text);
            StructureTree         root      = parser.Parse();
            MetaModel             metamodel = root.Build();
            MetaTemplateConverter converter = new MetaTemplateConverter();
            TemplateContainer     container = converter.Convert(metamodel);
            string template = "Domains:\n========\n[%foreach(domain in Domains)%]\n	Id: [%domain.Id%]\n	Name: [%domain.Name%]\n	IsIdentity: [%domain.IsIdentity%]\n	DataType: [%domain.DataType%]\n	Length: [%domain.DataTypeLength%]\n	Decimals: [%domain.DataTypeDecimals%]\n[%end%]\n";

            template += "Tables:\n=======\n[%foreach(table in Tables)%]\n	Id: [%table.Id%]\n	Name: [%table.Name%]\n	LogicalName: [%table.LogicalName%]\n	PhysicalName: [%table.PhysicalName%]\n	[\n[%foreach(column in table.Columns)%]		TableId: [%column.TableId%]\n		Ix: [%column.Ix%]\n		Name: [%column.Name%]\n		LogicalName: [%column.LogicalName%]\n		PhysicalName: [%column.PhysicalName%]\n		IsPrimaryKey: [%column.IsPrimaryKey%]\n		IsNullable: [%column.IsNullable%]\n		IsIdentity: [%column.IsIdentity%]\n		DataType: [%column.DataType%]\n		Length: [%column.DataTypeLength%]\n		Decimals: [%column.DataTypeDecimals%]\n		IsForeignKey: [%column.IsForeignKey%]\n	[%end%]\n][%end%]\n";
            template  = TemplateTransformer.Transform(template);
            template  = JavascriptEvaluator.ReplaceString(template, container);
            this.richTextBox2.Text = template;
        }
Exemple #2
0
    void CreateTreeIfValid(int x, int z, Chunk chunk)
    {
        if (GetNoise(x + chunk.pos.x, 0, z + chunk.pos.z, 0.2f, 100, 1) < 3)
        {
            int terrainHeight = LayerStoneBase(x + chunk.pos.x, z + chunk.pos.z);
            terrainHeight += LayerStoneNoise(x + chunk.pos.x, z + chunk.pos.z);
            terrainHeight += LayerDirt(x + chunk.pos.x, z + chunk.pos.z);;


            if (StructureTree.ChunkContains(chunk, new BlockPos(x + chunk.pos.x, terrainHeight, z + chunk.pos.z)))
            {
                StructureTree.Build(chunk, new BlockPos(x, terrainHeight - chunk.pos.y, z), this);
            }
        }
    }