Subversion Repositories spk

Rev

Rev 217 | Rev 220 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 217 Rev 218
Line 236... Line 236...
236
	}
236
	}
237
 
237
 
238
	return Utils::WString::Null();
238
	return Utils::WString::Null();
239
}
239
}
240
 
240
 
241
void ConvertXsp(const Utils::String &filename, const Utils::String &tofile, bool wizard)
241
void ConvertXsp(const Utils::WString &filename, const Utils::String &tofile, bool wizard)
242
{
242
{
243
	// first chekc if file even exists
243
	// first chekc if file even exists
244
	FILE *id = fopen ( filename.c_str(), "rb+" );
244
	FILE *id = _wfopen (filename.c_str(), L"rb+" );
245
	if ( !id )
245
	if ( !id )
246
	{
246
	{
247
		printf ( "Error: File, %s, doesn't exist\n", filename.c_str() );
247
		wprintf(L"Error: File, %s, doesn't exist\n", filename.c_str() );
248
		return;
248
		return;
249
	}
249
	}
250
	fclose ( id );
250
	fclose ( id );
251
 
251
 
252
	// check its not a new format already
252
	// check its not a new format already
253
	int check = CSpkFile::CheckFile(filename);
253
	int check = CSpkFile::CheckFile(filename);
254
	if ( check == SPKFILE_INVALID && CFileIO(filename).isFileExtension(L"xsp") )
254
	if ( check == SPKFILE_INVALID && CFileIO(filename).isFileExtension(L"xsp") )
255
	{
255
	{
256
		printf ( "* Converting XSP File, %s... ", filename.c_str() );
256
		wprintf(L"* Converting XSP File, %s... ", filename.c_str() );
257
		CXspFile xspFile;
257
		CXspFile xspFile;
258
		if ( !xspFile.ConvertOld(filename) )
258
		if ( !xspFile.convertOld(filename) )
259
		{
259
		{
260
			printf ( "[ERROR]\n\nFailed to convert old xsp file, %s\n", filename.c_str() );
260
			wprintf(L"[ERROR]\n\nFailed to convert old xsp file, %s\n", filename.c_str() );
261
			return;
261
			return;
262
		}
262
		}
263
 
263
 
264
		printf ( "[DONE]\n");
264
		printf ( "[DONE]\n");
265
 
265
 
Line 277... Line 277...
277
		printf ( "* Writing XSP File, %s... ", tofile.c_str() );
277
		printf ( "* Writing XSP File, %s... ", tofile.c_str() );
278
		// now we need to save it
278
		// now we need to save it
279
		if ( !xspFile.writeFile(tofile) )
279
		if ( !xspFile.writeFile(tofile) )
280
			printf ( "[ERROR]\n\nFailed to write file to, %s\n", tofile.c_str() );
280
			printf ( "[ERROR]\n\nFailed to write file to, %s\n", tofile.c_str() );
281
		else
281
		else
282
			printf ( "[DONE]\n\nFile: %s, has been converted to, %s\n", filename.c_str(), tofile.c_str() );
282
			wprintf(L"[DONE]\n\nFile: %s, has been converted to, %hs\n", filename.c_str(), tofile.c_str() );
283
	}
283
	}
284
	else
284
	else
285
		printf ( "Error: File, %s, is not an old style XSP file\n", filename.c_str() );
285
		wprintf(L"Error: File, %s, is not an old style XSP file\n", filename.c_str() );
286
}
286
}
287
 
287
 
288
void ExtractShip(const Utils::String &catfile, const Utils::String &to, Utils::WString shipid)
288
void ExtractShip(const Utils::String &catfile, const Utils::String &to, Utils::WString shipid)
289
{
289
{
290
	if ( !CFileIO::Exists(catfile) )
290
	if ( !CFileIO::Exists(catfile) )
Line 460... Line 460...
460
	// otherwise its an old ship file
460
	// otherwise its an old ship file
461
	else if ( CFileIO(filename).isFileExtension(L"xsp") )
461
	else if ( CFileIO(filename).isFileExtension(L"xsp") )
462
	{
462
	{
463
		printf ( "* Converting XSP File, %s...\n", filename.c_str() );
463
		printf ( "* Converting XSP File, %s...\n", filename.c_str() );
464
		pBaseFile = new CXspFile;
464
		pBaseFile = new CXspFile;
465
		if ( !((CXspFile *)pBaseFile)->ConvertOld(filename) )
465
		if ( !((CXspFile *)pBaseFile)->convertOld(filename) )
466
		{
466
		{
467
			delete pBaseFile;
467
			delete pBaseFile;
468
			pBaseFile = NULL;
468
			pBaseFile = NULL;
469
			printf ( "Failed to convert old xsp file, %s\n", filename.c_str() );
469
			printf ( "Failed to convert old xsp file, %s\n", filename.c_str() );
470
			return;
470
			return;