/// <summary>
        /// Writes bytes to a file.
        /// </summary>
        /// <param name="hf">The file handle to which data is to be written.</param>
        /// <param name="buffer">The buffer that contains the data to be written.</param>
        /// <param name="cb">The number of bytes to be written.</param>
        /// <returns>Returns the number of bytes written.</returns>
        /// <remarks>The File Decompression Interface (FDI) calls this function to write to a file.</remarks>
        protected virtual int FileWrite(IntPtr hf, byte[] buffer, int cb)
        {
            Trace.WriteLine(string.Format("FileWrite {0}", hf));
            int err = 0;

            try
            {
                return(CabIO.FileWrite(hf, buffer, cb, ref err, userData));
            }
            finally
            {
                erf.ErrorType = err;
            }
        }
Example #2
0
 /// <summary>
 /// Writes bytes to a file.
 /// </summary>
 /// <param name="hf">The file handle to which data is to be written.</param>
 /// <param name="buffer">The buffer that contains the data to be written.</param>
 /// <param name="cb">The number of bytes to be written.</param>
 /// <param name="err">Error return value.</param>
 /// <param name="pUserData">User data object.</param>
 /// <returns>Returns the number of bytes written.</returns>
 /// <remarks>The File Compression Interface (FCI) calls this function to write to a file.</remarks>
 protected virtual int FileWrite(IntPtr hf, byte[] buffer, int cb,
                                 ref int err, IntPtr pUserData)
 {
     Trace.WriteLine(string.Format("FileWrite {0}", hf));
     return(CabIO.FileWrite(hf, buffer, cb, ref err, ((GCHandle)pUserData).Target));
 }