UInt32 HawkOSOperator::CalcFileCrc(const AString& sFile)
	{
		UInt32 iCrc = 0;
		HawkDiskFile diskFile;
		if (diskFile.Open(sFile))
		{
			UChar szData[DEFAULT_SIZE] = {0};
			Int64 iRead = diskFile.Read(szData, DEFAULT_SIZE);
			while (iRead > 0)
			{
				HawkOSOperator::CalcCrc(szData, (UInt32)iRead, &iCrc);
				iRead = diskFile.Read(szData, DEFAULT_SIZE);
			}
			diskFile.Close();
		}
		return iCrc;
	}
Exemple #2
0
	Bool HawkMemoryFile::Open(const AString& sFile)
	{
		Close();

		m_eOpenType = OPEN_READ;
		m_bExtra    = false;

		HawkDiskFile df;
		if (df.Open(sFile))
		{
			m_iFileSize = df.GetFileSize();

			m_pData = (Char*)HawkMalloc((Size_t)m_iFileSize);
			memset(m_pData, 0, (Size_t)m_iFileSize);

			df.Read(m_pData, m_iFileSize);
			return true;
		}
		return false;
	}