//-- Callback For UNZIP32.DLL - Print Message Function public static int UZDLLPrnt(ref UNZIPCBChar fname, int x) { string s0 = null; int xx = 0; //-- Always Put This In Callback Routines! // ERROR: Not supported in C#: OnErrorStatement s0 = ""; //-- Gets The UNZIP32.DLL Message For Displaying. for (xx = 0; xx <= x - 1; xx++) { if (fname.ch[xx] == 0) { break; // TODO: might not be correct. Was : Exit For } s0 = s0 + Strings.Chr(fname.ch[xx]); } //-- Assign Zip Information if (Strings.Mid(s0, 1, 1) == Constants.vbLf) { s0 = Constants.vbNewLine; } // Damn UNIX :-) uZipInfo = uZipInfo + s0; msOutput = uZipInfo; return(0); }
//-- Callback For UNZIP32.DLL - Report Function To Overwrite Files. //-- This Function Will Display A MsgBox Asking The User //-- If They Would Like To Overwrite The Files. public static int UZDLLRep(ref UNZIPCBChar fname) { int functionReturnValue = 0; string s0 = null; int xx = 0; //-- Always Put This In Callback Routines! // ERROR: Not supported in C#: OnErrorStatement functionReturnValue = 100; // 100 = Do Not Overwrite - Keep Asking User s0 = ""; for (xx = 0; xx <= 255; xx++) { if (fname.ch[xx] == 0) { xx = 99999; } else { s0 = s0 + Strings.Chr(fname.ch[xx]); } } //-- This Is The MsgBox Code xx = Interaction.MsgBox("Overwrite " + s0 + "?", Convert.ToDouble(MsgBoxStyle.Exclamation + MsgBoxStyle.YesNoCancel), "VBUnZip32 - File Already Exists!"); if (xx == MsgBoxResult.No) { return(functionReturnValue); } if (xx == MsgBoxResult.Cancel) { functionReturnValue = 104; return(functionReturnValue); // 104 = Overwrite None } functionReturnValue = 102; return(functionReturnValue); // 102 = Overwrite 103 = Overwrite All }
//-- Callback For UNZIP32.DLL - DLL Service Function public static int UZDLLServ(ref UNZIPCBChar mname, int x) { string s0 = null; int xx = 0; //-- Always Put This In Callback Routines! // ERROR: Not supported in C#: OnErrorStatement s0 = ""; //-- Get Zip32.DLL Message For processing for (xx = 0; xx <= x - 1; xx++) { if (mname.ch[xx] == 0) { break; // TODO: might not be correct. Was : Exit For } s0 = s0 + Strings.Chr(mname.ch[xx]); } // At this point, s0 contains the message passed from the DLL // It is up to the developer to code something useful here :) return(0); // Setting this to 1 will abort the zip! }
//-- Callback For UNZIP32.DLL - DLL Service Function public static int UZDLLServ(ref UNZIPCBChar mname, int x) { string s0 = null; int xx = 0; //-- Always Put This In Callback Routines! // ERROR: Not supported in C#: OnErrorStatement s0 = ""; //-- Get Zip32.DLL Message For processing for (xx = 0; xx <= x - 1; xx++) { if (mname.ch[xx] == 0) break; // TODO: might not be correct. Was : Exit For s0 = s0 + Strings.Chr(mname.ch[xx]); } // At this point, s0 contains the message passed from the DLL // It is up to the developer to code something useful here :) return 0; // Setting this to 1 will abort the zip! }
//-- Callback For UNZIP32.DLL - Report Function To Overwrite Files. //-- This Function Will Display A MsgBox Asking The User //-- If They Would Like To Overwrite The Files. public static int UZDLLRep(ref UNZIPCBChar fname) { int functionReturnValue = 0; string s0 = null; int xx = 0; //-- Always Put This In Callback Routines! // ERROR: Not supported in C#: OnErrorStatement functionReturnValue = 100; // 100 = Do Not Overwrite - Keep Asking User s0 = ""; for (xx = 0; xx <= 255; xx++) { if (fname.ch[xx] == 0) xx = 99999; else s0 = s0 + Strings.Chr(fname.ch[xx]); } //-- This Is The MsgBox Code xx = Interaction.MsgBox("Overwrite " + s0 + "?", Convert.ToDouble(MsgBoxStyle.Exclamation + MsgBoxStyle.YesNoCancel), "VBUnZip32 - File Already Exists!"); if (xx == MsgBoxResult.No) return functionReturnValue; if (xx == MsgBoxResult.Cancel) { functionReturnValue = 104; return functionReturnValue; // 104 = Overwrite None } functionReturnValue = 102; return functionReturnValue; // 102 = Overwrite 103 = Overwrite All }
//-- Callback For UNZIP32.DLL - Print Message Function public static int UZDLLPrnt(ref UNZIPCBChar fname, int x) { string s0 = null; int xx = 0; //-- Always Put This In Callback Routines! // ERROR: Not supported in C#: OnErrorStatement s0 = ""; //-- Gets The UNZIP32.DLL Message For Displaying. for (xx = 0; xx <= x - 1; xx++) { if (fname.ch[xx] == 0) break; // TODO: might not be correct. Was : Exit For s0 = s0 + Strings.Chr(fname.ch[xx]); } //-- Assign Zip Information if (Strings.Mid(s0, 1, 1) == Constants.vbLf) s0 = Constants.vbNewLine; // Damn UNIX :-) uZipInfo = uZipInfo + s0; msOutput = uZipInfo; return 0; }