コード例 #1
0
 /// <summary>
 /// Prepares the call back.
 /// </summary>
 /// <returns>ZipUserFunctions stucture</returns>
 internal ZipUserFunctions PrepareCallBack()
 {
     zuf = new ZipUserFunctions();
     zuf.PrintCallbackFunction    = new PrintCallbackDelegate(ProcessPrintCallback);
     zuf.ServiceCallbackFunction  = new ServiceCallbackDelegate(ProcessServiceMessage);
     zuf.PasswordCallbackFunction = new PasswordCallbackDelegate(ProcessPasswordCallback);
     zuf.CommentCallbackFunction  = new CommentCallbackDelegate(ProcessCommentCallback);
     return(zuf);
 }
コード例 #2
0
        internal bool ProcessFiles(string[] fileMask, ZipOptions zopt)
        {
            int      iret;
            ZipError zipError;

            if (string.IsNullOrEmpty(FileName))
            {
                return(false);
            }

            if (fileMask.Length == 0)
            {
                return(false);
            }

            ZipUserFunctions zuf = PrepareCallBack();

            try
            {
                iret = NativeMethods.ZpInit(ref zuf);
            }
            catch (DllNotFoundException)
            {
                return(false);
            }

            if (iret == 0)
            {
                return(false);
            }


            try
            {
                zipError = NativeMethods.ZpSetOptions(ref zopt);
                zipError = NativeMethods.ZpArchive(fileMask.Length, fileName, fileMask);
            }
            catch (DllNotFoundException)
            {
                return(false);
            }
            return(zipError == ZipError.ZE_OK);
        }
コード例 #3
0
 public static extern int ZpInit(ref ZipUserFunctions zuf);