private static string GetXmlText(CabFileInfo summaryFile)
 {
     using (var stream = summaryFile.OpenRead())
     {
         using (var sr = new StreamReader(stream))
         {
             return(sr.ReadToEnd());
         }
     }
 }
Esempio n. 2
0
 private static byte[] GetBinaryData(CabFileInfo summaryFile)
 {
     using (var stream = summaryFile.OpenRead())
     {
         using (var memoryStream = new MemoryStream())
         {
             stream.CopyTo(memoryStream);
             var data = memoryStream.ToArray();
             return(data);
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Loads the XDocument that is the file from the cab. All parseable InfoPath files are xml documents.
        /// </summary>
        private void InitializeXDocument()
        {
            if (_xDocument != null)
            {
                return;
            }

            Stream content = CabFileInfo.OpenRead();

            // use the 3.5-compatible Load API that takes an XmlReader, that way this will work when targeting either .NET3.5 or later
            System.Xml.XmlReader reader = System.Xml.XmlReader.Create(content);
            _xDocument = XDocument.Load(reader);
        }