Пример #1
0
 public DocxDocumentReader(Workshare.Policy.BinaryData data)
     : base(false)
 {
     m_data = data;
     m_data.LockInMemory();
     m_myData = false;
 }
Пример #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;
            }

        }
Пример #3
0
        public DocxDocumentReader(string filename)
            : base(filename)
        {
            if (filename == null || 0 == filename.Length)
                return;

            m_data = new BinaryData(filename);
            m_data.LockInMemory();
        }
Пример #4
0
 public DocxDocumentReader(byte[] byteArray)
     : base(byteArray)
 {
     m_data = new BinaryData(new MemoryStream(byteArray));
     m_data.LockInMemory();
 }
Пример #5
0
 public XlsxDocumentReader(string filename)
     : base(filename)
 {
     m_data = new BinaryData(filename);
     m_data.LockInMemory();
 }