• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Generic.BaseCommand类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Server.Commands.Generic.BaseCommand的典型用法代码示例。如果您正苦于以下问题:C# BaseCommand类的具体用法?C# BaseCommand怎么用?C# BaseCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BaseCommand类属于Server.Commands.Generic命名空间,在下文中一共展示了BaseCommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Compile

		public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
		{
			if ( command.ObjectTypes == ObjectTypes.Items )
				return; // sanity check

			obj = from;
		}
开发者ID:Godkong,项目名称:Origins,代码行数:7,代码来源:SelfCommandImplementor.cs


示例2: Register

		public override void Register( BaseCommand command )
		{
			base.Register( command );

			for ( int i = 0; i < command.Commands.Length; ++i )
				CommandSystem.Register( command.Commands[i], command.AccessLevel, new CommandEventHandler( Redirect ) );
		}
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:7,代码来源:SingleCommandImplementor.cs


示例3: Process

		public override void Process( Mobile from, BaseCommand command, string[] args )
		{
			RangeCommandImplementor impl = RangeCommandImplementor.Instance;

			if ( impl == null )
				return;

			impl.Process( 18, from, command, args );
		}
开发者ID:jackuoll,项目名称:Pre-AOS-RunUO,代码行数:9,代码来源:ScreenCommandImplementor.cs


示例4: Register

		public static void Register( BaseCommand command )
		{
			m_AllCommands.Add( command );

			List<BaseCommandImplementor> impls = BaseCommandImplementor.Implementors;

			for ( int i = 0; i < impls.Count; ++i )
			{
				BaseCommandImplementor impl = impls[i];

				if ( (command.Supports & impl.SupportRequirement) != 0 )
					impl.Register( command );
			}
		}
开发者ID:romeov007,项目名称:imagine-uo,代码行数:14,代码来源:Commands.cs


示例5: Process

        public override void Process(Mobile from, BaseCommand command, string[] args)
        {
            AreaCommandImplementor impl = AreaCommandImplementor.Instance;

            if (impl == null)
                return;

            Map map = from.Map;

            if (map == null || map == Map.Internal)
                return;

            impl.OnTarget(from, map, Point3D.Zero, new Point3D(map.Width - 1, map.Height - 1, 0), new object[] { command, args });
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:14,代码来源:FacetCommandImplementor.cs


示例6: Process

		public void Process( int range, Mobile from, BaseCommand command, string[] args )
		{
			AreaCommandImplementor impl = AreaCommandImplementor.Instance;

			if ( impl == null )
				return;

			Map map = from.Map;

			if ( map == null || map == Map.Internal )
				return;

			Point3D start = new Point3D( from.X - range, from.Y - range, from.Z );
			Point3D end = new Point3D( from.X + range, from.Y + range, from.Z );

			impl.OnTarget( from, map, start, end, new object[] { command, args } );
		}
开发者ID:jackuoll,项目名称:Pre-AOS-RunUO,代码行数:17,代码来源:RangeCommandImplementor.cs


示例7: Compile

        public override void Compile(Mobile from, BaseCommand command, ref string[] args, ref object obj)
        {
            try
            {
                Extensions ext = Extensions.Parse(from, ref args);

                bool items, mobiles;

                if (!this.CheckObjectTypes(from, command, ext, out items, out mobiles))
                    return;

                if (!mobiles) // sanity check
                {
                    command.LogFailure("This command does not support items.");
                    return;
                }

                ArrayList list = new ArrayList();

                List<NetState> states = NetState.Instances;

                for (int i = 0; i < states.Count; ++i)
                {
                    NetState ns = states[i];
                    Mobile mob = ns.Mobile;

                    if (mob == null)
                        continue;

                    if (!BaseCommand.IsAccessible(from, mob))
                        continue;

                    if (ext.IsValid(mob))
                        list.Add(mob);
                }

                ext.Filter(list);

                obj = list;
            }
            catch (Exception ex)
            {
                from.SendMessage(ex.Message);
            }
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:45,代码来源:OnlineCommandImplementor.cs


示例8: Compile

		public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
		{
			try
			{
				if (LoggingCustom.CommandDebug)
					LoggingCustom.LogCommandDebug("Global...compiling\t");
                Extensions ext = Extensions.Parse( from, ref args );

				bool items, mobiles;
                if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "1\t");
				if ( !CheckObjectTypes( from, command, ext, out items, out mobiles ) )
					return;

				ArrayList list = new ArrayList();

				if ( items )
				{
                    if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "2\t");
                    foreach ( Item item in World.Items.Values )
					{
						if ( ext.IsValid( item ) )
							list.Add( item );
					}
				}

				if ( mobiles )
				{
                    if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "3\t");
                    foreach ( Mobile mob in World.Mobiles.Values )
					{
						if ( ext.IsValid( mob ) )
							list.Add( mob );
					}
				}
                if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "startfilter:list with " + list.Count+ " in it\t");
				ext.Filter( list );
                if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "4\t");
				obj = list;
			}
			catch ( Exception ex )
			{
				from.SendMessage( ex.Message );
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:44,代码来源:GlobalCommandImplementor.cs


示例9: Compile

		public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
		{
			try
			{
				Extensions ext = Extensions.Parse( from, ref args );

				bool items, mobiles;

				if ( !CheckObjectTypes( from, command, ext, out items, out mobiles ) )
					return;

				if ( !mobiles ) // sanity check
				{
					command.LogFailure( "This command does not support items." );
					return;
				}

				ArrayList list = new ArrayList();
				ArrayList addresses = new ArrayList();

				System.Collections.Generic.List<NetState> states = NetState.Instances;

				for ( int i = 0; i < states.Count; ++i )
				{
					NetState ns = (NetState)states[i];
					Mobile mob = ns.Mobile;

					if ( mob != null && !addresses.Contains( ns.Address ) && ext.IsValid( mob ) )
					{
						list.Add( mob );
						addresses.Add( ns.Address );
					}
				}

				ext.Filter( list );

				obj = list;
			}
			catch ( Exception ex )
			{
				from.SendMessage( ex.Message );
			}
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:43,代码来源:IPAddressCommandImplementor.cs


示例10: Compile

		public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
		{
			try
			{
				Extensions ext = Extensions.Parse( from, ref args );

				bool items, mobiles;

				if ( !CheckObjectTypes( from, command, ext, out items, out mobiles ) )
					return;

				Region reg = from.Region;

				ArrayList list = new ArrayList();

				if ( mobiles )
				{
					foreach ( Mobile mob in reg.GetMobiles() )
					{
						if( !BaseCommand.IsAccessible( from, mob ) )
							continue;

						if ( ext.IsValid( mob ) )
							list.Add( mob );
					}
				}
				else
				{
					command.LogFailure( "This command does not support items." );
					return;
				}

				ext.Filter( list );

				obj = list;
			}
			catch ( Exception ex )
			{
				from.SendMessage( ex.Message );
			}
		}
开发者ID:nathanvy,项目名称:runuo,代码行数:41,代码来源:RegionCommandImplementor.cs


示例11: Compile

		public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
		{
			try
			{
				Extensions ext = Extensions.Parse( from, ref args );

				bool items, mobiles;

				if ( !CheckObjectTypes( from, command, ext, out items, out mobiles ) )
					return;

				ArrayList list = new ArrayList();

				if ( items )
				{
					foreach ( Item item in World.Items.Values )
					{
						if ( ext.IsValid( item ) )
							list.Add( item );
					}
				}

				if ( mobiles )
				{
					foreach ( Mobile mob in World.Mobiles.Values )
					{
						if ( ext.IsValid( mob ) )
							list.Add( mob );
					}
				}

				ext.Filter( list );

				obj = list;
			}
			catch ( Exception ex )
			{
				from.SendMessage( ex.Message );
			}
		}
开发者ID:jackuoll,项目名称:Pre-AOS-RunUO,代码行数:40,代码来源:GlobalCommandImplementor.cs


示例12: RunCommand

		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 );
		//	}
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:49,代码来源:BaseCommandImplementor.cs


示例13: Process

		public override void Process( Mobile from, BaseCommand command, string[] args )
		{
			BoundingBoxPicker.Begin( from, new BoundingBoxCallback( OnTarget ), new object[]{ command, args } );
		}
开发者ID:jackuoll,项目名称:Pre-AOS-RunUO,代码行数:4,代码来源:AreaCommandImplementor.cs


示例14: Process

		public override void Process( Mobile from, BaseCommand command, string[] args )
		{
			if ( command.ValidateArgs( this, new CommandEventArgs( from, command.Commands[0], GenerateArgString( args ), args ) ) )
				from.BeginTarget( -1, command.ObjectTypes == ObjectTypes.All, TargetFlags.None, new TargetStateCallback( OnTarget ), new object[]{ command, args } );
		}
开发者ID:Godkong,项目名称:Origins,代码行数:5,代码来源:ContainedCommandImplementor.cs


示例15: Register

		public virtual void Register( BaseCommand command )
		{
			for ( int i = 0; i < command.Commands.Length; ++i )
				m_Commands[command.Commands[i]] = command;
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:5,代码来源:BaseCommandImplementor.cs


示例16: Process

		public virtual void Process( Mobile from, BaseCommand command, string[] args )
		{
			RunCommand( from, command, args );
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:4,代码来源:BaseCommandImplementor.cs


示例17: Compile

		public virtual void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
		{
			obj = null;
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:4,代码来源:BaseCommandImplementor.cs


示例18: ExecuteList

        public override void ExecuteList( CommandEventArgs e, ArrayList list )
        {
            if ( list.Count == 0 )
            {
                LogFailure( "Nothing was found to use this command on." );
                return;
            }

            try
            {
                BaseCommand[] commands = new BaseCommand[m_BatchCommands.Count];
                CommandEventArgs[] eventArgs = new CommandEventArgs[m_BatchCommands.Count];

                for ( int i = 0; i < m_BatchCommands.Count; ++i )
                {
                    BatchCommand bc = (BatchCommand)m_BatchCommands[i];

                    string commandString, argString;
                    string[] args;

                    bc.GetDetails( out commandString, out argString, out args );

                    BaseCommand command = (BaseCommand)m_Scope.Commands[commandString];

                    commands[i] = command;
                    eventArgs[i] = new CommandEventArgs( e.Mobile, commandString, argString, args );

                    if ( command == null )
                    {
                        e.Mobile.SendMessage( "That is either an invalid command name or one that does not support this modifier: {0}.", commandString );
                        return;
                    }
                    else if ( e.Mobile.AccessLevel < command.AccessLevel )
                    {
                        e.Mobile.SendMessage( "You do not have access to that command: {0}.", commandString );
                        return;
                    }
                    else if ( !command.ValidateArgs( m_Scope, eventArgs[i] ) )
                    {
                        return;
                    }
                }

                for ( int i = 0; i < commands.Length; ++i )
                {
                    BaseCommand command = commands[i];
                    BatchCommand bc = (BatchCommand)m_BatchCommands[i];

                    if ( list.Count > 20 )
                        CommandLogging.Enabled = false;

                    ArrayList usedList;

                    if ( Utility.InsensitiveCompare( bc.Object, "Current" ) == 0 )
                    {
                        usedList = list;
                    }
                    else
                    {
                        Hashtable propertyChains = new Hashtable();

                        usedList = new ArrayList( list.Count );

                        for ( int j = 0; j < list.Count; ++j )
                        {
                            object obj = list[j];

                            if ( obj == null )
                                continue;

                            Type type = obj.GetType();

                            PropertyInfo[] chain = (PropertyInfo[])propertyChains[type];

                            string failReason = "";

                            if ( chain == null && !propertyChains.Contains( type ) )
                                propertyChains[type] = chain = Properties.GetPropertyInfoChain( e.Mobile, type, bc.Object, PropertyAccess.Read, ref failReason );

                            if ( chain == null )
                                continue;

                            PropertyInfo endProp = Properties.GetPropertyInfo( ref obj, chain, ref failReason );

                            if ( endProp == null )
                                continue;

                            try
                            {
                                obj = endProp.GetValue( obj, null );

                                if ( obj != null )
                                    usedList.Add( obj );
                            }
                            catch
                            {
                            }
                        }
                    }

//.........这里部分代码省略.........
开发者ID:justdanofficial,项目名称:khaeros,代码行数:101,代码来源:Batch.cs


示例19: CheckObjectTypes

		public bool CheckObjectTypes( BaseCommand command, Extensions ext, out bool items, out bool mobiles )
		{
			items = mobiles = false;

			ObjectConditional cond = ObjectConditional.Empty;

            foreach (BaseExtension check in ext)
            {
                if (check is WhereExtension)
                {
                    cond = (check as WhereExtension).Conditional;

                    break;
                }
            }

			bool condIsItem = cond.IsItem;
			bool condIsMobile = cond.IsMobile;

			switch ( command.ObjectTypes )
			{
				case ObjectTypes.All:
				case ObjectTypes.Both:
				{
					if ( condIsItem )
						items = true;

					if ( condIsMobile )
						mobiles = true;

					break;
				}
				case ObjectTypes.Items:
				{
					if ( condIsItem )
					{
						items = true;
					}
					else if ( condIsMobile )
					{
						command.LogFailure( "You may not use a mobile type condition for this command." );
						return false;
					}

					break;
				}
				case ObjectTypes.Mobiles:
				{
					if ( condIsMobile )
					{
						mobiles = true;
					}
					else if ( condIsItem )
					{
						command.LogFailure( "You may not use an item type condition for this command." );
						return false;
					}

					break;
				}
			}

			return true;
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:64,代码来源:BaseCommandImplementor.cs


示例20: RunCommand

		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 );
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:56,代码来源:BaseCommandImplementor.cs



注:本文中的Server.Commands.Generic.BaseCommand类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Database.DatabaseConnection类代码示例发布时间:2022-05-26
下一篇:
C# Commands.CommandEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap