public void CargarDatos() { var datos = _documento.Document.Descendants(_nombreSep); foreach (var datosDados in datos) { try { string nombre = datosDados.Attribute(_Alias).Value; string datoRuta = datosDados.Attribute(_Ruta).Value; if (!string.IsNullOrEmpty(nombre) && !string.IsNullOrEmpty(datoRuta)) { string tipoDato = datosDados.Attribute(_TipoDato).Value.ToLower(); switch (tipoDato) { case "cancion": CancionesR.CargarCancion(datoRuta, nombre); break; case "fuente": FuentesSpriteR.CargarFuente(datoRuta, nombre); break; case "imagen": ImagenesR.CargarImagen(datoRuta, nombre); break; case "efecto sonido": goto case "efectosonido"; case "efectosonido": EfectosSonidoR.CargarEfectoSonido(datoRuta, nombre); break; default: System.Diagnostics.Debug.WriteLine("El tipo de dato no existe: " + tipoDato); break; } //switch } //if else { System.Diagnostics.Debug.WriteLine("El nombre o ruta del XML de datos no puede ser nula o vacía"); } } catch (NullReferenceException ex) { System.Diagnostics.Debug.WriteLine("Valor nulo en la animación : " + datosDados.Attribute(_Alias).Value + "no existe"); throw (ex); } catch (FormatException ex) { System.Diagnostics.Debug.WriteLine("Los valores deben ser enteros para la longitud,anchura, filas y columnas"); throw (ex); } } }