Exemplo n.º 1
0
 public SevenZipFormat(string sevenZipLibPath)
 {
     this.LibHandle = SevenZipFormat.LoadLibrary(sevenZipLibPath);
     if (this.LibHandle.IsInvalid)
     {
         throw new Win32Exception();
     }
     if (SevenZipFormat.GetProcAddress(this.LibHandle, "GetHandlerProperty") == IntPtr.Zero)
     {
         this.LibHandle.Close();
         throw new ArgumentException();
     }
 }
Exemplo n.º 2
0
        public IInArchive CreateInArchive(Guid classId)
        {
            object obj = null;

            if (this.LibHandle == null)
            {
                throw new ObjectDisposedException("SevenZipFormat");
            }
            CreateObjectDelegate delegateForFunctionPointer = (CreateObjectDelegate)Marshal.GetDelegateForFunctionPointer(SevenZipFormat.GetProcAddress(this.LibHandle, "CreateObject"), typeof(CreateObjectDelegate));

            if (delegateForFunctionPointer == null)
            {
                return(null);
            }
            Guid gUID = typeof(IInArchive).GUID;

            delegateForFunctionPointer(ref classId, ref gUID, out obj);
            return(obj as IInArchive);
        }