Esempio n. 1
0
        public static ServerIcons ReadFile(string file)
        {
            var serializer = new ServerIconsSerializer();

            try
            {
                string xml;
                using (var reader = new StreamReader(file))
                {
                    xml = reader.ReadToEnd();
                    reader.Close();
                }

                return(serializer.Deserialize(xml));
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex, "Exception in ReadFile()");
            }

            return(new ServerIcons());
        }
Esempio n. 2
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. 3
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. 4
0
        public static ServerIcons ReadFile(string file)
        {
            var serializer = new ServerIconsSerializer();

            try
            {
                string xml;
                using (var reader = new StreamReader(file))
                {
                    xml = reader.ReadToEnd();
                    reader.Close();
                }

                return serializer.Deserialize(xml);
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex, "Exception in ReadFile()");
            }

            return new ServerIcons();
        }