Пример #1
0
        private void Generate(string templatePath, string outputPath, EnumModel model, GenerationOptions options = GenerationOptions.AllowOverwrite)
        {
            if (templatePath == null)
                throw new ArgumentNullException("templatePath");
            if (outputPath == null)
                throw new ArgumentNullException("outputPath");

            m_textHost.CurrentInterface = null;
            m_textHost.CurrentPlatform = null;
            m_textHost.CurrentEnum = model;

            m_textHost.TemplateFile = ResolveTemplatePath(templatePath);
            string templateText = GetTemplateText(m_textHost.TemplateFile);

            DateTime lastUpdated = File.Exists(outputPath) ? File.GetLastWriteTimeUtc(outputPath) : DateTime.MinValue;
            if (!File.Exists(outputPath) || (options.HasFlag(GenerationOptions.AllowOverwrite) && DateTime.Compare(lastUpdated, model.UpdatedAt) < 0))
                GenerateFile(outputPath, templateText);
        }
Пример #2
0
        protected override void Generate(EnumModel model)
        {
            string includePath = Path.Combine(Settings.OutputPath, string.Format("include/Talon/{0}/{1}.h", model.Module, model.Name));

            Generate("TalonEnumHeaderFile.t4", includePath, model);
        }
Пример #3
0
 protected abstract void Generate(EnumModel definition);