public void Save() { System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(FileName)); using (var writer = XmlWriter.Create(FileName, new XmlWriterSettings { Indent = true, })) { var serializer = new PecaSerializer(); lock (values) { serializer.Serialize(writer, values.ToArray()); } } }
private bool LoadOriginalFormat(string filename) { try { using (var reader = XmlReader.Create(FileName)) { var serializer = new PecaSerializer(); var ary = (object[])serializer.Deserialize(reader); if (ary != null) { values = new List <object>(ary); } } } catch (SerializationException) { return(false); } catch (XmlException) { return(false); } catch (IOException) { return(false); } return(true); }