Home | History | Annotate | Download | only in Console
      1 // OpenCallbackConsole.cpp
      2 
      3 #include "StdAfx.h"
      4 
      5 #include "OpenCallbackConsole.h"
      6 
      7 #include "ConsoleClose.h"
      8 #include "UserInputUtils.h"
      9 
     10 static HRESULT CheckBreak2()
     11 {
     12   return NConsoleClose::TestBreakSignal() ? E_ABORT : S_OK;
     13 }
     14 
     15 HRESULT COpenCallbackConsole::Open_CheckBreak()
     16 {
     17   return CheckBreak2();
     18 }
     19 
     20 HRESULT COpenCallbackConsole::Open_SetTotal(const UInt64 *files, const UInt64 *bytes)
     21 {
     22   if (!MultiArcMode && NeedPercents())
     23   {
     24     if (files)
     25     {
     26       _totalFilesDefined = true;
     27       // _totalFiles = *files;
     28       _percent.Total = *files;
     29     }
     30     else
     31       _totalFilesDefined = false;
     32 
     33     if (bytes)
     34     {
     35       _totalBytesDefined = true;
     36       // _totalBytes = *bytes;
     37       if (!files)
     38         _percent.Total = *bytes;
     39     }
     40     else
     41       _totalBytesDefined = false;
     42   }
     43 
     44   return CheckBreak2();
     45 }
     46 
     47 HRESULT COpenCallbackConsole::Open_SetCompleted(const UInt64 *files, const UInt64 *bytes)
     48 {
     49   if (!MultiArcMode && NeedPercents())
     50   {
     51     if (files)
     52     {
     53       _percent.Files = *files;
     54       if (_totalFilesDefined)
     55         _percent.Completed = *files;
     56     }
     57 
     58     if (bytes)
     59     {
     60       if (!_totalFilesDefined)
     61         _percent.Completed = *bytes;
     62     }
     63     _percent.Print();
     64   }
     65 
     66   return CheckBreak2();
     67 }
     68 
     69 HRESULT COpenCallbackConsole::Open_Finished()
     70 {
     71   ClosePercents();
     72   return S_OK;
     73 }
     74 
     75 
     76 #ifndef _NO_CRYPTO
     77 
     78 HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password)
     79 {
     80   *password = NULL;
     81   RINOK(CheckBreak2());
     82 
     83   if (!PasswordIsDefined)
     84   {
     85     ClosePercents();
     86     Password = GetPassword(_so);
     87     PasswordIsDefined = true;
     88   }
     89   return StringToBstr(Password, password);
     90 }
     91 
     92 /*
     93 HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(bool &passwordIsDefined, UString &password)
     94 {
     95   passwordIsDefined = PasswordIsDefined;
     96   password = Password;
     97   return S_OK;
     98 }
     99 
    100 bool COpenCallbackConsole::Open_WasPasswordAsked()
    101 {
    102   return PasswordWasAsked;
    103 }
    104 
    105 void COpenCallbackConsole::Open_Clear_PasswordWasAsked_Flag ()
    106 {
    107   PasswordWasAsked = false;
    108 }
    109 */
    110 
    111 #endif
    112