Jump to content

Get to com interface of DotNetZipLib


 Share

Recommended Posts

having troubles with unicode in zip.zipfolders UDF i come across DotNetZip - http://dotnetzip.codeplex.com/

it seems have unicode support, but i cannot get to com interface of this library:

first:

c:\windows\syswow64\regsvr32.exe Ionic.Zip.dll

(here a complain about DllRegisterServer)

next:

#AutoIt3Wrapper_Autoit3Dir=C:\Program Files (x86)\AutoIt3\autoit-v3.3.12.0
;#AutoIt3Wrapper_Autoit3Dir=C:\Program Files (x86)\AutoIt3\autoit-v3.3.13.20-beta

$zip = ObjCreate("Ionic.Zip.ZipFile")
MsgBox(64,@error, IsObj($zip))

still no go - @ error = -2147221005

 

Link to comment
Share on other sites

successfully registered library with Regasm.exe

Where you once used Regsvr32 on unmanaged COM libraries, you will now use Regasm on managed .NET libraries.



“Regsvr32 is the command-line tool that registers .dll files as command components in the registry“
“Regasm.exe, the Assembly Registration tool that comes with the .NET SDK, reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently. Once a class is registered, any COM client can use it as though the class were a COM class. The class is registered only once, when the assembly is installed. Instances of classes within the assembly cannot be created from COM until they are actually registered.“

If you want to register an assembly programmatically, see the RegistrationServices class and ComRegisterFunctionAttribute

but now @ error = -2147221164...

Link to comment
Share on other sites

So i created some functions i needed - DotNetZip is pretty unicode friendly and well documented

many thanks to funkey

Global $__DotNetIsLoadedSuccessfully = 0, $DLL_Path_IonicZip = @ScriptDir & "\Ionic.Zip.dll"
;----------------------------------------------------------------------------------------------------------------------------------
;
;----------------------------------------------------------------------------------------------------------------------------------
Func DotNetZip_ExtractAll($pathToZipFile,$sDestinationDir,$bOverwrite = 1)
    If Not $__DotNetIsLoadedSuccessfully Then _DotNet_Load($DLL_Path_IonicZip)
    $oZipFile = ObjCreate("Ionic.Zip.ZipFile")
    $oZipFile.Initialize($pathToZipFile)
    $oZipFile.ExtractAll_2($sDestinationDir,$bOverwrite)
    $oZipFile.Dispose()
    Return True
EndFunc
;----------------------------------------------------------------------------------------------------------------------------------
Func DotNetZip_ListFilesInArc($pathToZipFile)
    If Not $__DotNetIsLoadedSuccessfully Then _DotNet_Load($DLL_Path_IonicZip)
    $sEntryList = ""
    $oZipFile = ObjCreate("Ionic.Zip.ZipFile")
    $oZipFile.Initialize($pathToZipFile)
    For $oEntry In $oZipFile
        $sEntryList &= $oEntry.FileName & "|"
    Next
    $oZipFile.Dispose()
    Return StringSplit(StringTrimRight($sEntryList,1),"|")
EndFunc
;----------------------------------------------------------------------------------------------------------------------------------
Func DotNetZip_ExtractSingleFileFromArc($pathToZipFile,$sEntryFileName,$sDestinationDir,$bOverwrite = 1)
    If Not $__DotNetIsLoadedSuccessfully Then _DotNet_Load($DLL_Path_IonicZip)
    $oZipFile = ObjCreate("Ionic.Zip.ZipFile")
    $oZipFile.Initialize($pathToZipFile)
    $oZipFile.ExtractSelectedEntries_5($sEntryFileName,"",$sDestinationDir,$bOverwrite)
    $oZipFile.Dispose()
    Return True
EndFunc
;----------------------------------------------------------------------------------------------------------------------------------
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...