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(); }
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; }
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); }