-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreaterMethodsDICS.cs
70 lines (64 loc) · 2.45 KB
/
CreaterMethodsDICS.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using System;
using System.IO;
using System.Collections.Generic;
using VulkanParser.objetos;
namespace VulkanParser
{
/// <summary>
/// Description of CreateMethodsCS.
/// </summary>
public static class CreaterMethodsDICS
{
public static void CreateMethodsDICS()
{
foreach (string key in VersionParser.d_commandsbyversion.Keys) //por versiones
{
StreamWriter sw = File.CreateText(VKxmlParser.GetDestination()+"Vulkan"+ key.Replace(".","")+".cs");
sw.WriteLine("// Document Created with VulkanParser.");
sw.WriteLine("// "+DateTime.Now.ToString("HH:mm:ss dd/mm/yyyy"));
sw.WriteLine("// by BROTHERHOOD OF THE BLACK SWORD.");
sw.WriteLine();
sw.WriteLine("namespace "+VKxmlParser.GetNamespace()+".VK"+key.Replace(".",""));
sw.WriteLine("{");
sw.WriteLine("\t"+"internal static class VKDI"+key.Replace(".","")); //Clase de inicio de delegados.
sw.WriteLine("\t"+"{");
sw.WriteLine("\t"+"\t"+"internal static void InitDelegates()");
sw.WriteLine("\t"+"\t"+"{");
foreach(string keygroups in VersionParser.d_commandsbyversion[key].grupocomandos.Keys) //por grupos
{
List<string> listametodos = VersionParser.d_commandsbyversion[key].grupocomandos[keygroups];
for (int i=0;i<listametodos.Count;i++)
{
Metodo mtd = CommandParser.Metodos[listametodos[i]]; //Rescatar metodo del CommandParser
string smetodo = "public static "+mtd.ValueReturned+" "+mtd.Nombre+"("; //confecionar string de metodo
foreach (string keyParams in mtd.Parametros.Keys) //Añadir Parametyros del método
{
Parametro param = mtd.Parametros[keyParams];
if (param.constante)
{
smetodo += "const ";
}
string stipovalor = param.TipoValor;
if (param.puntero)
{
stipovalor += "*";
}
string svalorfinparam = Tools.VariableType(stipovalor);
smetodo += svalorfinparam + " " + param.Nombre + ", ";
}
smetodo = smetodo.Remove(smetodo.Length-2, 2) + ")"; //quitar comay espacio tras último parametro y cerrar parentesis.
sw.WriteLine("\t"+"\t"+smetodo); //escribir enunciado de metodo.
sw.WriteLine("\t"+"\t"+"{");
sw.WriteLine("\t"+"\t"+"\t");
sw.WriteLine("\t"+"\t"+"}");
sw.WriteLine();
}
}
sw.WriteLine("\t"+"\t"+"}");
sw.WriteLine("}");
sw.WriteLine();
sw.Close();
}
}
}
}