Esempio n. 1
0
        private string StringSerialize(ServerIcons serverIcons)
        {
            try
            {
                var textWriter = WriterSerialize(serverIcons);
                var xml = textWriter.ToString();
                textWriter.Close();
                return xml;
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex, "Exception in StringSerialize()");
            }

            return string.Empty;
        }
Esempio n. 2
0
        private string StringSerialize(ServerIcons serverIcons)
        {
            try
            {
                var textWriter = WriterSerialize(serverIcons);
                var xml        = textWriter.ToString();
                textWriter.Close();
                return(xml);
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex, "Exception in StringSerialize()");
            }

            return(string.Empty);
        }
Esempio n. 3
0
        private TextWriter WriterSerialize(ServerIcons serverIcons)
        {
            try
            {
                TextWriter stringWriter = new StringWriter();
                serializer = new XmlSerializer(type);
                serializer.Serialize(stringWriter, serverIcons);
                stringWriter.Flush();
                return(stringWriter);
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex, "Exception in WriterSerialize()");
            }

            return(null);
        }
Esempio n. 4
0
        private TextWriter WriterSerialize(ServerIcons serverIcons)
        {
            try
            {
                TextWriter stringWriter = new StringWriter();
                serializer = new XmlSerializer(type);
                serializer.Serialize(stringWriter, serverIcons);
                stringWriter.Flush();
                return stringWriter;
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex, "Exception in WriterSerialize()");
            }

            return null;
        }
Esempio n. 5
0
        public XmlDocument Serialize(ServerIcons serverIcons)
        {
            try
            {
                var xml = StringSerialize(serverIcons);
                var doc = new XmlDocument { PreserveWhitespace = true };
                doc.LoadXml(xml);
                doc = Clean(doc);
                return doc;
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex, "Exception in Serialize()");
            }

            return null;
        }
Esempio n. 6
0
        public XmlDocument Serialize(ServerIcons serverIcons)
        {
            try
            {
                var xml = StringSerialize(serverIcons);
                var doc = new XmlDocument {
                    PreserveWhitespace = true
                };
                doc.LoadXml(xml);
                doc = Clean(doc);
                return(doc);
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex, "Exception in Serialize()");
            }

            return(null);
        }
Esempio n. 7
0
        public static bool WriteFile(string file, ServerIcons config)
        {
            var serializer = new ServerIconsSerializer();

            try
            {
                var xml = serializer.Serialize(config).OuterXml;
                using (var writer = new StreamWriter(file, false))
                {
                    writer.Write(xml);
                    writer.Flush();
                    writer.Close();
                }

                return(true);
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex, "Exception in WriteFile()");
            }

            return(false);
        }
Esempio n. 8
0
        public static bool WriteFile(string file, ServerIcons config)
        {
            var serializer = new ServerIconsSerializer();

            try
            {
                var xml = serializer.Serialize(config).OuterXml;
                using (var writer = new StreamWriter(file, false))
                {
                    writer.Write(xml);
                    writer.Flush();
                    writer.Close();
                }

                return true;
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex, "Exception in WriteFile()");
            }

            return false;
        }