示例#1
0
 internal static UserEditable ReadFile(string file)
 {
     ConfigSerializer serializer = new ConfigSerializer();
     try
     {
         string xml = string.Empty;
         using (StreamReader reader = new StreamReader(file))
         {
             xml = reader.ReadToEnd();
             reader.Close();
         }
         return serializer.Deserialize(xml);
     }
     catch { }
     return new UserEditable();
 }
示例#2
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;
 }
示例#3
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);
        }