-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreaterMethodsDCS.cs
72 lines (64 loc) · 2.46 KB
/
CreaterMethodsDCS.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
71
72
using System;
using System.IO;
using System.Collections.Generic;
using VulkanParser.objetos;
namespace VulkanParser
{
/// <summary>
/// Description of CreateMethodsCS.
/// </summary>
public static class CreaterMethodsDCS
{
public static void CreateMethodsDCS()
{
foreach (string key in VersionParser.d_commandsbyversion.Keys) //por versiones
{
if (!Directory.Exists(VKxmlParser.GetDestination()+"/Internals"))
{
Directory.CreateDirectory(VKxmlParser.GetDestination()+"/Internals");
}
StreamWriter sw = File.CreateText(VKxmlParser.GetDestination()+"/Internals/"+"Vulkan"+ key.Replace(".","")+"d.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());
sw.WriteLine("{");
sw.WriteLine("\t"+"internal static class VK"+key.Replace(".","")+"Delegates"); //Agrupar metodos en clase internal dentro de namespace de version
sw.WriteLine("\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 = "internal delegate "+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();
}
//sw.WriteLine();
}
sw.WriteLine("\t"+"}");
sw.WriteLine("}");
sw.WriteLine();
sw.Close();
}
}
}
}