Пример #1
0
        internal string StringSerialize(UserEditable UserEditable)
        {
            TextWriter w   = WriterSerialize(UserEditable);
            string     xml = w.ToString();

            w.Close();
            return(xml.Trim());
        }
Пример #2
0
        private TextWriter WriterSerialize(UserEditable UserEditable)
        {
            TextWriter w = new StringWriter();

            this.s = new XmlSerializer(this.type);
            s.Serialize(w, UserEditable);
            w.Flush();
            return(w);
        }
Пример #3
0
        internal XmlDocument Serialize(UserEditable UserEditable)
        {
            string      xml = StringSerialize(UserEditable);
            XmlDocument doc = new XmlDocument();

            doc.PreserveWhitespace = true;
            doc.LoadXml(xml);
            return(doc);
        }
Пример #4
0
 internal UserEditable Deserialize(TextReader reader)
 {
     try
     {
         UserEditable o = (UserEditable)s.Deserialize(reader);
         reader.Close();
         return(o);
     }
     catch (InvalidCastException)    // changed setting from long to int
     {
         return(new UserEditable());
     }
 }
Пример #5
0
 internal static bool WriteFile(string file, UserEditable config)
 {
     bool ok = false;
     ConfigSerializer serializer = new ConfigSerializer();
     try
     {
         string xml = serializer.Serialize(config).OuterXml;
         using (StreamWriter writer = new StreamWriter(file, false))
         {
             writer.Write(xml.Trim());
             writer.Flush();
             writer.Close();
         }
         ok = true;
     }
     catch { }
     return ok;
 }
Пример #6
0
        internal static bool WriteFile(string file, UserEditable config)
        {
            bool             ok         = false;
            ConfigSerializer serializer = new ConfigSerializer();

            try
            {
                string xml = serializer.Serialize(config).OuterXml;
                using (StreamWriter writer = new StreamWriter(file, false))
                {
                    writer.Write(xml.Trim());
                    writer.Flush();
                    writer.Close();
                }
                ok = true;
            }
            catch { }
            return(ok);
        }
Пример #7
0
 internal string StringSerialize(UserEditable UserEditable)
 {
     TextWriter w = WriterSerialize(UserEditable);
     string xml = w.ToString();
     w.Close();
     return xml.Trim();
 }
Пример #8
0
 internal XmlDocument Serialize(UserEditable UserEditable)
 {
     string xml = StringSerialize(UserEditable);
     XmlDocument doc = new XmlDocument();
     doc.PreserveWhitespace = true;
     doc.LoadXml(xml);
     return doc;
 }
Пример #9
0
 private TextWriter WriterSerialize(UserEditable UserEditable)
 {
     TextWriter w = new StringWriter();
     this.s = new XmlSerializer(this.type);
     s.Serialize(w, UserEditable);
     w.Flush();
     return w;
 }