Created
March 1, 2018 15:40
-
-
Save markiteps/44f7dcf8b2e4352a0232dfa47fa0791c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Elemento getEjercicioDeserializado(byte[] b, string t) | |
{ | |
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); | |
sw.Restart(); | |
t = "WcfService1." + t; | |
ejercicioDeserializado ejercicio1 = new ejercicioDeserializado(); | |
EjecutivaEjercicios functionReturnValue = new EjecutivaEjercicios(); | |
functionReturnValue = null; | |
/*try | |
{*/ | |
MemoryStream mem = new MemoryStream(b); | |
bool isXML = false; | |
byte[] @by = new byte[5]; | |
mem.Read(@by, 0, 5); | |
if (@by[0] == 60 && @by[1] == 63 && @by[2] == 120 && @by[3] == 109 && @by[4] == 108) | |
{ | |
isXML = true; | |
} | |
mem.Position = 0; | |
if (isXML) | |
{ | |
try | |
{ | |
System.Xml.Serialization.XmlSerializer XML = new System.Xml.Serialization.XmlSerializer(Type.GetType(t)); | |
//functionReturnValue = (EjecutivaEjercicios)XML.Deserialize(mem); | |
ejercicio1.ejercicioDes = (EjecutivaEjercicios)XML.Deserialize(mem); | |
System.Diagnostics.Debug.Write("\nDESERIALIZACION REALIZADA CON EXITO\n"); | |
} | |
catch (SqlException ex) | |
{ | |
ejercicio1 = new ejercicioDeserializado() { Error = "Problema al obtener el elemento del ejercicio:" + ex.Message }; | |
//return ejercicio1; | |
} | |
} | |
sw.Stop(); | |
return ejercicio1.ejercicioDes.Pantallas.Pantalla[1].Elementos.Elemento[1]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment