示例#1
0
 /**
  * return an observation number given a filename
  *
  * @param filename The filename to be matched
  *
  * @return QString The observation number corresponding to
  *         the input filename
  */
 QString ObservationNumberList::ObservationNumber(const QString &filename) {
   if(p_fileMap.find(Isis::FileName(filename).expanded()) == p_fileMap.end()) {
     QString msg = "Requested filename [" +
                       Isis::FileName(filename).expanded() + "]";
     msg += "does not exist in the list";
     throw IException(IException::Programmer, msg, _FILEINFO_);
   }
   int index = FileNameIndex(filename);
   return p_pairs[index].observationNumber;
 }
示例#2
0
bool C7zip::GetFile(int index, Byte * Data, size_t DataLen )
{
	m_CurrentFile = -1;
	if (Data == NULL || DataLen == 0)
	{
		return false;
	}
	if (m_archiveStream.file.handle == INVALID_HANDLE_VALUE)
	{
		return false;
	}
	m_CurrentFile = index;

    size_t offset;
    size_t outSizeProcessed;
	
	wchar_t Msg[200];
	std::wstring FileName = FileNameIndex(index);
	_snwprintf(Msg, sizeof(Msg) / sizeof(Msg[0]), L"extracting %s", FileName.c_str());
	m_NotfyCallback(Msg,m_NotfyCallbackInfo);

	SRes res = SzArEx_Extract(m_db, &m_archiveLookStream.s, index, 
            &m_blockIndex, &m_outBuffer, &m_outBufferSize, 
            &offset, &outSizeProcessed, 
            &m_allocImp, &m_allocTempImp);
    if (res != SZ_OK)
	{
		m_CurrentFile = -1;
		return false;
	}

	if (DataLen < outSizeProcessed)
	{
		outSizeProcessed = DataLen;
	}
	memcpy(Data,m_outBuffer + offset,outSizeProcessed);
	m_NotfyCallback(L"",m_NotfyCallbackInfo);
	m_CurrentFile = -1;
	return true;
}