Пример #1
0
        protected virtual int OnPasswordRequired(IntPtr p1, int p2)
        {
            int result = -1;

            if (this.PasswordRequired != null)
            {
                PasswordRequiredEventArgs e = new PasswordRequiredEventArgs();
                this.PasswordRequired(this, e);
                if (e.ContinueOperation && e.Password.Length > 0)
                {
                    for (int i = 0; (i < e.Password.Length) && (i < p2); i++)
                    {
                        Marshal.WriteByte(p1, i, (byte)e.Password[i]);
                    }
                    Marshal.WriteByte(p1, e.Password.Length, (byte)0);
                    result = 1;
                }
            }
            else
            {
                throw new IOException("Password is required for extraction.");
            }
            return(result);
        }
Пример #2
0
 protected virtual int OnPasswordRequired(IntPtr p1, int p2)
 {
     int result = -1;
     if (this.PasswordRequired != null)
     {
         PasswordRequiredEventArgs e = new PasswordRequiredEventArgs();
         this.PasswordRequired(this, e);
         if (e.ContinueOperation && e.Password.Length > 0)
         {
             for (int i = 0; (i < e.Password.Length) && (i < p2); i++)
                 Marshal.WriteByte(p1, i, (byte)e.Password[i]);
             Marshal.WriteByte(p1, e.Password.Length, (byte)0);
             result = 1;
         }
     }
     else
     {
         throw new IOException("Password is required for extraction.");
     }
     return result;
 }