示例#1
0
        public Stream GetFileStream()
        {
            if (tempStreamReader != null)
                return tempStreamReader;
            else if (providerItem != null)
            {
                if (tempParentStorage == null)
                    ShellHelper.GetIStorage(providerItem.ParentItem, out tempParentStoragePtr, out tempParentStorage);

                tempStreamReader = new ShellStreamReader(providerItem, tempParentStorage, fileAccess);                
                return tempStreamReader;
            }
            else
                throw new Exception("Not possible to open a filestream.");
        }
示例#2
0
        public ShellAPI.STATSTG GetFileInfo()
        {
            if (tempStreamReader != null)
                return tempStreamReader.StreamInfo;
            else if (providerItem != null)
            {
                if (tempParentStorage == null)
                    ShellHelper.GetIStorage(providerItem.ParentItem, out tempParentStoragePtr, out tempParentStorage);

                tempStreamReader = new ShellStreamReader(providerItem, tempParentStorage, fileAccess);
                return tempStreamReader.StreamInfo;
            }
            else
                throw new Exception("Not possible to retrieve the STATSTG.");
        }
        public Stream GetFileStream()
        {
            if (tempStreamReader != null)
            {
                return(tempStreamReader);
            }
            else if (providerItem != null)
            {
                if (tempParentStorage == null)
                {
                    ShellHelper.GetIStorage(providerItem.ParentItem, out tempParentStoragePtr, out tempParentStorage);
                }

                tempStreamReader = new ShellStreamReader(providerItem, tempParentStorage, fileAccess);
                return(tempStreamReader);
            }
            else
            {
                throw new Exception("Not possible to open a filestream.");
            }
        }
        public ShellAPI.STATSTG GetFileInfo()
        {
            if (tempStreamReader != null)
            {
                return(tempStreamReader.StreamInfo);
            }
            else if (providerItem != null)
            {
                if (tempParentStorage == null)
                {
                    ShellHelper.GetIStorage(providerItem.ParentItem, out tempParentStoragePtr, out tempParentStorage);
                }

                tempStreamReader = new ShellStreamReader(providerItem, tempParentStorage, fileAccess);
                return(tempStreamReader.StreamInfo);
            }
            else
            {
                throw new Exception("Not possible to retrieve the STATSTG.");
            }
        }
示例#5
0
        internal void ReleaseStream()
        {
            if (tempStreamReader != null)
            {
                tempStreamReader.CloseStream();
                tempStreamReader = null;
            }

            if (tempParentStorage != null)
            {
                Marshal.ReleaseComObject(tempParentStorage);
                Marshal.Release(tempParentStoragePtr);
                tempParentStorage = null;
            }
        }