///////////////////////////////////////////////////////////////////////////// public bool Save(string sFileName) { try { Serializer serializer = new Serializer(true/*bXml*/); string sDocument = serializer.Serialize<Document>(this); if (sDocument == null) return false; DocumentIO docIO = new DocumentIO(); bool bOK = docIO.Open(sFileName, true/*bWriter*/); if (!bOK) return false; docIO.Write(sDocument); docIO.Close(); return true; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); e.Assert(); } return false; }
internal bool Save(string fileName) { try { Serializer serializer = new Serializer(false/*isDCS*/); string document = serializer.Serialize(this); if (document == null) return false; IsolatedFileHelper.WriteFileString(fileName, document); return true; } catch (Exception ex) { ex.Alert(); } return false; }
///////////////////////////////////////////////////////////////////////////// public static Document Open(string sFileName) { try { DocumentIO docIO = new DocumentIO(); bool bOK = docIO.Open(sFileName, false/*bWriter*/); if (!bOK) return null; string sDocument = docIO.ReadToEnd(); docIO.Close(); if (sDocument == null) return null; Serializer serializer = new Serializer(true/*bXml*/); return serializer.Deserialize<Document>(sDocument); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); e.Assert(); } return null; }
private static Document Load(string document) { try { if (document == null) return null; Serializer serializer = new Serializer(false/*isDCS*/); return serializer.Deserialize<Document>(document); } catch (Exception ex) { ex.Alert(); } return null; }