コード例 #1
0
        public ZipFileEntries GetZipFileContents()
        {
            int ret = 0;

            DCLIST dclist = new DCLIST();

            dclist.StructVersID = uz_dcl_StructVer;
            dclist.nvflag       = ConvertEnumToInt(ExtractOrListEnum.ListContents);
            dclist.Zip          = m_ZipFileName;

            USERFUNCTION uf = PrepareUserFunctionCallbackStructure();

            m_ZipFileSize  = 0;
            m_ZipFileCount = 0;
            m_ZipFileEntries.Clear();

            //This call will fill the m_ZipFileEntries collection because when the nvflag = ExtractListEnum.ListContents
            //the UZReceiveDLLMessage callback function is called
            try
            {
                ret = Wiz_SingleEntryUnzip(m_FilesToUnzip.Length, m_FilesToUnzip, m_FilesToExclude.Length,
                                           m_FilesToExclude, ref dclist, ref uf);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString() + Environment.NewLine +
                                "Last Win32ErrorCode: " + Marshal.GetLastWin32Error());
                //You can check the meaning of return codes here:
                //http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes__0-499_.asp
            }

            return(m_ZipFileEntries);
        }
コード例 #2
0
        private USERFUNCTION PrepareUserFunctionCallbackStructure()
        {
            USERFUNCTION uf = new USERFUNCTION();

            uf.UZDLLPrnt        = new UZDLLPrintCallback(UZDLLPrint);
            uf.UZDLLSND         = 0; //Not supported
            uf.UZDLLREPLACE     = new UZDLLReplaceCallback(UZDLLReplace);
            uf.UZDLLPASSWORD    = new UZDLLPasswordCallback(UZDLLPassword);
            uf.UZDLLMESSAGE     = new UZReceiveDLLMessageCallback(UZReceiveDLLMessage);
            uf.UZDLLSERVICE     = new UZDLLServiceCallback(UZDLLService);
            uf.UZDLLMESSAGE_I32 = null; // not used
            uf.UZDLLSERVICE_I32 = null; // not used

            return(uf);
        }
コード例 #3
0
        private bool GetZipFileSizeAndCount()
        {
            int ret = 0;

            DCLIST dclist = new DCLIST();

            dclist.StructVersID = uz_dcl_StructVer; // Current version of this structure
            dclist.nvflag       = ConvertEnumToInt(ExtractOrListEnum.ListContents);
            dclist.Zip          = m_ZipFileName;
            dclist.ExtractDir   = m_ExtractionDirectory;

            USERFUNCTION uf = PrepareUserFunctionCallbackStructure();

            //Reset these variables
            m_ZipFileSize  = 0;
            m_ZipFileCount = 0;

            ret = Wiz_SingleEntryUnzip(m_FilesToUnzip.Length, m_FilesToUnzip, m_FilesToExclude.Length,
                                       m_FilesToExclude, ref dclist, ref uf);

            return(ret == 0);
        }
コード例 #4
0
        public static int VBUnzip(ref object sZipFileName, ref string sUnzipDirectory, ref short iExtractNewer, ref short iSpaceUnderScore, ref short iPromptOverwrite, ref short iQuiet, ref short iWriteStdOut, ref short iTestZip, ref short iExtractList, ref short iExtractOnlyNewer,
                                  ref short iDisplayComment, ref short iHonorDirectories, ref short iOverwriteFiles, ref short iConvertCR_CRLF, ref short iVerbose, ref short iCaseSensitivty, ref short iPrivilege)
        {
            int functionReturnValue = 0;


            // ERROR: Not supported in C#: OnErrorStatement



            int lRet = 0;

            DCLIST       UZDCL  = default(DCLIST);
            USERFUNCTION UZUSER = default(USERFUNCTION);
            //UPGRADE_WARNING: Arrays in structure UZVER may need to be initialized before they can be used. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="814DF224-76BD-4BB4-BFFB-EA359CB9FC48"'
            UZPVER UZVER = default(UZPVER);
            //UPGRADE_WARNING: Arrays in structure uExcludeNames may need to be initialized before they can be used. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="814DF224-76BD-4BB4-BFFB-EA359CB9FC48"'
            UNZIPnames uExcludeNames = default(UNZIPnames);
            //UPGRADE_WARNING: Arrays in structure uZipNames may need to be initialized before they can be used. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="814DF224-76BD-4BB4-BFFB-EA359CB9FC48"'
            UNZIPnames uZipNames = default(UNZIPnames);

            msOutput = "";

            uExcludeNames.uzFiles[0] = Constants.vbNullString;
            uZipNames.uzFiles[0]     = Constants.vbNullString;

            uZipNumber  = 0;
            uZipMessage = Constants.vbNullString;
            uZipInfo    = Constants.vbNullString;
            uVBSkip     = 0;

            var _with1 = UZDCL;

            _with1.ExtractOnlyNewer  = iExtractOnlyNewer;
            _with1.SpaceToUnderScore = iSpaceUnderScore;
            _with1.PromptToOverwrite = iPromptOverwrite;
            _with1.fQuiet            = iQuiet;
            _with1.ncflag            = iWriteStdOut;
            _with1.ntflag            = iTestZip;
            _with1.nvflag            = iExtractList;
            _with1.nUflag            = iExtractNewer;
            _with1.nzflag            = iDisplayComment;
            _with1.ndflag            = iHonorDirectories;
            _with1.noflag            = iOverwriteFiles;
            _with1.naflag            = iConvertCR_CRLF;
            _with1.nZIflag           = iVerbose;
            _with1.C_flag            = iCaseSensitivty;
            _with1.fPrivilege        = iPrivilege;
            //UPGRADE_WARNING: Couldn't resolve default property of object sZipFileName. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            _with1.Zip        = sZipFileName;
            _with1.ExtractDir = sUnzipDirectory;

            var _with2 = UZUSER;

            //UPGRADE_WARNING: Add a delegate for AddressOf UZDLLPrnt Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"'
            //.UZDLLPrnt = FnPtr(AddressOf UZDLLPrnt)
            _with2.UZDLLSND = 0;
            //UPGRADE_WARNING: Add a delegate for AddressOf UZDLLRep Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"'
            //.UZDLLREPLACE = FnPtr(AddressOf UZDLLRep)
            //UPGRADE_WARNING: Add a delegate for AddressOf UZDLLPass Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"'
            //.UZDLLPASSWORD = FnPtr(AddressOf UZDLLPass)
            //UPGRADE_WARNING: Add a delegate for AddressOf UZReceiveDLLMessage Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"'
            //.UZDLLMESSAGE = FnPtr(AddressOf UZReceiveDLLMessage)
            //UPGRADE_WARNING: Add a delegate for AddressOf UZDLLServ Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"'
            //.UZDLLSERVICE = FnPtr(AddressOf UZDLLServ)

            var _with3 = UZVER;

            _with3.structlen    = Strings.Len(UZVER);
            _with3.beta         = Strings.Space(9) + Constants.vbNullChar;
            _with3.date_Renamed = Strings.Space(19) + Constants.vbNullChar;
            _with3.zlib         = Strings.Space(9) + Constants.vbNullChar;

            UzpVersion2(ref UZVER);

            lRet = Wiz_SingleEntryUnzip(0, ref uZipNames, 0, ref uExcludeNames, ref UZDCL, ref UZUSER);
            functionReturnValue = lRet;
            return(functionReturnValue);

vbErrorHandler:



            Err().Raise(Err().Number, "CodeModule::VBUnzip", Err().Description);
            return(functionReturnValue);
        }
コード例 #5
0
//-- This Assumes UNZIP32.DLL Is In Your \Windows\System Directory!
//UPGRADE_WARNING: Structure USERFUNCTION may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
//UPGRADE_WARNING: Structure DCLIST may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
//UPGRADE_WARNING: Structure UNZIPnames may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
//UPGRADE_WARNING: Structure UNZIPnames may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
        private static extern int Wiz_SingleEntryUnzip(int ifnc, ref UNZIPnames ifnv, int xfnc, ref UNZIPnames xfnv, ref DCLIST dcll, ref USERFUNCTION Userf);
コード例 #6
0
ファイル: Unzip.cs プロジェクト: firefighter389/wwiv
    private USERFUNCTION PrepareUserFunctionCallbackStructure()
    {
      USERFUNCTION uf = new USERFUNCTION();
      uf.UZDLLPrnt = new UZDLLPrintCallback(UZDLLPrint);
      uf.UZDLLSND = 0; //Not supported
      uf.UZDLLREPLACE = new UZDLLReplaceCallback(UZDLLReplace);
      uf.UZDLLPASSWORD = new UZDLLPasswordCallback(UZDLLPassword);
      uf.UZDLLMESSAGE = new UZReceiveDLLMessageCallback(UZReceiveDLLMessage);
      uf.UZDLLSERVICE = new UZDLLServiceCallback(UZDLLService);
      uf.UZDLLMESSAGE_I32 = null; // not used
      uf.UZDLLSERVICE_I32 = null; // not used

      return uf;
    }
コード例 #7
0
ファイル: Unzip.cs プロジェクト: firefighter389/wwiv
 private static extern int Wiz_SingleEntryUnzip (int ifnc, string [] ifnv, int xfnc, string [] xfnv,
   ref DCLIST dcl, ref USERFUNCTION Userf);
コード例 #8
0
ファイル: CodeModule.cs プロジェクト: nodoid/PointOfSale
 private static extern int Wiz_SingleEntryUnzip(int ifnc, ref UNZIPnames ifnv, int xfnc, ref UNZIPnames xfnv, ref DCLIST dcll, ref USERFUNCTION Userf);
コード例 #9
0
        public int UnZipFiles()
        {
            int ret = -1;

            //check to see if there is enough information to proceed.
            //Exceptions can be thrown if required data is not passed in
            if (m_ZipFileName == string.Empty)
            {
                return(-1);
            }
            if (m_ExtractionDirectory == string.Empty)
            {
                return(-1);
            }

            //The zip file size, in bytes, is stored in the m_ZipFileSize variable.
            //m_ZipFileCount is the number of files in the zip.  This information
            //is useful for some sort of progress information during unzipping.
            if (!GetZipFileSizeAndCount())
            {
                return(ret);
            }

            DCLIST dclist = new DCLIST();

            dclist.StructVersID      = uz_dcl_StructVer; // Current version of this structure
            dclist.ExtractOnlyNewer  = ConvertEnumToInt(m_ExtractOnlyNewer);
            dclist.SpaceToUnderscore = ConvertEnumToInt(m_SpaceToUnderScore);
            dclist.PromptToOverwrite = ConvertEnumToInt(m_PromptToOverWrite);
            dclist.fQuiet            = ConvertEnumToInt(m_Quiet);
            dclist.ncflag            = ConvertEnumToInt(m_WriteStdOut);
            dclist.ntflag            = ConvertEnumToInt(m_TestZip);
            dclist.nvflag            = ConvertEnumToInt(m_ExtractOrList);
            dclist.nfflag            = ConvertEnumToInt(m_FreshenExisting);
            dclist.nzflag            = ConvertEnumToInt(m_DisplayComment);
            dclist.ndflag            = ConvertEnumToInt(m_HonorDirectories);
            dclist.noflag            = ConvertEnumToInt(m_OverWriteFiles);
            dclist.naflag            = ConvertEnumToInt(m_ConvertCR_CRLF);
            dclist.nZIflag           = ConvertEnumToInt(m_VerboseZI);
            dclist.B_flag            = ConvertEnumToInt(m_UnixFileBackup);
            dclist.C_flag            = ConvertEnumToInt(m_CaseSensitivity);
            dclist.D_flag            = ConvertEnumToInt(m_RestoreTimeStamps);
            dclist.U_flag            = ConvertEnumToInt(m_UTF8NameTranslation);
            dclist.fPrivilege        = ConvertEnumToInt(m_Privilege);
            dclist.Zip        = m_ZipFileName;
            dclist.ExtractDir = m_ExtractionDirectory;

            USERFUNCTION uf = PrepareUserFunctionCallbackStructure();

            try
            {
                ret = Wiz_SingleEntryUnzip(m_FilesToUnzip.Length, m_FilesToUnzip, m_FilesToExclude.Length,
                                           m_FilesToExclude, ref dclist, ref uf);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString() + Environment.NewLine +
                                "Last Win32ErrorCode: " + Marshal.GetLastWin32Error());
                //You can check the meaning of return codes here:
                //http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes__0-499_.asp
            }

            return(ret);
        }
コード例 #10
0
 private static extern int Wiz_SingleEntryUnzip(int ifnc, string [] ifnv, int xfnc, string [] xfnv,
                                                ref DCLIST dcl, ref USERFUNCTION Userf);