本文整理匯總了C#中fCraft.World.ShutDown方法的典型用法代碼示例。如果您正苦於以下問題:C# World.ShutDown方法的具體用法?C# World.ShutDown怎麽用?C# World.ShutDown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fCraft.World
的用法示例。
在下文中一共展示了World.ShutDown方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
static void Main( string[] args ) {
World world = new World( "" );
world.OnLog += Log;
world.OnURLChange += SetURL;
if( world.Init() ) {
if( args.Length == 1 ) {
world.LoadMap( args[0] );
} else {
world.LoadMap( Map.DefaultFileName );
}
UpdaterResult update = Updater.CheckForUpdates( world );
if( update.UpdateAvailable ) {
Console.WriteLine( "** A new version of fCraft is available: v{0:0.000}, released {1:0} day(s) ago. **",
Decimal.Divide( update.NewVersionNumber, 1000 ),
DateTime.Now.Subtract( update.ReleaseDate ).TotalDays );
}
System.Diagnostics.Process.GetCurrentProcess().PriorityClass = world.config.GetBasePriority();
if( world.Start() ) {
Console.Title = "fCraft " + Updater.GetVersionString() + " - " + world.config.GetString( "ServerName" );
string input = "";
Console.WriteLine( "** To shut down the server, type /exit **" );
while( (input = Console.ReadLine()) != "/exit" ) {
Player.Console.ParseMessage( input, true );
}
world.ShutDown();
} else {
Console.WriteLine( "** Failed to start the server **" );
world.ShutDown();
Console.ReadLine();
}
} else {
Console.WriteLine( "** Failed to initialize the server **" );
world.ShutDown();
Console.ReadLine();
}
}