public static void WriteSettings(ShapeLayerSettings settings, string fileName) { var xmlSer = new XmlSerializer(settings.GetType()); using (var sw = new StreamWriter(fileName)) { xmlSer.Serialize(sw, settings); } }
public static ShapeLayerSettings GetSettings(string fileName) { var settings = new ShapeLayerSettings(); try { var xmlSer = new XmlSerializer(settings.GetType()); using (var sr = new StreamReader(fileName)) { settings = (ShapeLayerSettings)xmlSer.Deserialize(sr); } } catch (Exception) { } return settings; }