progress on -service.. no input, safe choices, etc

add Account.Inactive and Account.InactiveDuration
refactor IsEligable to IsEligible
This commit is contained in:
mark 2009-08-08 06:30:34 +00:00
parent dd3c904944
commit bff9e9abe4
9 changed files with 94 additions and 57 deletions

View file

@ -245,8 +245,12 @@ namespace Server
if ( SocketPool.Created )
SocketPool.Destroy();
Console.WriteLine( "This exception is fatal, press return to exit" );
Console.ReadLine();
if ( m_Service ) {
Console.WriteLine( "This exception is fatal." );
} else {
Console.WriteLine( "This exception is fatal, press return to exit" );
Console.ReadLine();
}
}
m_Closing = true;
@ -422,7 +426,7 @@ namespace Server
Console.WriteLine( "Core: Optimizing for {0} {2}processor{1}", m_ProcessorCount, m_ProcessorCount == 1 ? "" : "s", Is64Bit ? "64-bit " : "" );
int platform = (int)Environment.OSVersion.Platform;
if ( platform == 4 || platform == 128 ) { // MS 4, MONO 128
if( platform == 4 || platform == 128 ) { // MS 4, MONO 128
m_Unix = true;
Console.WriteLine( "Core: Unix environment detected" );
}
@ -434,8 +438,12 @@ namespace Server
while( !ScriptCompiler.Compile( m_Debug, m_Cache ) )
{
Console.WriteLine( "Scripts: One or more scripts failed to compile or no script files were found." );
Console.WriteLine( " - Press return to exit, or R to try again." );
if( m_Service )
return;
Console.WriteLine( " - Press return to exit, or R to try again." );
if( Console.ReadKey( true ).Key != ConsoleKey.R )
return;
}

View file

@ -314,16 +314,21 @@ namespace Server {
if ( t == null ) {
Console.WriteLine( "failed" );
Console.WriteLine( "Error: Type '{0}' was not found. Delete all of those types? (y/n)", typeName );
if ( !Core.Service ) {
Console.WriteLine( "Error: Type '{0}' was not found. Delete all of those types? (y/n)", typeName );
if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
types.Add( null );
Console.Write( "World: Loading..." );
continue;
if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
types.Add( null );
Console.Write( "World: Loading..." );
continue;
}
Console.WriteLine( "Types will not be deleted. An exception will be thrown." );
} else {
Console.WriteLine( "Error: Type '{0}' was not found.", typeName );
}
Console.WriteLine( "Types will not be deleted. An exception will be thrown when you press return" );
throw new Exception( String.Format( "Bad type '{0}'", typeName ) );
}
@ -394,16 +399,22 @@ namespace Server {
if ( t == null ) {
Console.WriteLine( "failed" );
Console.WriteLine( "Error: Type '{0}' was not found. Delete all of those types? (y/n)", typeName );
if ( !Core.Service ) {
Console.WriteLine( "Error: Type '{0}' was not found. Delete all of those types? (y/n)", typeName );
if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
types.Add( null );
Console.Write( "World: Loading..." );
continue;
if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
types.Add( null );
Console.Write( "World: Loading..." );
continue;
}
Console.WriteLine( "Types will not be deleted. An exception will be thrown." );
} else {
Console.WriteLine( "Error: Type '{0}' was not found.", typeName );
}
Console.WriteLine( "Types will not be deleted. An exception will be thrown when you press return" );
throw new Exception( String.Format( "Bad type '{0}'", typeName ) );
}
@ -597,39 +608,43 @@ namespace Server {
Console.WriteLine( " - Type: {0}", failedType );
Console.WriteLine( " - Serial: {0}", failedSerial );
Console.WriteLine( "Delete the object? (y/n)" );
if ( !Core.Service ) {
Console.WriteLine( "Delete the object? (y/n)" );
if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
if ( failedType != typeof( BaseGuild ) ) {
Console.WriteLine( "Delete all objects of that type? (y/n)" );
if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
if ( failedType != typeof( BaseGuild ) ) {
Console.WriteLine( "Delete all objects of that type? (y/n)" );
if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
if ( failedMobiles ) {
for ( int i = 0; i < mobiles.Count; ) {
if ( mobiles[i].TypeID == failedTypeID )
mobiles.RemoveAt( i );
else
++i;
}
} else if ( failedItems ) {
for ( int i = 0; i < items.Count; ) {
if ( items[i].TypeID == failedTypeID )
items.RemoveAt( i );
else
++i;
if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
if ( failedMobiles ) {
for ( int i = 0; i < mobiles.Count; ) {
if ( mobiles[i].TypeID == failedTypeID )
mobiles.RemoveAt( i );
else
++i;
}
} else if ( failedItems ) {
for ( int i = 0; i < items.Count; ) {
if ( items[i].TypeID == failedTypeID )
items.RemoveAt( i );
else
++i;
}
}
}
}
SaveIndex<MobileEntry>( mobiles, MobileIndexPath );
SaveIndex<ItemEntry>( items, ItemIndexPath );
SaveIndex<GuildEntry>( guilds, GuildIndexPath );
}
SaveIndex<MobileEntry>( mobiles, MobileIndexPath );
SaveIndex<ItemEntry>( items, ItemIndexPath );
SaveIndex<GuildEntry>( guilds, GuildIndexPath );
Console.WriteLine( "After pressing return an exception will be thrown and the server will terminate." );
Console.ReadLine();
} else {
Console.WriteLine( "An exception will be thrown and the server will terminate." );
}
Console.WriteLine( "After pressing return an exception will be thrown and the server will terminate" );
Console.ReadLine();
throw new Exception( String.Format( "Load failed (items={0}, mobiles={1}, guilds={2}, type={3}, serial={4})", failedItems, failedMobiles, failedGuilds, failedType, failedSerial ), failed );
}