Ejemplo n.º 1
0
 /// <summary>
 /// Raises the <see cref="CabinetComplete"/> event.
 /// </summary>
 /// <param name="e">A <see cref="ProgressEventArgs"/> that contains the event data.</param>
 protected virtual void OnCabinetComplete(ProgressEventArgs e)
 {
     Trace.WriteLine("OnCabinetComplete");
     if (CabinetComplete != null)
         CabinetComplete(this, e);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Raises the <see cref="FileAdded"/> event.
 /// </summary>
 /// <param name="e">A <see cref="ProgressEventArgs"/> that contains the event data.</param>
 protected virtual void OnFileAdded(ProgressEventArgs e)
 {
     Trace.WriteLine("OnFileAdded");
     if (FileAdded != null)
         FileAdded(this, e);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Raises the <see cref="FolderComplete"/> event.
 /// </summary>
 /// <param name="e">A <see cref="ProgressEventArgs"/> that contains the event data.</param>
 protected virtual void OnFolderComplete(ProgressEventArgs e)
 {
     Trace.WriteLine("OnFolderComplete");
     if (FolderComplete != null)
         FolderComplete(this, e);
 }
Ejemplo n.º 4
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;
 }