public DocxDocumentReader(Workshare.Policy.BinaryData data)
     : base(false)
 {
     m_data = data;
     m_data.LockInMemory();
     m_myData = false;
 }
Beispiel #2
0
        public LockBytesWrapper(BinaryData data)
        {
            try
            {
                m_data = data;
                data.LockInMemory();
                if (data is OptimizedBinaryData)
                {
                    OptimizedBinaryData optData = data as OptimizedBinaryData;
                    m_lockbytesinterface = optData.AsLockBytes() as StructuredStorageInterface.ILockBytes;
                }
                else
                {
                    int len = data.Length;
                    m_hglobalHandle = Marshal.AllocHGlobal(len);
                    data.CopyTo(m_hglobalHandle);

                    StructuredStorageInterface.CreateILockBytesOnHGlobal(m_hglobalHandle, false, out m_lockbytesinterface);
                }
            }
            catch (Exception)
            {
                // if we throw in here, we most likely wont get disposed properly (the new this won't be assigned to anything)
                // this becomes an issue because we have locked the binary data in memory and wont be releasing it
                // so to keep things tidy and make sure we don't get spurious errors we will release the binary data object
                // and tidy up ourselves in case of an exception
                Dispose(true);
                throw;
            }

        }
        public DocxDocumentReader(string filename)
            : base(filename)
        {
            if (filename == null || 0 == filename.Length)
                return;

            m_data = new BinaryData(filename);
            m_data.LockInMemory();
        }
 public DocxDocumentReader(byte[] byteArray)
     : base(byteArray)
 {
     m_data = new BinaryData(new MemoryStream(byteArray));
     m_data.LockInMemory();
 }
 public XlsxDocumentReader(string filename)
     : base(filename)
 {
     m_data = new BinaryData(filename);
     m_data.LockInMemory();
 }