Subversion Repositories spk

Rev

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

Rev 49 Rev 50
Line 112... Line 112...
112
		}
112
		}
113
 
113
 
114
		// now do the settings
114
		// now do the settings
115
		if ( settings.Compare("author") )
115
		if ( settings.Compare("author") )
116
		{
116
		{
117
			spkfile.SetAuthor(argv[4]);
117
			spkfile.setAuthor(argv[4]);
118
			printf( "Settings Author to: %s\n", spkfile.GetAuthor().c_str());
118
			printf( "Settings Author to: %s\n", spkfile.author().c_str());
119
		}
119
		}
120
 
120
 
121
		spkfile.WriteFile ( filename );
121
		spkfile.WriteFile ( filename );
122
		printf ( "\nSPK file has been written sucessfully\n" );
122
		printf ( "\nSPK file has been written sucessfully\n" );
123
	}
123
	}
Line 310... Line 310...
310
		printf("\t- Bodies:\t %d\n", ship.GetBodies()->Count());
310
		printf("\t- Bodies:\t %d\n", ship.GetBodies()->Count());
311
		printf("\t- Cockpits:\t %d\n", ship.GetCockpits()->size());
311
		printf("\t- Cockpits:\t %d\n", ship.GetCockpits()->size());
312
		printf("\t- Text Entries:\t %d\n", ship.GetTexts()->size());
312
		printf("\t- Text Entries:\t %d\n", ship.GetTexts()->size());
313
 
313
 
314
		printf("\nEnter the name for the ship: ");
314
		printf("\nEnter the name for the ship: ");
315
		ship.SetName(GetInput());
315
		ship.setName(GetInput().ToString());
316
		printf("Enter the author for the ship: ");
316
		printf("Enter the author for the ship: ");
317
		ship.SetAuthor(GetInput());
317
		ship.setAuthor(GetInput().ToString());
318
		printf("Enter the version for the ship: V");
318
		printf("Enter the version for the ship: V");
319
		ship.SetVersion(GetInput());
319
		ship.setVersion(GetInput().ToString());
320
		printf("Enter the description for the ship: ");
320
		printf("Enter the description for the ship: ");
321
		ship.setDescription(GetInput().ToString());
321
		ship.setDescription(GetInput().ToString());
322
 
322
 
323
		struct tm   *currDate;
323
		struct tm   *currDate;
324
		char    dateString[100];
324
		char    dateString[100];
325
		time_t now = time(NULL);
325
		time_t now = time(NULL);
326
		currDate = localtime( &now );
326
		currDate = localtime( &now );
327
		strftime(dateString, sizeof dateString, "%d/%m/%Y", currDate);
327
		strftime(dateString, sizeof dateString, "%d/%m/%Y", currDate);
328
		ship.SetCreationDate ( CyString(dateString) );
328
		ship.setCreationDate(dateString);
329
 
329
 
330
		printf("\nWriting file: %s...\n", to.c_str());
330
		printf("\nWriting file: %s...\n", to.c_str());
331
		if ( ship.WriteFile(to) )
331
		if ( ship.WriteFile(to) )
332
			printf("Ship file has been created: %s\n", to.c_str());
332
			printf("Ship file has been created: %s\n", to.c_str());
333
		else
333
		else
Line 438... Line 438...
438
		if ( check == SPKFILE_SINGLESHIP )
438
		if ( check == SPKFILE_SINGLESHIP )
439
			sType = "Ship";
439
			sType = "Ship";
440
		else
440
		else
441
			sType = "Package";
441
			sType = "Package";
442
 
442
 
443
		printf ( "%s Name: %s\n", sType.c_str(), pBaseFile->GetName ().c_str() );
443
		printf ( "%s Name: %s\n", sType.c_str(), pBaseFile->name().c_str() );
444
		if ( !pBaseFile->email().empty() )
444
		if ( !pBaseFile->email().empty() )
445
			printf ( "%s Author: %s (%s)\n", sType.c_str(), pBaseFile->GetAuthor().c_str(), pBaseFile->email().c_str() );
445
			printf ( "%s Author: %s (%s)\n", sType.c_str(), pBaseFile->author().c_str(), pBaseFile->email().c_str() );
446
		else
446
		else
447
			printf ( "%s Author: %s\n", sType.c_str(), pBaseFile->GetAuthor().c_str() );
447
			printf ( "%s Author: %s\n", sType.c_str(), pBaseFile->author().c_str() );
448
		if ( !pBaseFile->GetVersion().Empty() ) printf ( "%s Version: %s\n", sType.c_str(), pBaseFile->GetVersion().c_str() );
448
		if ( !pBaseFile->version().empty() ) printf ( "%s Version: %s\n", sType.c_str(), pBaseFile->version().c_str() );
449
 
449
 
450
		//for game
450
		//for game
451
		printf("For Games: ");
451
		printf("For Games: ");
452
		if ( !pBaseFile->AnyGameCompatability() )
452
		if ( !pBaseFile->AnyGameCompatability() )
453
			printf("All");
453
			printf("All");
Line 517... Line 517...
517
				for ( SStringList *c = pXspFile->GetCutData()->Head(); c; c = c->next )
517
				for ( SStringList *c = pXspFile->GetCutData()->Head(); c; c = c->next )
518
					printf("\t%s\n", c->str.c_str());
518
					printf("\t%s\n", c->str.c_str());
519
			}
519
			}
520
		}
520
		}
521
 
521
 
522
		if ( !pBaseFile->GetCreationDate().Empty() ) printf ( "Creation Date: %s\n", pBaseFile->GetCreationDate().c_str() );
522
		if ( !pBaseFile->creationDate().empty() ) printf ( "Creation Date: %s\n", pBaseFile->creationDate().c_str() );
523
		if ( !pBaseFile->description().empty() ) printf ( "Description: %s\n", pBaseFile->description().c_str() );
523
		if ( !pBaseFile->description().empty() ) printf ( "Description: %s\n", pBaseFile->description().c_str() );
524
		if ( pSpkFile )
524
		if ( pSpkFile )
525
		{
525
		{
526
			if ( pSpkFile->IsLibrary() )
526
			if ( pSpkFile->IsLibrary() )
527
				printf ( "Script Type: Library\n" );
527
				printf ( "Script Type: Library\n" );
Line 856... Line 856...
856
	remove ( filename.c_str() );
856
	remove ( filename.c_str() );
857
 
857
 
858
	CSpkFile spkfile;
858
	CSpkFile spkfile;
859
 
859
 
860
	printf ( "Enter Script Name: " );
860
	printf ( "Enter Script Name: " );
861
	spkfile.SetName ( GetInput() );
861
	spkfile.setName ( GetInput().ToString() );
862
 
862
 
863
	printf ( "Enter Script Author: " );
863
	printf ( "Enter Script Author: " );
864
	spkfile.SetAuthor ( GetInput() );
864
	spkfile.setAuthor ( GetInput().ToString() );
865
 
865
 
866
	printf ( "Enter Script Version: " );
866
	printf ( "Enter Script Version: " );
867
	spkfile.SetVersion ( GetInput() );
867
	spkfile.setVersion ( GetInput().ToString() );
868
 
868
 
869
	printf ( "Enter Script Description: " );
869
	printf ( "Enter Script Description: " );
870
	spkfile.setDescription ( GetInput().ToString() );
870
	spkfile.setDescription ( GetInput().ToString() );
871
 
871
 
872
	struct tm   *currDate;
872
	struct tm   *currDate;
873
	char    dateString[100];
873
	char    dateString[100];
874
	time_t now = time(NULL);
874
	time_t now = time(NULL);
875
 
875
 
876
	currDate = localtime( &now );
876
	currDate = localtime( &now );
877
	strftime(dateString, sizeof dateString, "%d %m %Y", currDate);
877
	strftime(dateString, sizeof dateString, "%d %m %Y", currDate);
878
	spkfile.SetCreationDate ( CyString(dateString) );
878
	spkfile.setCreationDate(dateString);
879
 
879
 
880
	spkfile.WriteFile ( filename, NULL );
880
	spkfile.WriteFile ( filename, NULL );
881
	printf ( "SPK file has been written to disk: %s\n", filename.c_str() );
881
	printf ( "SPK file has been written to disk: %s\n", filename.c_str() );
882
}
882
}
883
 
883
 
Line 1234... Line 1234...
1234
		printf("Error: Unable to generate packager script\n");
1234
		printf("Error: Unable to generate packager script\n");
1235
		return;
1235
		return;
1236
	}
1236
	}
1237
 
1237
 
1238
	if ( toFile.Empty() )
1238
	if ( toFile.Empty() )
1239
		toFile = CFileIO(spkfile).GetDirIO().File(package->GetName() + "_" + package->GetAuthor() + ".sps");
1239
		toFile = CFileIO(spkfile).GetDirIO().File(package->name() + "_" + package->author() + ".sps");
1240
 
1240
 
1241
	// save package file
1241
	// save package file
1242
	if ( CFileIO(toFile).WriteFile(&list) )
1242
	if ( CFileIO(toFile).WriteFile(&list) )
1243
		printf("Packager script, %s, has been geenrated\n", toFile.c_str());
1243
		printf("Packager script, %s, has been geenrated\n", toFile.c_str());
1244
	else
1244
	else
Line 1307... Line 1307...
1307
		else
1307
		else
1308
			printf("Error: Unable to create package, from script: %s\n", filename.c_str());
1308
			printf("Error: Unable to create package, from script: %s\n", filename.c_str());
1309
	}
1309
	}
1310
	else
1310
	else
1311
	{
1311
	{
1312
		CyString saveto = package->GetFilename();
1312
		CyString saveto = package->filename();
1313
		saveto = saveto.FindReplace("$DEFAULTDIR", curDir + "/");
1313
		saveto = saveto.FindReplace("$DEFAULTDIR", curDir + "/");
1314
		saveto = saveto.FindReplace("$PATH", curDir);
1314
		saveto = saveto.FindReplace("$PATH", curDir);
1315
		saveto = saveto.FindReplace("\\", "/");
1315
		saveto = saveto.FindReplace("\\", "/");
1316
		saveto = saveto.FindReplace("//", "/");
1316
		saveto = saveto.FindReplace("//", "/");
1317
		if ( !saveto.Right(4).Compare(".spk") && package->GetType() != TYPE_XSP )
1317
		if ( !saveto.Right(4).Compare(".spk") && package->GetType() != TYPE_XSP )
Line 1332... Line 1332...
1332
			}
1332
			}
1333
			else
1333
			else
1334
				printf("Error! There was a problem writing the package\n");
1334
				printf("Error! There was a problem writing the package\n");
1335
		}
1335
		}
1336
 
1336
 
1337
		saveto = package->GetExportFilename();
1337
		saveto = package->exportFilename();
1338
		if ( !saveto.Empty() ) {
1338
		if ( !saveto.Empty() ) {
1339
			saveto = saveto.FindReplace("$DEFAULTDIR", curDir + "/");
1339
			saveto = saveto.FindReplace("$DEFAULTDIR", curDir + "/");
1340
			saveto = saveto.FindReplace("$PATH", curDir);
1340
			saveto = saveto.FindReplace("$PATH", curDir);
1341
			saveto = saveto.FindReplace("\\", "/");
1341
			saveto = saveto.FindReplace("\\", "/");
1342
			saveto = saveto.FindReplace("//", "/");
1342
			saveto = saveto.FindReplace("//", "/");