Esempio n. 1
0
        public static bool GuardarXML(string path, T dato)
        {
            bool          guardoXml = false;
            XmlTextWriter writer    = null;
            XmlSerializer ser;

            try
            {
                writer = new XmlTextWriter(path, Encoding.UTF8);
                ser    = new XmlSerializer(typeof(T));
                ser.Serialize(writer, dato);
                writer.Close();
                guardoXml = true;
                //throw new DirectoryNotFoundException();
            }
            catch (ArgumentException e)
            {
                throw new ArgumentException(e.Message, e);
            }
            catch (DirectoryNotFoundException e)
            {
                ComiqueriaException comiqueriaException = new ComiqueriaException("Error: Directorio no encontrado", e);
                ArchivoTexto.Escribir(comiqueriaException, true);
                throw comiqueriaException;
            }
            catch (Exception e)
            {
                throw new Exception("Error Vaquero....", e);
            }
            finally
            {
                if (writer != null)
                {
                    writer.Close();
                }
            }
            return(guardoXml);
        }
 public ComiqueriaException(string mensaje, Exception innerException) : base(mensaje, innerException)
 {
     ArchivoTexto.Escribir(this, true);
 }