コード例 #1
0
        /// <summary>
        /// Provides progress notification during compression.
        /// </summary>
        /// <param name="typeStatus">An <see cref="FciStatus"/> value that contains the type of notification.</param>
        /// <param name="cb1">First parameter in notification.  Meaning depends on the notification type.</param>
        /// <param name="cb2">Second parameter in notification.  Meaning depends on the notification type.</param>
        /// <param name="pUserData">User data object.</param>
        /// <returns>Returns 0 on success.  Returns -1 on failure.</returns>
        /// <remarks>The File Compression Interface (FCI) calls this function periodically during the compression process.
        /// FCI notifications are provided for cabinets, files, and folders.  Clients that want these notifications must
        /// handle the CabinetComplete, FolderComplete, and FileAdded events.</remarks>
        protected virtual int ProgressFunc(
            FciStatus typeStatus,
            int cb1,
            int cb2,
            IntPtr pUserData)
        {
            Trace.WriteLine(string.Format("ProgressFunc: {0}", typeStatus));
            Trace.WriteLine(string.Format("UserDataPointer = {0}", pUserData));
            Trace.Flush();
            ProgressEventArgs e = new ProgressEventArgs(cb1, cb2, GetUserDataObject(pUserData));

            try
            {
                switch (typeStatus)
                {
                case FciStatus.Cabinet:
                    OnCabinetComplete(e);
                    break;

                case FciStatus.File:
                    OnFileAdded(e);
                    break;

                case FciStatus.Folder:
                    OnFolderComplete(e);
                    break;
                }
            }
            catch (Exception)
            {
                e.Result = -1;
            }
            Trace.WriteLine(string.Format("ProgressFunc returns {0}", e.Result));
            return(e.Result);
        }
コード例 #2
0
ファイル: CabCompressor.cs プロジェクト: Dennis-Petrov/Cash
 /// <summary>
 /// Provides progress notification during compression.
 /// </summary>
 /// <param name="typeStatus">An <see cref="FciStatus"/> value that contains the type of notification.</param>
 /// <param name="cb1">First parameter in notification.  Meaning depends on the notification type.</param>
 /// <param name="cb2">Second parameter in notification.  Meaning depends on the notification type.</param>
 /// <param name="pUserData">User data object.</param>
 /// <returns>Returns 0 on success.  Returns -1 on failure.</returns>
 /// <remarks>The File Compression Interface (FCI) calls this function periodically during the compression process.
 /// FCI notifications are provided for cabinets, files, and folders.  Clients that want these notifications must
 /// handle the CabinetComplete, FolderComplete, and FileAdded events.</remarks>
 protected virtual int ProgressFunc(
     FciStatus typeStatus,
     int cb1,
     int cb2,
     IntPtr pUserData)
 {
     Trace.WriteLine(string.Format("ProgressFunc: {0}", typeStatus));
     Trace.WriteLine(string.Format("UserDataPointer = {0}", pUserData));
     Trace.Flush();
     ProgressEventArgs e = new ProgressEventArgs(cb1, cb2, GetUserDataObject(pUserData));
     try
     {
         switch (typeStatus)
         {
             case FciStatus.Cabinet:
                 OnCabinetComplete(e);
                 break;
             case FciStatus.File:
                 OnFileAdded(e);
                 break;
             case FciStatus.Folder:
                 OnFolderComplete(e);
                 break;
         }
     }
     catch (Exception)
     {
         e.Result = -1;
     }
     Trace.WriteLine(string.Format("ProgressFunc returns {0}", e.Result));
     return e.Result;
 }