Server.Commands.ExportCommand.Export_OnCommand C# (CSharp) Méthode

Export_OnCommand() public static méthode

public static Export_OnCommand ( Server.Commands.CommandEventArgs e ) : void
e Server.Commands.CommandEventArgs
Résultat void
		public static void Export_OnCommand( CommandEventArgs e )
		{
			StreamWriter w = new StreamWriter( ExportFile );
			ArrayList remove = new ArrayList();
			int count = 0;

			e.Mobile.SendMessage( "Exporting all static items to \"{0}\"...", ExportFile );
			e.Mobile.SendMessage( "This will delete all static items in the world.  Please make a backup." );

			foreach ( Item item in World.Items.Values )
			{
				if ( ( item is Static )
					&& item.RootParent == null )
				{
					w.WriteLine( "SECTION WORLDITEM {0}", count );
					w.WriteLine( "{" );
					w.WriteLine( "SERIAL {0}", item.Serial );
					w.WriteLine( "NAME #" );
					w.WriteLine( "NAME2 #" );
					w.WriteLine( "ID {0}", item.ItemID );
					w.WriteLine( "X {0}", item.X );
					w.WriteLine( "Y {0}", item.Y );
					w.WriteLine( "Z {0}", item.Z );
					w.WriteLine( "COLOR {0}", item.Hue );
					w.WriteLine( "CONT -1" );
					w.WriteLine( "TYPE 0" );
					w.WriteLine( "AMOUNT 1" );
					w.WriteLine( "WEIGHT 255" );
					w.WriteLine( "OWNER -1" );
					w.WriteLine( "SPAWN -1" );
					w.WriteLine( "VALUE 1" );
					w.WriteLine( "}" );
					w.WriteLine( "" );

					count++;
					remove.Add( item );
					w.Flush();
				}
			}

			w.Close();

			foreach( Item item in remove )
				item.Delete();

			e.Mobile.SendMessage( "Export complete.  Exported {0} statics.", count );
		}
	}