Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            var input = new NameEnumsTemplateInput();

            // Color
            var colorPaletteData = new NameEnumsTemplateInput.PaletteData("Color");

            colorPaletteData.AddThemeInfo("Theme1", "123");
            colorPaletteData.AddThemeInfo("Theme2", "456");
            colorPaletteData.AddEntryInfo("KeyColor", "789");
            colorPaletteData.AddEntryInfo("KeyColor", "123");
            colorPaletteData.AddEntryInfo("KeyColor_2", "123");
            input.PaletteDataList.Add(colorPaletteData);

            // Character Style
            var characterStylePaletteData = new NameEnumsTemplateInput.PaletteData("CharacterStyle");

            characterStylePaletteData.AddThemeInfo("Theme1", "789");
            input.PaletteDataList.Add(characterStylePaletteData);

            var template = new NameEnumsTemplate(input);

            Console.WriteLine(template.TransformText());
        }
        private static NameEnumsTemplateInput.PaletteData CreatePaletteData <T>(string typeName, Palette <T> palette)
        {
            var paletteData = new NameEnumsTemplateInput.PaletteData(typeName);

            foreach (var idAndName in palette.GetThemeIdAndNames())
            {
                paletteData.AddThemeInfo(idAndName.name, idAndName.id);
            }

            foreach (var idAndName in palette.GetEntryIdAndNames())
            {
                paletteData.AddEntryInfo(idAndName.name, idAndName.id);
            }

            return(paletteData);
        }