Exemple #1
0
 public static Stream TryOpenStream(this IXDocument doc, string name, AccessType_e access)
 {
     try
     {
         return(doc.OpenStream(name, access));
     }
     catch
     {
         return(null);
     }
 }
Exemple #2
0
        //---
        //--- 3rdParty
        private void OnWriteToStream(IXDocument doc)
        {
            const string STREAM_NAME = "CodeStackStream";

            using (var str = doc.OpenStream(STREAM_NAME, AccessType_e.Write))
            {
                var xmlSer = new XmlSerializer(typeof(string[]));

                xmlSer.Serialize(str, new string[] { "A", "B" });
            }
        }
        private void SaveToStream(IXDocument doc)
        {
            using (var stream = doc.OpenStream(STREAM_NAME, AccessType_e.Write))
            {
                var xmlSer = new XmlSerializer(typeof(RevData));

                if (m_RevData == null)
                {
                    m_RevData = new RevData();
                }

                m_RevData.Revision      = m_RevData.Revision + 1;
                m_RevData.RevisionStamp = Guid.NewGuid();

                xmlSer.Serialize(stream, m_RevData);
            }
        }