Пример #1
0
        /// <summary>
        /// Processes the replace callback.
        /// </summary>
        /// <param name="msg">The message.</param>
        /// <param name="x">The length of the message text.</param>
        /// <returns>
        /// Return code that tells to unzip what to do when the file already exists
        /// </returns>
        internal int ProcessReplaceCallback(ref CallbackString msg, uint x)
        {
            string s = InternalHelper.PCharToString(msg.Buffer);
            FileReplaceEventArgs e = new FileReplaceEventArgs(s, FileReplaceOption.OverwriteFile);

            OnFileReplace(e);
            return(InternalHelper.ReplaceOptionToCode(e.Option));
        }
Пример #2
0
        /// <summary>
        /// Processes the service message.
        /// </summary>
        /// <param name="msg">The MSG.</param>
        /// <param name="x">The x.</param>
        /// <returns></returns>
        internal int ProcessServiceMessage(ref CallbackString msg, uint x)
        {
            string s = InternalHelper.PCharToString(msg.Buffer);
            CompressionServiceEventArgs e = new CompressionServiceEventArgs(s, (int)x);

            OnReceiveServiceMessage(e);

            return(0);
        }
Пример #3
0
        /// <summary>
        /// The zip32.dll passes activity messages to the declared byte array.
        /// Decode the byte array to see the message
        /// </summary>
        /// <param name="msg">The message.</param>
        /// <param name="x">The length of the message.</param>
        /// <returns></returns>
        internal int ProcessPrintCallback(ref CallbackString msg, uint x)
        {
            string s = InternalHelper.PCharToString(msg.Buffer);
            CompressionEventArgs e = new CompressionEventArgs(s);

            OnPrintMessage(e);

            return(0);
        }
Пример #4
0
        /// <summary>
        /// Processes the comment callback.
        /// </summary>
        /// <param name="msg">The message.</param>
        /// <returns></returns>
        internal int ProcessCommentCallback(ref CallbackString msg)
        {
            if (string.IsNullOrEmpty(comment))
            {
                return(1);
            }

            //clear the byte array
            for (int i = 0; i <= msg.Buffer.Length - 1; i++)
            {
                msg.Buffer[i] = 0;
            }

            //set the comment in the zip file
            Ascii.GetBytes(comment, 0, comment.Length, msg.Buffer, 0);

            return(0);
        }