public int MakeZipFile() { int functionReturnValue = 0; //UPGRADE_WARNING: Arrays in structure zFileArray 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"' ZIPnames zFileArray = default(ZIPnames); object sFileName = null; int lFileCount = 0; short iIgnorePath = 0; short iRecurse = 0; // ERROR: Not supported in C#: OnErrorStatement lFileCount = 0; foreach (object sFileName_loopVariable in mCollection) { sFileName = sFileName_loopVariable; //UPGRADE_WARNING: Couldn't resolve default property of object sFileName. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' zFileArray.s(lFileCount) = sFileName; lFileCount = lFileCount + 1; } functionReturnValue = CodeModule.VBZip(Convert.ToInt16(lFileCount), msZipFileName, zFileArray, iIgnorePath, miRecurseFolders, miUpdateZip, 0, msRootDirectory); return(functionReturnValue); vbErrorHandler: functionReturnValue = -99; Err().Raise(Err().Number, "CGZipFiles::MakeZipFile", Err().Description); return(functionReturnValue); }
//Main Subroutine public static int VBZip(ref short argc, ref string zipname, ref ZIPnames mynames, ref short junk, ref short recurse, ref short updat, ref short freshen, ref string basename, ref short Encrypt = 0, ref short IncludeSystem = 0, ref short IgnoreDirectoryEntries = 0, ref short Verbose = 0, ref short Quiet = 0, ref short CRLFtoLF = 0, ref short LFtoCRLF = 0, ref short Grow = 0, ref short Force = 0, ref short iMove = 0, ref short DeleteEntries = 0) { int hmem = 0; short xx = 0; int retcode = 0; ZIPUSERFUNCTIONS MYUSER = default(ZIPUSERFUNCTIONS); ZPOPT MYOPT = default(ZPOPT); // ERROR: Not supported in C#: OnErrorStatement // nothing will go wrong :-) msOutput = ""; // Set address of callback functions //UPGRADE_WARNING: Add a delegate for AddressOf DLLPrnt Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"' //MYUSER.DLLPrnt = FnPtr(AddressOf DLLPrnt) //UPGRADE_WARNING: Add a delegate for AddressOf DllPass Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"' //MYUSER.DLLPASSWORD = FnPtr(AddressOf DllPass) //UPGRADE_WARNING: Add a delegate for AddressOf DllComm Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"' //MYUSER.DLLCOMMENT = FnPtr(AddressOf DllComm) MYUSER.DLLSERVICE = 0; // not coded yet :-) // retcode = ZpInit(MYUSER) // Set zip options MYOPT.fSuffix = 0; // include suffixes (not yet implemented) MYOPT.fEncrypt = Encrypt; // 1 if encryption wanted MYOPT.fSystem = IncludeSystem; // 1 to include system/hidden files MYOPT.fVolume = 0; // 1 if storing volume label MYOPT.fExtra = 0; // 1 if including extra attributes MYOPT.fNoDirEntries = IgnoreDirectoryEntries; // 1 if ignoring directory entries MYOPT.fExcludeDate = 0; // 1 if excluding files earlier than a specified date MYOPT.fIncludeDate = 0; // 1 if including files earlier than a specified date MYOPT.fVerbose = Verbose; // 1 if full messages wanted MYOPT.fQuiet = Quiet; // 1 if minimum messages wanted MYOPT.fCRLF_LF = CRLFtoLF; // 1 if translate CR/LF to LF MYOPT.fLF_CRLF = LFtoCRLF; // 1 if translate LF to CR/LF MYOPT.fJunkDir = junk; // 1 if junking directory names MYOPT.fRecurse = recurse; // 1 if recursing into subdirectories MYOPT.fGrow = Grow; // 1 if allow appending to zip file MYOPT.fForce = Force; // 1 if making entries using DOS names MYOPT.fMove = iMove; // 1 if deleting files added or updated MYOPT.fDeleteEntries = DeleteEntries; // 1 if files passed have to be deleted MYOPT.fUpdate = updat; // 1 if updating zip file--overwrite only if newer MYOPT.fFreshen = freshen; // 1 if freshening zip file--overwrite only MYOPT.fJunkSFX = 0; // 1 if junking sfx prefix MYOPT.fLatestTime = 0; // 1 if setting zip file time to time of latest file in archive MYOPT.fComment = 0; // 1 if putting comment in zip file MYOPT.fOffsets = 0; // 1 if updating archive offsets for sfx Files MYOPT.fPrivilege = 0; // 1 if not saving privelages MYOPT.fEncryption = 0; //Read only property! MYOPT.fRepair = 0; // 1=> fix archive, 2=> try harder to fix MYOPT.flevel = 0; // compression level - should be 0!!! MYOPT.date_Renamed = Constants.vbNullString; // "12/31/79"? US Date? MYOPT.szRootDir = Strings.UCase(basename); retcode = ZpInit(ref MYUSER); // Set options retcode = ZpSetOptions(ref MYOPT); // ZCL not needed in VB // MYZCL.argc = 2 // MYZCL.filename = "c:\wiz\new.zip" // MYZCL.fileArray = MYNAMES // Go for it! retcode = ZpArchive(argc, zipname, ref mynames); return(retcode); }
// used to check encryption flag only //UPGRADE_WARNING: Structure ZIPnames 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 ZpArchive(int argc, string funame, ref ZIPnames argv);
private static extern int ZpArchive(int argc, string funame, ref ZIPnames argv);
//Main Subroutine public static int VBZip(ref short argc, ref string zipname, ref ZIPnames mynames, ref short junk, ref short recurse, ref short updat, ref short freshen, ref string basename, ref short Encrypt = 0, ref short IncludeSystem = 0, ref short IgnoreDirectoryEntries = 0, ref short Verbose = 0, ref short Quiet = 0, ref short CRLFtoLF = 0, ref short LFtoCRLF = 0, ref short Grow = 0, ref short Force = 0, ref short iMove = 0, ref short DeleteEntries = 0) { int hmem = 0; short xx = 0; int retcode = 0; ZIPUSERFUNCTIONS MYUSER = default(ZIPUSERFUNCTIONS); ZPOPT MYOPT = default(ZPOPT); // ERROR: Not supported in C#: OnErrorStatement // nothing will go wrong :-) msOutput = ""; // Set address of callback functions //UPGRADE_WARNING: Add a delegate for AddressOf DLLPrnt Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"' //MYUSER.DLLPrnt = FnPtr(AddressOf DLLPrnt) //UPGRADE_WARNING: Add a delegate for AddressOf DllPass Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"' //MYUSER.DLLPASSWORD = FnPtr(AddressOf DllPass) //UPGRADE_WARNING: Add a delegate for AddressOf DllComm Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"' //MYUSER.DLLCOMMENT = FnPtr(AddressOf DllComm) MYUSER.DLLSERVICE = 0; // not coded yet :-) // retcode = ZpInit(MYUSER) // Set zip options MYOPT.fSuffix = 0; // include suffixes (not yet implemented) MYOPT.fEncrypt = Encrypt; // 1 if encryption wanted MYOPT.fSystem = IncludeSystem; // 1 to include system/hidden files MYOPT.fVolume = 0; // 1 if storing volume label MYOPT.fExtra = 0; // 1 if including extra attributes MYOPT.fNoDirEntries = IgnoreDirectoryEntries; // 1 if ignoring directory entries MYOPT.fExcludeDate = 0; // 1 if excluding files earlier than a specified date MYOPT.fIncludeDate = 0; // 1 if including files earlier than a specified date MYOPT.fVerbose = Verbose; // 1 if full messages wanted MYOPT.fQuiet = Quiet; // 1 if minimum messages wanted MYOPT.fCRLF_LF = CRLFtoLF; // 1 if translate CR/LF to LF MYOPT.fLF_CRLF = LFtoCRLF; // 1 if translate LF to CR/LF MYOPT.fJunkDir = junk; // 1 if junking directory names MYOPT.fRecurse = recurse; // 1 if recursing into subdirectories MYOPT.fGrow = Grow; // 1 if allow appending to zip file MYOPT.fForce = Force; // 1 if making entries using DOS names MYOPT.fMove = iMove; // 1 if deleting files added or updated MYOPT.fDeleteEntries = DeleteEntries; // 1 if files passed have to be deleted MYOPT.fUpdate = updat; // 1 if updating zip file--overwrite only if newer MYOPT.fFreshen = freshen; // 1 if freshening zip file--overwrite only MYOPT.fJunkSFX = 0; // 1 if junking sfx prefix MYOPT.fLatestTime = 0; // 1 if setting zip file time to time of latest file in archive MYOPT.fComment = 0; // 1 if putting comment in zip file MYOPT.fOffsets = 0; // 1 if updating archive offsets for sfx Files MYOPT.fPrivilege = 0; // 1 if not saving privelages MYOPT.fEncryption = 0; //Read only property! MYOPT.fRepair = 0; // 1=> fix archive, 2=> try harder to fix MYOPT.flevel = 0; // compression level - should be 0!!! MYOPT.date_Renamed = Constants.vbNullString; // "12/31/79"? US Date? MYOPT.szRootDir = Strings.UCase(basename); retcode = ZpInit(ref MYUSER); // Set options retcode = ZpSetOptions(ref MYOPT); // ZCL not needed in VB // MYZCL.argc = 2 // MYZCL.filename = "c:\wiz\new.zip" // MYZCL.fileArray = MYNAMES // Go for it! retcode = ZpArchive(argc, zipname, ref mynames); return retcode; }