diff options
author | m0viefreak <m0viefreak.cm@googlemail.com> | 2013-02-01 20:59:23 +0400 |
---|---|---|
committer | Armada <jules.blok@gmail.com> | 2013-02-02 03:16:57 +0400 |
commit | 1e28aaa832ffd487356d347d7ccbf7d7aa96bdb2 (patch) | |
tree | 04d1f88dfc18658c6a91b8b1677f5edab1ddfbf6 /RFS.cpp | |
parent | f8899da69f5c76f55a8c6f92177b2439002cf93b (diff) |
improve error messages to reflect compressed and encrypted files
- Move "no files found" error message into ScanArchive().
This avoids a redundant error message, if ScanArchive() was ended
early, because of a damaged / completely encrypted / ... archive.
- Keep track of the number of encrypted and compressed files, and,
if no usable media file was found, show error messages to indicate
thse compressed or unusable files, if present. In this case the
encrypted files message gets a higher priority than the compressed
message.
Diffstat (limited to 'RFS.cpp')
-rw-r--r-- | RFS.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -273,6 +273,8 @@ int CRARFileSource::ScanArchive (wchar_t *archive_name, CRFSList<CRFSFile> *file CRFSFile *file = NULL; *ok_files_found = 0; + int compressed_files_found = 0; + int encrypted_files_found = 0; LARGE_INTEGER zero = {0}; MediaType *mType; @@ -506,12 +508,14 @@ int CRARFileSource::ScanArchive (wchar_t *archive_name, CRFSList<CRFSFile> *file if (rh.ch.flags & LHD_PASSWORD) { + encrypted_files_found++; DbgLog((LOG_TRACE, 2, L"Encrypted files are not supported.")); file->unsupported = true; } if (rh.fh.method != 0x30) { + compressed_files_found++; DbgLog((LOG_TRACE, 2, L"Compressed files are not supported.")); file->unsupported = true; } @@ -673,6 +677,23 @@ int CRARFileSource::ScanArchive (wchar_t *archive_name, CRFSList<CRFSFile> *file ErrorMsg (0, L"Couldn't find all archive volumes."); } + // only show error messages if no usable file was found + if (*ok_files_found == 0) + { + if (encrypted_files_found > 0) + { + ErrorMsg (0, L"Encrypted files are not supported."); + } + else if (compressed_files_found > 0) + { + ErrorMsg (0, L"Compressed files are not supported."); + } + else + { + ErrorMsg (0, L"No media files found in the archive."); + } + } + return files; } @@ -776,7 +797,6 @@ STDMETHODIMP CRARFileSource::Load (LPCOLESTR lpwszFileName, const AM_MEDIA_TYPE if (!num_ok_files) { - ErrorMsg (0, L"No media files found in the archive."); return E_UNEXPECTED; // TODO: Figure out a better error code. } |