当前位置: 首页>>代码示例>>C#>>正文


C# Generator.Generate方法代码示例

本文整理汇总了C#中Generator.Generate方法的典型用法代码示例。如果您正苦于以下问题:C# Generator.Generate方法的具体用法?C# Generator.Generate怎么用?C# Generator.Generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Generator的用法示例。


在下文中一共展示了Generator.Generate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestGenerateLppl

 public void TestGenerateLppl()
 {
     var options = new GeneratorOptions();
       var generator = new Generator(options);
       var generated = generator.Generate();
       Console.WriteLine(generated.ToListPlot());
 }
开发者ID:LucasFievet,项目名称:Tomorrow,代码行数:7,代码来源:GeneratorTests.cs

示例2: ParseTracker

        public void ParseTracker()
        {
            var generator = new Generator();
            generator.Settings.ContextNaming = ContextNaming.Preserve;
            generator.Settings.EntityNaming = EntityNaming.Singular;
            generator.Settings.RelationshipNaming = RelationshipNaming.ListSuffix;
            generator.Settings.TableNaming = TableNaming.Singular;

            var selector = GetDatabaseSchema("Tracker");
            Assert.IsNotNull(selector);

            EntityContext entityContext = generator.Generate(selector);

            Assert.IsNotNull(entityContext);

            var settings = new XmlWriterSettings { Indent = true };
            var serializer = new XmlSerializer(typeof(EntityContext));

            using (var writer = XmlWriter.Create(@"..\..\Tracker.Generated.xml", settings))
                serializer.Serialize(writer, entityContext);

            string contextDirectory = @"..\..\..\Tracker.Core";
            string mappingDirectory = @"..\..\..\Tracker.Core\Mapping";

            Synchronizer.UpdateFromSource(entityContext, contextDirectory, mappingDirectory);

            using (var writer = XmlWriter.Create(@"..\..\Tracker.Updated.xml", settings))
                serializer.Serialize(writer, entityContext);
        }
开发者ID:loresoft,项目名称:PLINQO.EntityFramework.DbContext,代码行数:29,代码来源:ParserTest.cs

示例3: Parse

        public void Parse(string input, string[] args = null)
        {
            var xxr = new XamlXmlReader(new StringReader(input), new XamlSchemaContext());
            var graphReader = new XamlObjectWriter(xxr.SchemaContext);

            while (xxr.Read())
                graphReader.WriteNode(xxr);

            var page = (Page)graphReader.Result;

            // Map our generators
            var g = new Generator();
            g.Map<Page, PageGeneratorBlock>();
            g.Map<Button, ButtonGeneratorBlock>();
            g.Map<StackPanel, StackPanelGeneratorBlock>();

            var doc = new HtmlDocument();
            var html = doc.CreateElement("html");

            g.Generate(html, page);
            // HTML5 Doc type
            doc.DocumentNode.AppendChild(doc.CreateComment("<!DOCTYPE html>"));
            doc.DocumentNode.AppendChild(html);

            doc.Save("test.htm");

            var cssContents = g.GenerateStyles(page);
            File.WriteAllText("XamlCore.css", cssContents);
        }
开发者ID:ncarrillo,项目名称:pantheon,代码行数:29,代码来源:Program.cs

示例4: Generate

        public IEnumerable<SetSong> Generate(int numSets, int numSongsPerSet, IEnumerable<Song> songs)
        {
            _masterSongList = songs.ToArray();
            _generator = new Generator(_masterSongList);
            _setSongs = _generator.Generate(numSets, numSongsPerSet, GetNextSong);

            return _setSongs;
        }
开发者ID:jyuma,项目名称:SetGenerator,代码行数:8,代码来源:KeyGenreTempo.cs

示例5: Generate

        public IEnumerable<SetSong> Generate(int numSets, int numSongsPerSet, IEnumerable<Song> songs)
        {
            _masterSongList = songs.ToArray();
            _songMemberInstrumentList = _masterSongList.SelectMany(x => x.SongMemberInstruments).ToList();
            _generator = new Generator(_masterSongList);
            _setSongs = _generator.Generate(numSets, numSongsPerSet, GetNextSong);

            return _setSongs;
        }
开发者ID:jyuma,项目名称:SetGenerator,代码行数:9,代码来源:InstrumentSinger.cs

示例6: TestGeneratePl

 public void TestGeneratePl()
 {
     var options = new GeneratorOptions
       {
     Function = x => new Pl().Evaluate(x)
       };
       var generator = new Generator(options);
       var generated = generator.Generate();
       Console.WriteLine(generated.ToListPlot());
 }
开发者ID:LucasFievet,项目名称:Tomorrow,代码行数:10,代码来源:GeneratorTests.cs

示例7: CanGenerateClasses

 public void CanGenerateClasses()
 {
     Assert.DoesNotThrow(() =>
     {
         var outputPath = GetOutputPath("CanGenerateClasses");
         var gen = new Generator
         {
             EnableDataBinding = true,
             IntegerDataType = typeof(int),
             UseXElementForAny = true,
             CollectionType = typeof(IList<>),
             CollectionImplementationType = typeof(List<>),
             GenerateDesignerCategoryAttribute = false,
             GenerateNullables = true,
             GenerateSerializableAttribute = false,
             OutputFolder = outputPath,
             NamingScheme = NamingScheme.Direct,
             DataAnnotationMode = DataAnnotationMode.None,
             EmitOrder = true,
             NamespaceProvider = new NamespaceProvider
             {
                 GenerateNamespace = key =>
                 {
                     switch (Path.GetFileName(key.Source.LocalPath))
                     {
                         case "th000008_extern.xsd":
                         case "ndh000010_extern.xsd":
                         case "headerbasis000002.xsd":
                             return "Elster.Basis";
                         case "datenabholung_5.xsd":
                         case "elster0810_datenabholung_5.xsd":
                             switch (key.XmlSchemaNamespace)
                             {
                                 case "http://www.elster.de/2002/XMLSchema":
                                     return "Elster.Datenabholung5";
                                 default:
                                     throw new NotSupportedException(string.Format("Namespace {0} for schema {1}", key.XmlSchemaNamespace, key.Source));
                             }
                         default:
                             throw new NotSupportedException(string.Format("Namespace {0} for schema {1}", key.XmlSchemaNamespace, key.Source));
                     }
                 }
             }
         };
         var xsdFiles = new[]
         {
             "headerbasis000002.xsd",
             "ndh000010_extern.xsd",
             "th000008_extern.xsd",
             "datenabholung_5.xsd",
             "elster0810_datenabholung_5.xsd",
         }.Select(x => Path.Combine(InputPath, x)).ToList();
         gen.Generate(xsdFiles);
     });
 }
开发者ID:imileusnic,项目名称:XmlSchemaClassGenerator,代码行数:55,代码来源:XsdElsterDatenabholung5.cs

示例8: GenerateTrackerDatabaseTest

        public void GenerateTrackerDatabaseTest()
        {
            var selector = GetDatabaseSchema("Tracker");
            Assert.IsNotNull(selector);
            var generator = new Generator();
            EntityContext entityContext = generator.Generate(selector);

            Assert.IsNotNull(entityContext);

            var settings = new XmlWriterSettings { Indent = true };
            var serializer = new XmlSerializer(typeof(EntityContext));

            using (var writer = XmlWriter.Create(@"..\..\Tracker.xml", settings))
                serializer.Serialize(writer, entityContext);
        }
开发者ID:modulexcite,项目名称:PLINQO.EntityFramework.DbContext,代码行数:15,代码来源:GeneratorTest.cs

示例9: TestLinearOptimizePl

        public void TestLinearOptimizePl()
        {
            var pl = new Pl();

              var options = new GeneratorOptions
              {
            Function = pl.Evaluate,
            ErrorRange = 0.25
              };
              var generator = new Generator(options);
              var generated = generator.Generate();

              var optimizer = new LcFunctionLinearOptimizer(pl);
              optimizer.Optimize(generated);
              Console.WriteLine(pl.ToShow(generated));
        }
开发者ID:LucasFievet,项目名称:Tomorrow,代码行数:16,代码来源:OptimizerTests.cs

示例10: RenameProperty

        public void RenameProperty()
        {
            var selector = GetDatabaseSchema("Tracker");
            Assert.IsNotNull(selector);
            var generator = new Generator();
            EntityContext entityContext = generator.Generate(selector);

            Assert.IsNotNull(entityContext);

            var settings = new XmlWriterSettings { Indent = true };
            var serializer = new XmlSerializer(typeof(EntityContext));

            using (var writer = XmlWriter.Create(@"..\..\Tracker.Before.xml", settings))
                serializer.Serialize(writer, entityContext);

            entityContext.RenameProperty("Task", "PriorityId", "NewPriorityId");

            using (var writer = XmlWriter.Create(@"..\..\Tracker.After.xml", settings))
                serializer.Serialize(writer, entityContext);
        }
开发者ID:loresoft,项目名称:PLINQO.EntityFramework.DbContext,代码行数:20,代码来源:RenameTest.cs

示例11: GenerateConnexInclusionModeTest

        public void GenerateConnexInclusionModeTest()
        {
            var selector = GetDatabaseSchema("Connex");
            Assert.IsNotNull(selector);

            selector.SelectMode = SelectMode.Include;
            selector.SelectedTables.Add("dbo.Agency");
            selector.SelectedTables.Add("dbo.Client");
            selector.SelectedTables.Add("dbo.Contact");
            selector.SelectedTables.Add("dbo.Contract");
            selector.SelectedTables.Add("dbo.MediaSupplier");
            selector.SelectedTables.Add("dbo.Vendor");

            selector.ColumnExpressions.Add(@"\.Id$");
            selector.ColumnExpressions.Add(@"\.Name$");
            selector.ColumnExpressions.Add(@"UniversalId$");

            var generator = new Generator();
            generator.Settings.TableNaming = TableNaming.Singular;
            generator.Settings.EntityNaming = EntityNaming.Singular;
            generator.Settings.RelationshipNaming = RelationshipNaming.Plural;
            generator.Settings.ContextNaming = ContextNaming.Plural;

            var cleanExpressions = new List<string>
            {
                "^(sp|tbl|udf|vw)_"
            };

            foreach (string s in cleanExpressions)
                if (!string.IsNullOrEmpty(s))
                    generator.Settings.CleanExpressions.Add(s);

            EntityContext entityContext = generator.Generate(selector);

            Assert.IsNotNull(entityContext);

            string json = JsonConvert.SerializeObject(entityContext, Formatting.Indented);
            File.WriteAllText(@"..\..\Connex.json", json);
        }
开发者ID:mattfrerichs,项目名称:Templates,代码行数:39,代码来源:GeneratorTest.cs

示例12: GenerateCategory

	private void GenerateCategory()
	{
		string template = Helper.ReadTextFile(categoryFileName);
		Generator gen = new Generator(template);
		gen.ParseTemplate();

        //用起始标志,标志的4个区间
		Region rgnTitle = gen.GetRegion("Title");
		Region rgnCategory = gen.GetRegion("Category");
		Region rgnProducts = gen.GetRegion("Products");
		Region rgnNavigator = gen.GetRegion("Navigator");

		if(rgnTitle == null || rgnCategory == null || rgnProducts == null || rgnNavigator == null)
		{
			Response.Write("Missing region.");
			return;
		}

		int categoryId;
		string outputFileName;
		DataView dvCategory = this.GetCategoryTable().DefaultView;
		Pager pgrCategory = new Pager(1, dvCategory.Count);

		for(int i = 0; i < pgrCategory.PageCount; i++)
		{
			rgnTitle.DataSource = (string)dvCategory[i]["CategoryName"];        //Use a string as data source
			rgnCategory.DataSource = dvCategory[i];        //Use a DataRowView object as data source

            categoryId = (int)dvCategory[i]["CategoryID"];
            rgnProducts.DataSource = this.GetProductTable(categoryId);        //Use a DataTable object as data souce
			
            //set pager
            pgrCategory.CurrentPage = i + 1;
			rgnNavigator.DataSource = pgrCategory;        //Use a Pager object as data source
			
            outputFileName = string.Format(@"{0}\Html\Category{1}.html", outputPath, categoryId);
			Helper.WriteTextFile(outputFileName, gen.Generate());
		}
	}
开发者ID:priceLiu,项目名称:EFPlatform.TemplateEngine,代码行数:39,代码来源:Default.aspx.cs

示例13: TransformHtml

        public override void TransformHtml(Generator generator, Drawable element, HtmlNode node)
        {
            // TODO: Flesh this out. Rather bare bones at the moment.
            var document = node.OwnerDocument;
            var newElement = document.CreateElement("div");
            var style = element.Style;

            // TODO: Move this to GeneratorBlock, or not, at least not for this GeneratorBlock impl.
            // Reason being is that I do some ContentProperty voodoo, which isnt appropriate for us here.
            if (style != null)
                newElement.Attributes.Add(document.CreateAttribute("class", style));

            // Add our created element to the parent.
            node.AppendChild(newElement);

            // This is where special handling of Content comes in. I simply loop through the StackPanel and call generate.
            // TODO: Try to generalize this and move it to GeneratorBlock. Will clean things up a bit.
            foreach (var child in ((StackPanel)element).Children)
            {
                generator.Generate(newElement, child);
            }
        }
开发者ID:ncarrillo,项目名称:pantheon,代码行数:22,代码来源:StackPanelGeneratorBlock.cs

示例14: OnInspectorGUI

    public override void OnInspectorGUI()
    {
        targetGenerator = (Generator)target;
        base.OnInspectorGUI();
        EditorGUILayout.Separator();

        EditorGUILayout.BeginHorizontal();
        partCount = EditorGUILayout.IntField("Steps", partCount);

        if (GUILayout.Button("Generate"))
        {
            targetGenerator.Clear();
            targetGenerator.Generate(partCount);
        }
        EditorGUILayout.EndHorizontal();

        var shapeBoxStyle = new GUIStyle
        {
            padding = new RectOffset(5, 5, 5, 5),
            normal =
            {
                background = MapUtility.GetColorTexture2D(Color.black)
            },
            alignment = TextAnchor.MiddleCenter
        };

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Shape");
        GUILayout.Box(targetGenerator.ShapeTexture, shapeBoxStyle);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.IntField("Seed", targetGenerator.Seed);

        if (GUILayout.Button("Clear"))
        {
            Debug.Log("CLEAR!");
            targetGenerator.Clear();
        }
    }
开发者ID:bodedoctor,项目名称:cellmapgenerator,代码行数:39,代码来源:MapEditor.cs

示例15: TestNonLinearOptimizePl

        public void TestNonLinearOptimizePl()
        {
            var pl = new Pl();
              Console.WriteLine(pl);

              var options = new GeneratorOptions
              {
            Function = pl.Evaluate,
            ErrorRange = 0,//.1,
            TimeRangeMax = 0.8
              };
              var generator = new Generator(options);
              var generated = generator.Generate();

              pl.Tc += 0.5;// 5;
              pl.M += 0.3;

              var optimizer = new LcFunctionNonLinearOptimizer(pl);
              optimizer.Optimize(generated);
              Console.WriteLine(pl);
              Console.WriteLine(pl.ToShow(generated));
        }
开发者ID:LucasFievet,项目名称:Tomorrow,代码行数:22,代码来源:OptimizerTests.cs


注:本文中的Generator.Generate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。