public void SerializeObject(string filename, OpenVPNSettings objectToSerialize) { Stream stream = File.Open(filename, FileMode.Create); XmlSerializer x = new XmlSerializer(objectToSerialize.GetType()); x.Serialize(stream, objectToSerialize); stream.Close(); }
void Load() { if (File.Exists(settingsFile)) { profilesSettings = s.DeSerializeObject(settingsFile); } else { profilesSettings = new OpenVPNSettings(); } }