Exemplo n.º 1
0
        private void RenderSingleFile(OkapiInfo api, RenderTemplateTask template)
        {
            var outputPath = Path.Combine(rootFolder, template.output);

            Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
            var output = template.razor.ExecuteTemplate(api, null, null, null);

            File.WriteAllText(outputPath, output);
        }
Exemplo n.º 2
0
 private void RenderMethods(OkapiInfo api, RenderTemplateTask template)
 {
     foreach (var method in api.Methods)
     {
         var outputPath = Path.Combine(rootFolder, QuickStringMerge(template.output, method));
         Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
         var output = template.razor.ExecuteTemplate(api, method, null, null);
         File.WriteAllText(outputPath, output);
     }
 }
Exemplo n.º 3
0
 private void RenderEnums(OkapiInfo api, RenderTemplateTask template)
 {
     foreach (var enumDataType in api.Enums)
     {
         var outputPath = Path.Combine(rootFolder, QuickStringMerge(template.output, enumDataType));
         Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
         var output = template.razor.ExecuteTemplate(api, null, null, enumDataType);
         File.WriteAllText(outputPath, output);
     }
 }
Exemplo n.º 4
0
        private void RenderUniqueModels(OkapiInfo api, RenderTemplateTask template)
        {
            var oldModels = api.Models;

            api.Models = (from m in api.Models where !m.SchemaName.StartsWith("FetchResult") select m).ToList();
            foreach (var model in api.Models)
            {
                var outputPath = Path.Combine(rootFolder, QuickStringMerge(template.output, model));
                Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
                var output = template.razor.ExecuteTemplate(api, null, model, null);
                File.WriteAllText(outputPath, output);
            }
            api.Models = oldModels;
        }
Exemplo n.º 5
0
        private void RenderMethodCategories(OkapiInfo api, RenderTemplateTask template)
        {
            var categories = (from m in api.Methods select m.Category).Distinct();

            foreach (var c in categories)
            {
                var oldMethods = api.Methods;
                api.Methods = (from m in api.Methods where m.Category == c select m).ToList();
                var outputPath = Path.Combine(rootFolder, QuickStringMerge(template.output, c));
                Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
                template.razor.Category = c;
                var output = template.razor.ExecuteTemplate(api, null, null, null);
                template.razor.Category = null;
                File.WriteAllText(outputPath, output);
                api.Methods = oldMethods;
            }
        }