示例#1
0
        public void RunCommand(Mobile from, object obj, BaseCommand command, string[] args)
        {
            //	try
            //	{
            CommandEventArgs e = new CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args);

            if (!command.ValidateArgs(this, e))
            {
                return;
            }

            bool flushToLog = false;

            if (obj is ArrayList)
            {
                ArrayList list = (ArrayList)obj;

                if (list.Count > 20)
                {
                    CommandLogging.Enabled = false;
                }
                else if (list.Count == 0)
                {
                    command.LogFailure("Nothing was found to use this command on.");
                }

                command.ExecuteList(e, list);

                if (list.Count > 20)
                {
                    flushToLog             = true;
                    CommandLogging.Enabled = true;
                }
            }
            else if (obj != null)
            {
                if (command.ListOptimized)
                {
                    ArrayList list = new ArrayList
                    {
                        obj
                    };
                    command.ExecuteList(e, list);
                }
                else
                {
                    command.Execute(e, obj);
                }
            }

            command.Flush(from, flushToLog);
            //	}
            //	catch ( Exception ex )
            //	{
            //		from.SendMessage( ex.Message );
            //	}
        }
		public void RunCommand( Mobile from, object obj, BaseCommand command, string[] args )
		{
		//	try
		//	{
				CommandEventArgs e = new CommandEventArgs( from, command.Commands[0], GenerateArgString( args ), args );

				if ( !command.ValidateArgs( this, e ) )
					return;

				bool flushToLog = false;

				if ( obj is ArrayList )
				{
					ArrayList list = (ArrayList)obj;

					if ( list.Count > 20 )
						CommandLogging.Enabled = false;
					else if ( list.Count == 0 )
						command.LogFailure( "Nothing was found to use this command on." );

					command.ExecuteList( e, list );

					if ( list.Count > 20 )
					{
						flushToLog = true;
						CommandLogging.Enabled = true;
					}
				}
				else if ( obj != null )
				{
					if ( command.ListOptimized )
					{
						ArrayList list = new ArrayList();
						list.Add( obj );
						command.ExecuteList( e, list );
					}
					else
					{
						command.Execute( e, obj );
					}
				}

				command.Flush( from, flushToLog );
		//	}
		//	catch ( Exception ex )
		//	{
		//		from.SendMessage( ex.Message );
		//	}
		}
示例#3
0
        public void RunCommand(Mobile from, object obj, BaseCommand command, string[] args)
        {
            try
            {
                if (command is GetCommand && obj is ArrayList && ((ArrayList)obj).Count > 20000)
                {
                    throw new Exception("Get command has too many potential target: " + ((ArrayList)obj).Count);
                }
                if (LoggingCustom.CommandDebug)
                {
                    LoggingCustom.LogCommandDebug("RunCommand\t" + command.Commands[0] + "\t");
                }
                CommandEventArgs e = new CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args);

                if (!command.ValidateArgs(this, e))
                {
                    return;
                }

                bool flushToLog = false;

                if (obj is ArrayList)
                {
                    if (LoggingCustom.CommandDebug)
                    {
                        LoggingCustom.LogCommandDebug("objArrayList\t");
                    }
                    ArrayList list = (ArrayList)obj;

                    if (list.Count > 20)
                    {
                        CommandLogging.Enabled = false;
                    }
                    else if (list.Count == 0)
                    {
                        command.LogFailure("Nothing was found to use this command on.");
                    }

                    command.ExecuteList(e, list);

                    if (list.Count > 20)
                    {
                        flushToLog             = true;
                        CommandLogging.Enabled = true;
                    }
                }
                else if (obj != null)
                {
                    if (LoggingCustom.CommandDebug)
                    {
                        LoggingCustom.LogCommandDebug("obj\t");
                    }
                    if (command.ListOptimized)
                    {
                        ArrayList list = new ArrayList();
                        list.Add(obj);
                        command.ExecuteList(e, list);
                    }
                    else
                    {
                        command.Execute(e, obj);
                    }
                }
                if (LoggingCustom.CommandDebug)
                {
                    LoggingCustom.LogCommandDebug("flush\t");
                }
                command.Flush(from, flushToLog);
            }
            catch (Exception ex)
            {
                if (from != null)
                {
                    from.SendMessage(ex.Message);
                }
            }
        }
		public void RunCommand( Mobile from, object obj, BaseCommand command, string[] args )
		{
			try
			{
                if (command is GetCommand && obj is ArrayList && ((ArrayList)obj).Count > 20000)
                {
                    throw new Exception("Get command has too many potential target: " + ((ArrayList)obj).Count);
                }
                if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "RunCommand\t" + command.Commands[0] + "\t");
                CommandEventArgs e = new CommandEventArgs( from, command.Commands[0], GenerateArgString( args ), args );
                
				if ( !command.ValidateArgs( this, e ) )
					return;

				bool flushToLog = false;

				if ( obj is ArrayList )
				{
                    if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "objArrayList\t");
					ArrayList list = (ArrayList)obj;

					if ( list.Count > 20 )
						CommandLogging.Enabled = false;
					else if ( list.Count == 0 )
						command.LogFailure( "Nothing was found to use this command on." );

					command.ExecuteList( e, list );

					if ( list.Count > 20 )
					{
						flushToLog = true;
						CommandLogging.Enabled = true;
					}
				}
				else if ( obj != null )
				{
                    if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "obj\t");
                    if ( command.ListOptimized )
					{
						ArrayList list = new ArrayList();
						list.Add( obj );
						command.ExecuteList( e, list );
					}
					else
					{
						command.Execute( e, obj );
					}
				}
                if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "flush\t"); 
				command.Flush( from, flushToLog );
			}
			catch ( Exception ex )
			{
				if (from != null) from.SendMessage( ex.Message );
			}
		}