ComponentPro UltimateZip

      PasswordNeededEventArgs Class

      See AlsoMembersMembers Options: Show AllLanguage Filter: AllSend comments on this topic to ComponentPro
      Provides data for the PasswordNeeded event.


      public class PasswordNeededEventArgs : AsyncEventArgs


      Shows how to handle the PasswordNeeded event to provide password for encrypted files.

      using System;
      using ComponentPro.Compression;
      void Main()
          Zip zip = new Zip();
          zip.PasswordNeeded += zip_PasswordNeeded;
          // Open an existing archive. 
          // Extract all files to 'c:\temp' 
          // Close the zip file. 
      void zip_PasswordNeeded(object sender, PasswordNeededEventArgs e)
          Console.Write("Please enter password for " + e.FileName);
          string response = Console.ReadLine();
          if (string.IsNullOrEmpty(response))
              e.SkipFile = true; // Skip the encrypted file when user does not provide a password. 
          e.Password = response;
          Console.Write("Would you like to use this password for all other files (y/n)?");
          ConsoleKeyInfo key = Console.ReadKey();
          if (key.KeyChar == 'y' || key.KeyChar == 'Y')
              e.UpdateArchivePassword = true; // Update archive password to the provided one.

      Inheritance Hierarchy



      .NET Compact Framework.NET Compact Framework

      Supported version: 2.0, 3.5, and 3.9
      Assembly: ComponentPro.Zip.CF (in ComponentPro.Zip.CF.dll)

      .NET Framework.NET Framework

      Supported version: 2.0, 3.0, 3.5, 4.0, 4.5.x, 4.6.x and later
      Assembly: ComponentPro.Zip (in ComponentPro.Zip.dll)

      Xamarin AndroidXamarin Android

      Supported version: 2.3 and later
      Assembly: ComponentPro.Zip.Android (in ComponentPro.Zip.Android.dll)

      Xamarin iOSXamarin iOS

      Supported version: 5.1.x and later
      Assembly: ComponentPro.Zip.iOS (in ComponentPro.Zip.iOS.dll)

      See Also