Beispiel #1
0
 /// <summary>
 /// Raises the <see cref="DecryptDataBlock"/> event.
 /// </summary>
 /// <param name="e">A <see cref="FdiDecryptEventArgs"/> that contains the event data.</param>
 protected virtual void OnDecryptDataBlock(FdiDecryptEventArgs e)
 {
     if (DecryptDataBlock != null)
         DecryptDataBlock(this, e);
 }
Beispiel #2
0
 /// <summary>
 /// Raises the <see cref="DecryptNewCabinet"/> event.
 /// </summary>
 /// <param name="e">A <see cref="FdiDecryptEventArgs"/> that contains the event data.</param>
 protected virtual void OnDecryptNewCabinet(FdiDecryptEventArgs e)
 {
     if (DecryptNewCabinet != null)
         DecryptNewCabinet(this, e);
 }
Beispiel #3
0
 /// <summary>
 /// Raises the <see cref="DecryptNewFolder"/> event.
 /// </summary>
 /// <param name="e">A <see cref="FdiDecryptEventArgs"/> that contains the event data.</param>
 protected virtual void OnDecryptNewFolder(FdiDecryptEventArgs e)
 {
     if (DecryptNewFolder != null)
         DecryptNewFolder(this, e);
 }
Beispiel #4
0
        /// <summary>
        /// Receives decryption callback requests from the File Decompression Interface (FDI)
        /// </summary>
        /// <param name="fdid">A <see cref="FdiDecrypt"/> structure containing decrypt information.</param>
        /// <returns>Returns -1 on error.  Any other value indicates success.</returns>
        /// <remarks>The File Decompression Interface (FDI) calls this function during decompression so that
        /// clients can decrypt encrypted data.  There are three notification types:  Decrypt, NewCabinet, and NewFolder.
        /// Clients that wish to receive these notifications must handle the <see cref="DecryptDataBlock"/>, <see cref="DecryptNewCabinet"/>,
        /// and <see cref="DecryptNewFolder"/> events.</remarks>
        protected virtual int DecryptCallback(ref FdiDecrypt fdid)
        {
            Trace.WriteLine("DecryptCallback");
            FdiDecryptEventArgs e = new FdiDecryptEventArgs(fdid);

            // fire the proper event
            switch (fdid.DecryptType)
            {
                case FdiDecryptType.Decrypt:
                    OnDecryptDataBlock(e);
                    break;
                case FdiDecryptType.NewCabinet:
                    OnDecryptNewCabinet(e);
                    break;
                case FdiDecryptType.NewFolder:
                    OnDecryptNewFolder(e);
                    break;
            }
            return 0;
        }