Exemplo n.º 1
0
 private void AddGroupHeader(string title, string marginTop = "1em")
 {
     string anchor = Sanitize(title);
     SB.AppendLine($"<h2 style='margin-top: {marginTop};'>");
     SB.AppendLine($"<a href='#{anchor}' name='{anchor}' style='color: black; text-decoration: none; font-weight: 600;'>{title}</a>");
     SB.AppendLine($"</h2>");
 }
Exemplo n.º 2
0
        private void GenProc(ShaderProgram Program, ProcInfo Proc)
        {
            if (string.Compare(Proc.Name, "main", true) != 0)
            {
                SB.AppendLine($"void {Proc.Name}() {{");

                Ident = "\t";

                GenProcBody(Program, Proc);

                SB.AppendLine("}");
            }
            else
            {
                //TODO: Support other geometry shader types.
                //Currently, only Point Sprites are supported,
                //but some models uses silhouette, and maybe subdivision too.
                SB.AppendLine($"void main() {{");
                SB.AppendLine("\tfor (geo_i = 0; geo_i < 3; geo_i++) {");

                Ident = "\t\t";

                GenProcBody(Program, Proc);

                SB.AppendLine("\t\tEndPrimitive();");
                SB.AppendLine("\t}");
                SB.AppendLine("}");
            }
        }
Exemplo n.º 3
0
        private void GerarMetodos(Service service)
        {
            foreach (var metodo in service.Metodos)
            {
                SB.Append($"\t{metodo.Nome} = (");

                for (var i = 0; i < metodo.Parametros.Count; i++)
                {
                    var param = metodo.Parametros[i];
                    SB.Append($"{param.Nome}: {param.Tipo}");

                    if (i + 1 < metodo.Parametros.Count)
                    {
                        SB.Append(", ");
                    }
                }

                SB.AppendLine(") =>");

                var rota = metodo.Rota.Replace("[action]", metodo.Nome);

                SB.Append($"\t\tthis.CreateRequest<{metodo.Retorno}>(RequestType.{metodo.Tipo}, `{rota}`");

                var bodyParams = metodo.Parametros.Where(x => !x.IsQueryString).ToList();
                if (bodyParams.Count > 0)
                {
                    SB.Append($", ");

                    if (bodyParams.Count == 1)
                    {
                        SB.Append(metodo.Parametros[0].Nome);
                    }
                    else
                    {
                        SB.Append("{ ");
                        for (var i = 0; i < bodyParams.Count; i++)
                        {
                            SB.Append(bodyParams[i].Nome);
                            if (i + 1 < bodyParams.Count)
                            {
                                SB.Append(", ");
                            }
                        }
                        SB.Append("}");
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(metodo.Resposta) && metodo.Resposta != TipoResposta.Normal.ToDescriptionString())
                    {
                        SB.Append($", null, ResponseType.{metodo.Resposta}");
                    }
                }

                SB.AppendLine(");");
                SB.AppendLine();
            }
        }
Exemplo n.º 4
0
        private void GerarDeclaracaoClasse(Service service)
        {
            SB.AppendLine($"class {service.Nome} extends BaseService {{");

            SB.AppendLine("\tconstructor() {");
            SB.AppendLine($"\t\tsuper(\"{service.Nome}\");");
            SB.AppendLine("\t}");
            SB.AppendLine();
        }
Exemplo n.º 5
0
 private void AddRecipeThumbnails(IRecipe[] recipes)
 {
     foreach (IRecipe recipe in recipes)
     {
         string categoryPageName = $"{Sanitize(recipe.Category)}{ExtPage}";
         string recipeUrl        = $"{categoryPageName}#{recipe.ID}".ToLower();
         string imageUrl         = $"source/{recipe.ID}{ExtThumb}".ToLower();
         SB.AppendLine($"<a href='{recipeUrl}'><img src='{imageUrl}' style='padding: 10px;'/></a>");
     }
 }
Exemplo n.º 6
0
 private void AddRecipeLinks(IRecipe[] recipes)
 {
     SB.Append("<div style='margin-left: 1em;'>");
     foreach (IRecipe recipe in recipes)
     {
         string categoryPageName = $"{Sanitize(recipe.Category)}{ExtPage}";
         string recipeUrl        = $"{categoryPageName}#{recipe.ID}".ToLower();
         SB.AppendLine($"<p><a href='{recipeUrl}' style='font-weight: 600;'>{recipe.Title}</a> - {recipe.Description}</p>");
     }
     SB.Append("</div>");
 }
Exemplo n.º 7
0
        private void GerarImports(ProjetoEntidade proj, Service service)
        {
            SB.AppendLine("import { BaseService, RequestType, ResponseType } from \"@intech/react-service\";");

            foreach (var import in service.Imports)
            {
                var imp = import.Replace("Array<", "").Replace(">", "");
                SB.AppendLine($"import {{ {imp} }} from \"../entidades/{imp}\";");
            }

            SB.AppendLine();
        }
Exemplo n.º 8
0
        private void GenProc(ShaderProgram Program, ProcInfo Proc)
        {
            SB.AppendLine($"void {Proc.Name}() {{");

            Ident = "\t";

            GenProcBody(Program, Proc);

            if (string.Compare(Proc.Name, "main", true) == 0)
            {
                SB.AppendLine($"{Ident}gl_Position = {OutputNames[0]};");
            }

            SB.AppendLine("}");
        }
Exemplo n.º 9
0
        private void AddRecipe(IRecipe recipe)
        {
            string id           = recipe.ID.ToLower();
            string recipeFolder = Path.Combine(SiteFolder, "source");
            string codeFilePath = Path.Combine(recipeFolder, id + ExtCode);
            string imageUrl     = id + ExtImage;

            string[] raw  = File.ReadAllLines(codeFilePath);
            string   code = string.Join("\n", raw.Skip(2));

            AddHTML($"<h2><a href='#{id}' name='{id}' style='color: black;'>{recipe.Title}</a></h2>");
            AddHTML(recipe.Description);
            AddCode(code);

            SB.AppendLine($"<div class='center'><img src='source/{imageUrl}' /></div>");
        }
Exemplo n.º 10
0
 private void Fechar(Service service)
 {
     SB.AppendLine("}");
     SB.AppendLine();
     SB.AppendLine($"export const {service.Nome}Service = new {service.Nome}();");
 }
Exemplo n.º 11
0
 protected override void GenEmit(ShaderProgram Program, uint InstOp)
 {
     SB.AppendLine($"{Ident}gl_Position = {ShaderOutputRegName.Position};");
     SB.AppendLine($"{Ident}EmitVertex();");
 }