コード例 #1
0
ファイル: VFS_Files.cpp プロジェクト: Keinier/KPackage
// Returns Information about the File associated with the specified File Handle.
VFS_BOOL VFS_File_GetInfo( VFS_Handle hFile, VFS_EntityInfo& Info )
{
	// Not initialized yet?
	if( !IsInit() )
	{
		SetLastError( VFS_ERROR_NOT_INITIALIZED_YET );
		return VFS_FALSE;
	}

	// Invalid Handle Value?
	if( hFile == VFS_INVALID_HANDLE_VALUE )
	{
		SetLastError( VFS_ERROR_INVALID_PARAMETER );
		return VFS_FALSE;
	}

	// Get the File Pointer.
	IFile* pFile = ( IFile* )( VFS_DWORD )hFile;

	// Fill the Entity Information Structure.
	Info.bArchived = pFile->IsArchived();
	Info.eType = VFS_FILE;
	Info.lSize = pFile->GetSize();
	Info.strPath = pFile->GetFileName();
	return VFS_Util_GetName( Info.strPath, Info.strName );
}
コード例 #2
0
ファイル: VFS_Archive.cpp プロジェクト: Keinier/KPackage
// Get the Reference Count (i.e. the Sum of the Reference Counts of all Open Files of this Archive).
VFS_DWORD CArchive::GetRefCount() const
{
	VFS_DWORD dwRefCount = 0;
	for( FileMap::iterator iter = GetOpenFiles().begin(); iter != GetOpenFiles().end(); iter++ )
	{
		IFile* pFile = ( *iter ).second;
		if( pFile->IsArchived() )
		{
			CArchiveFile* pArchiveFile = ( CArchiveFile* )pFile;
			if( pArchiveFile->GetArchive() == this )
				dwRefCount++;
		}
	}
	return dwRefCount;
}