public static string encode(Fase02.Clase07ClaseConTodo obj) { StringBuilder texto = new StringBuilder("<elementos>"); { texto.Append("<elemento>"); texto.Append("<nombre>"); texto.Append("publicInt"); texto.Append("</nombre>"); texto.Append("<tipo>"); texto.Append("System.Int32"); texto.Append("</tipo>"); texto.Append("<valor>"); texto.Append(obj.publicInt.ToString()); texto.Append("</valor>"); texto.Append("</elemento>"); } if (obj.publicArrayInt == null) { texto.Append("<elemento>"); texto.Append("null"); texto.Append("</elemento>"); } else { texto.Append("<elemento>"); texto.Append("<nombre>"); texto.Append("publicArrayInt"); texto.Append("</nombre>"); texto.Append("<tipo>"); texto.Append("System.Int32[]"); texto.Append("</tipo>"); texto.Append("<valor>"); texto.Append("<count>"); texto.Append(obj.publicArrayInt.Length); texto.Append("</count>"); texto.Append("<tipoDeElementos>"); texto.Append("System.Int32"); texto.Append("</tipoDeElementos>"); texto.Append("<rank>"); texto.Append("1"); texto.Append("</rank>"); texto.Append("<datosDeLosRangos>"); texto.Append("<datosDeRango>"); texto.Append("<longitud>"); texto.Append(obj.publicArrayInt.GetLength(0)); texto.Append("</longitud>"); texto.Append("<valorMenor>"); texto.Append(obj.publicArrayInt.GetLowerBound(0)); texto.Append("</valorMenor>"); texto.Append("<valorMayor>"); texto.Append(obj.publicArrayInt.GetUpperBound(0)); texto.Append("</valorMayor>"); texto.Append("</datosDeRango>"); texto.Append("</datosDeLosRangos>"); texto.Append("<valores>"); foreach (System.Int32 elementoAuxobjpublicArrayInt in obj.publicArrayInt) { texto.Append("<valor>"); texto.Append(elementoAuxobjpublicArrayInt.ToString()); texto.Append("</valor>"); ; } texto.Append("</valores>"); texto.Append("</valor>"); texto.Append("</elemento>"); } { texto.Append("<elemento>"); texto.Append("<nombre>"); texto.Append("publicStaticColores"); texto.Append("</nombre>"); texto.Append("<tipo>"); texto.Append("Fase02.Clase07ClaseConTodo+colores"); texto.Append("</tipo>"); texto.Append("<valor>"); texto.Append(obj.publicStaticColores.ToString()); texto.Append("</valor>"); texto.Append("</elemento>"); } texto.Append("</elementos>"); //str = texto; return texto.ToString(); }
public void decodificar(string codigo, ref Fase02.Clase07ClaseConTodo obj) { decode(ref codigo, ref obj); }
public static void decode(ref String codigo, ref Fase02.Clase07ClaseConTodo obj) { int count; Type tipo; Type type; int rango; string nombre; XmlDocument xml = new XmlDocument(); /* * Aquí va el control de errores del documento XML */ xml.LoadXml(codigo); XmlNode nodoPrincipal = xml.SelectSingleNode("elementos"); XmlNodeReader nr = new XmlNodeReader(nodoPrincipal); nr.Read(); // Elementos nr.Read(); // Elemento nr.Read(); // Nombre o null (si el miembro es null no hay más información de él) if (nr.Value != "null") { nr.Read(); // Nombre nr.Read(); // Nombre nr.Read(); // Tipo nr.Read(); // Tipo nr.Read(); // Tipo nr.Read(); // Valor nr.Read(); // Valor del campo o propiedad obj.publicInt = Int32.Parse(nr.Value); nr.Read(); // Valor } nr.Read(); // Elemento nr.Read(); // Elemento nr.Read(); // Nombre o null (si el miembro es null no hay más información de él) if (nr.Value != "null") { nr.Read(); // Nombre nr.Read(); // Nombre nr.Read(); // Tipo nr.Read(); // Tipo nr.Read(); // Tipo nr.Read(); // Valor nr.Read(); // Count nr.Read(); // Length int lengthobjpublicArrayInt = Int32.Parse(nr.Value); nr.Read(); // Count nr.Read(); // Tipo de elementos nr.Read(); tipo = Type.GetType(nr.Value); nr.Read(); // Tipo de elementos nr.Read(); // Rank nr.Read(); rango = Int32.Parse(nr.Value); nr.Read(); // Rank nr.Read(); // Datos de los rangos nr.Read(); // Datos de rango nr.Read(); // Longitud nr.Read(); int auxobjpublicArrayIntLength0 = Int32.Parse(nr.Value); nr.Read(); // Longitud nr.Read(); // Valor menor nr.Read(); int auxobjpublicArrayIntGetLowerBound0 = Int32.Parse(nr.Value); nr.Read(); // Valor menor nr.Read(); // Valor mayor nr.Read(); int auxobjpublicArrayIntGetUpperBound0 = Int32.Parse(nr.Value); nr.Read(); // Valor mayor nr.Read(); // Datos de rango nr.Read(); // Datos de los rangos nr.Read(); // Valores for (int auxIndice0 = auxobjpublicArrayIntGetLowerBound0; auxIndice0 <= auxobjpublicArrayIntGetUpperBound0; auxIndice0++) { if (obj.publicArrayInt == null) obj.publicArrayInt = new System.Int32[auxobjpublicArrayIntLength0]; nr.Read(); // Valor nr.Read(); // Valor del campo o propiedad obj.publicArrayInt[auxIndice0] = Int32.Parse(nr.Value); nr.Read(); // Valor } nr.Read(); // Valores nr.Read(); // Valor } nr.Read(); // Elemento nr.Read(); // Elemento nr.Read(); // Nombre o null (si el miembro es null no hay más información de él) if (nr.Value != "null") { nr.Read(); // Nombre nr.Read(); // Nombre nr.Read(); // Tipo nr.Read(); // Tipo nr.Read(); // Tipo nr.Read(); // Valor nr.Read(); // Valor del campo o propiedad obj.publicStaticColores = (Fase02.Clase07ClaseConTodo.colores)Enum.Parse(typeof(Fase02.Clase07ClaseConTodo.colores), nr.Value); nr.Read(); // Valor } nr.Read(); // Elemento nr.Read(); // Elementos }
public string codificar(Fase02.Clase07ClaseConTodo obj) { return encode(obj); }
static void Main(string[] args) { int x = 30; int y = 10; String result = null; int pontos = 0; Desenho TELA = new Desenho(); Console.WriteLine("DEIXE A TELA GRANDE E APERTE ENTER"); Console.ReadLine(); TELA.DesenhoFundo(); TELA.Loading(x, y); while (result != "6") { result = TELA.Menu(x, y); if (result == "1") { Console.Clear(); Fase01 fase01 = new Fase01(); fase01.Fase_01(pontos); } else if (result == "2") { Console.Clear(); Fase02 fase02 = new Fase02(); fase02.Fase_02(pontos); } else if (result == "3") { Console.Clear(); Fase03 fase03 = new Fase03(); fase03.Fase_03(pontos); } else if (result == "4") { Console.Clear(); Fase04 fase04 = new Fase04(); fase04.JogoDaVelha(); } else if (result == "5") { Console.Clear(); Fase05 fase05 = new Fase05(); fase05.JogoDaVelhaUltra(); } else if (result == "6") { Console.BackgroundColor = ConsoleColor.DarkRed; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.Clear(); Console.WriteLine("FIM"); Console.ReadLine(); } else { Console.WriteLine("ERRO"); } } }