Archive-Unzip-Burst

 view release on metacpan or  search on metacpan

unzip-6.0/windll/csharp/Unzip.cs  view on Meta::CPAN

    private string [] m_FilesToExclude = new string[0]; //Default
    private ZipFileEntries m_ZipFileEntries = new ZipFileEntries();
    private Encoding m_EncodingANSI = Encoding.Default;

    private ExtractOnlyNewerEnum m_ExtractOnlyNewer;
    private SpaceToUnderScoreEnum m_SpaceToUnderScore;
    private PromptToOverWriteEnum m_PromptToOverWrite;
    private QuietEnum m_Quiet;
    private WriteStdOutEnum m_WriteStdOut;
    private TestZipEnum m_TestZip;
    private ExtractOrListEnum m_ExtractOrList;
    private FreshenExistingEnum m_FreshenExisting;
    private DisplayCommentEnum m_DisplayComment;
    private HonorDirectoriesEnum m_HonorDirectories;
    private OverWriteFilesEnum m_OverWriteFiles;
    private ConvertCR_CRLFEnum m_ConvertCR_CRLF;
    private VerboseZIEnum m_VerboseZI;
    private UnixFileBackupEnum m_UnixFileBackup;
    private CaseSensitivityEnum m_CaseSensitivity;
    private RestoreTimeStampsEnum m_RestoreTimeStamps;
    private UTF8NameTranslationEnum m_UTF8NameTranslation;
    private PrivilegeEnum m_Privilege;


    #endregion

    #region Structures

    // Callback Large String
    protected struct UNZIPCBChar
    {
      [MarshalAs( UnmanagedType.ByValArray, SizeConst= 32000, ArraySubType = UnmanagedType.U1)]
      public byte [] ch;
    }

    // Callback Small String (size of a filename buffer)
    protected struct UNZIPCBCh
    {
      [MarshalAs( UnmanagedType.ByValArray, SizeConst= 260, ArraySubType = UnmanagedType.U1)]
      public byte [] ch;
    }

    //UNZIP32.DLL DCLIST Structure
    [ StructLayout( LayoutKind.Sequential )]
    protected struct DCLIST
    {
      public uint StructVersID;       // struct version id (= UZ_DCL_STRUCTVER)
      public int ExtractOnlyNewer;    //1 = Extract Only Newer/New, Else 0
      public int SpaceToUnderscore;   //1 = Convert Space To Underscore, Else 0
      public int PromptToOverwrite;   //1 = Prompt To Overwrite Required, Else 0
      public int fQuiet;              //2 = No Messages, 1 = Less, 0 = All
      public int ncflag;              //1 = Write To Stdout, Else 0
      public int ntflag;              //1 = Test Zip File, Else 0
      public int nvflag;              //0 = Extract, 1 = List Zip Contents
      public int nfflag;              //1 = Extract Only Newer Over Existing, Else 0
      public int nzflag;              //1 = Display Zip File Comment, Else 0
      public int ndflag;              //1 = Honor Directories, Else 0
      public int noflag;              //1 = Overwrite Files, Else 0
      public int naflag;              //1 = Convert CR To CRLF, Else 0
      public int nZIflag;             //1 = Zip Info Verbose, Else 0
      public int B_flag;              //1 = backup existing files
      public int C_flag;              //1 = Case Insensitivity, 0 = Case Sensitivity
      public int D_flag;              //controls restoration of timestamps
                                      //0 = restore all timestamps (default)
                                      //1 = skip restoration of timestamps for folders
                                      //    created on behalf of directory entries in the
                                      //    Zip archive
                                      //2 = no restoration of timestamps; extracted files
                                      //    and dirs get stamped with current time */
      public int U_flag;              // controls UTF-8 filename coding support
                                      //0 = automatic UTF-8 translation enabled (default)
                                      //1 = recognize UTF-8 coded names, but all non-ASCII
                                      //    characters are "escaped" into "#Uxxxx"
                                      //2 = UTF-8 support is disabled, filename handling
                                      //    works exactly as in previous UnZip versions */
      public int fPrivilege;          //1 = ACL, 2 = Privileges
      public string Zip;              //The Zip Filename To Extract Files
      public string ExtractDir;       //The Extraction Directory, NULL If Extracting To Current Dir
    }

    //UNZIP32.DLL Userfunctions Structure
    [ StructLayout( LayoutKind.Sequential )]
    protected struct USERFUNCTION
    {
      public UZDLLPrintCallback UZDLLPrnt;              //Print function callback
      public int UZDLLSND;                              //Not supported
      public UZDLLReplaceCallback UZDLLREPLACE;         //Replace function callback
      public UZDLLPasswordCallback UZDLLPASSWORD;       //Password function callback
      // 64-bit versions
      public UZReceiveDLLMessageCallback UZDLLMESSAGE;  //Receive message callback
      public UZDLLServiceCallback UZDLLSERVICE;         //Service callback
      // 32-bit versions (not used/needed here)
      public UZReceiveDLLMsgCBck_32 UZDLLMESSAGE_I32;   //Receive message callback
      public UZDLLServiceCBck_32 UZDLLSERVICE_I32;      //Service callback
      public ulong TotalSizeComp;                       //Total Size Of Zip Archive
      public ulong TotalSize;                           //Total Size Of All Files In Archive
      public ulong NumMembers;                          //Total Number Of All Files In The Archive
      public uint CompFactor;                           //Compression Factor
      public short cchComment;                          //Flag If Archive Has A Comment!
    }

    #endregion

    #region DLL Function Declares

    //NOTE:
    //This Assumes UNZIP32.DLL Is In Your \Windows\System Directory!
    [DllImport("unzip32.dll", SetLastError=true)]
    private static extern int Wiz_SingleEntryUnzip (int ifnc, string [] ifnv, int xfnc, string [] xfnv,
      ref DCLIST dcl, ref USERFUNCTION Userf);


    #endregion

    #region Properties

    public string Password
    {
      get {return m_Password;}
      set {m_Password = value;}
    }



( run in 1.142 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )