mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 06:26:39 +00:00 
			
		
		
		
	Moving classes from components/bsa into Bsa namespace. Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
		
			
				
	
	
		
			44 lines
		
	
	
	
		
			850 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
	
		
			850 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#include "../bsa_file.hpp"
 | 
						|
 | 
						|
/*
 | 
						|
  Test of the BSAFile class
 | 
						|
 | 
						|
  This test requires that data/Morrowind.bsa exists in the root
 | 
						|
  directory of OpenMW.
 | 
						|
 | 
						|
 */
 | 
						|
 | 
						|
#include <iostream>
 | 
						|
 | 
						|
using namespace std;
 | 
						|
using namespace Bsa;
 | 
						|
 | 
						|
BSAFile bsa;
 | 
						|
 | 
						|
void find(const char* file)
 | 
						|
{
 | 
						|
  cout << "Does file '" << file << "' exist?\n  ";
 | 
						|
  if(bsa.exists(file))
 | 
						|
    {
 | 
						|
      cout << "Yes.\n  ";
 | 
						|
      cout << bsa.getFile(file)->size() << " bytes\n";
 | 
						|
    }
 | 
						|
  else cout << "No.\n";
 | 
						|
}
 | 
						|
 | 
						|
int main()
 | 
						|
{
 | 
						|
  cout << "Reading Morrowind.bsa\n";
 | 
						|
  bsa.open("../../data/Morrowind.bsa");
 | 
						|
 | 
						|
  const BSAFile::FileList &files = bsa.getList();
 | 
						|
 | 
						|
  cout << "First 10 files in archive:\n";
 | 
						|
  for(int i=0; i<10; i++)
 | 
						|
    cout << "  " << files[i].name
 | 
						|
         << " (" << files[i].fileSize << " bytes @"
 | 
						|
         << files[i].offset << ")\n";
 | 
						|
 | 
						|
  find("meshes\\r\\xnetch_betty.nif");
 | 
						|
  find("humdrum");
 | 
						|
}
 |