当前位置: 首页>>代码示例>>C#>>正文


C# CommandDelegate类代码示例

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


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

示例1: CommandWrapper

        public CommandWrapper(CommandDelegate del)
        {
            if (del == null) {
                throw new ArgumentNullException ("del");
            }

            this.d = del;
        }
开发者ID:knocte,项目名称:banshee,代码行数:8,代码来源:CommandWrapper.cs

示例2: Command

 public Command(CommandDelegate cmd, params string[] names)
 {
     if (names == null || names.Length < 1)
         throw new NotSupportedException();
     permission = null;
     Names = new List<string>(names);
     command = cmd;
 }
开发者ID:mookss1231,项目名称:TShock,代码行数:8,代码来源:Commands.cs

示例3: Register

 public bool Register(string Cmd, CommandDelegate Func)
 {
     if (!Cmds.ContainsKey(Cmd))
         Cmds.Add(Cmd, Func);
     else
         return false;
     return true;
 }
开发者ID:Wo1fTech,项目名称:Wo1f_Framework,代码行数:8,代码来源:Command.cs

示例4: Add

 /// <summary>
 /// Add a command to be executed in parallel.
 /// </summary>
 /// <param name="command"> 
 /// The command to execute. Should be non-null.
 /// </param>
 /// <exception cref="System.ArgumentNullException"></exception>
 public void Add(CommandDelegate command)
 {
     if (command == null) {
     throw new System.ArgumentNullException("command");
     }
     CommandQueue queue = new CommandQueue();
     queue.Enqueue(command);
     _queues.AddLast(queue);
 }
开发者ID:darcy-rayner,项目名称:colib,代码行数:16,代码来源:CommandScheduler.cs

示例5: SchumixRegisterHandler

        public void SchumixRegisterHandler(string code, CommandDelegate method, CommandPermission permission = CommandPermission.Normal)
        {
            if(sIgnoreCommand.IsIgnore(code))
               return;

            if(CommandMethodMap.ContainsKey(code.ToLower()))
                CommandMethodMap[code.ToLower()].Method += method;
            else
                CommandMethodMap.Add(code.ToLower(), new CommandMethod(method, permission));
        }
开发者ID:Schumix,项目名称:Schumix2,代码行数:10,代码来源:CommandManager.cs

示例6: AddCommand

 /// <summary>
 ///   Add a command to those which can be invoked from the console.
 /// </summary>
 /// <param name = "command">The string that will make the command execute</param>
 /// <param name = "commandHelp">The message that will show the user how to use the command</param>
 /// <param name = "info">Any information about how the command works or what it does</param>
 /// <param name = "fn"></param>
 public void AddCommand(string command, string commandHelp, string infomessage, CommandDelegate fn)
 {
     CommandInfo info = new CommandInfo{
         command = command,
         commandHelp = commandHelp,
         info = infomessage,
         fn = new List<CommandDelegate> {fn}
     };
     tree.AddCommand(info);
 }
开发者ID:EnricoNirvana,项目名称:Aurora-Sim,代码行数:17,代码来源:CommandConsole.cs

示例7: RegisterCommandHandler

 public static void RegisterCommandHandler(string command, CommandDelegate handler)
 {
     try
     {
         handlers.Add(command, handler);
     }
     catch (ArgumentException)
     {
         Debug.Log("An element with Key = " + command + " already exists.");
     }
 }
开发者ID:crempp,项目名称:paisg,代码行数:11,代码来源:Networking.cs

示例8: AddCommand

 /// <summary>
 ///     Add a command to those which can be invoked from the console.
 /// </summary>
 /// <param name="command">The string that will make the command execute</param>
 /// <param name="commandHelp">The message that will show the user how to use the command</param>
 /// <param name="infomessage">Any information about how the command works or what it does</param>
 /// <param name="fn"></param>
 /// <param name="requiresAScene">Whether this command requires a scene to be fired</param>
 /// <param name="fireOnceForAllScenes">Whether this command will only be executed once if there is no current scene</param>
 public void AddCommand (string command, string commandHelp, string infomessage, CommandDelegate fn, bool requiresAScene, bool fireOnceForAllScenes)
 {
     CommandInfo info = new CommandInfo {
         command = command,
         commandHelp = commandHelp,
         info = infomessage,
         fireOnceForAllScenes = fireOnceForAllScenes,
         requiresAScene = requiresAScene,
         fn = new List<CommandDelegate> { fn }
     };
     tree.AddCommand (info);
 }
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:21,代码来源:CommandConsole.cs

示例9: Command

        public Command(CommandDelegate cmd, params string[] names)
        {
            if (cmd == null)
                throw new ArgumentNullException("cmd");
            if (names == null || names.Length < 1)
                throw new ArgumentException("names");

            AllowServer = true;
            CommandDelegate = cmd;
            DoLog = true;
            HelpText = "No help available.";
            Names = new List<string>(names);
            Permissions = new List<string>();
        }
开发者ID:CoderCow,项目名称:TShock,代码行数:14,代码来源:Commands.cs

示例10: Database

        /// <summary>
        /// Creates instance of EJDB. 
        /// </summary>
        /// <param name="library"></param>
        public Database(Library library)
        {
            var libraryHandle = library.LibraryHandle;
            DatabaseHandle = new DatabaseHandle(libraryHandle);

            Library = library;

            _openDatabase = libraryHandle.GetUnmanagedDelegate<OpenDatabaseDelegate>();
            _closeDatabase = libraryHandle.GetUnmanagedDelegate<CloseDatabaseDelegate>();
            _isOpen = libraryHandle.GetUnmanagedDelegate<IsOpenDelegate>();

            _getErrorCode = libraryHandle.GetUnmanagedDelegate<GetErrorCodeDelegate>();
            _getMetadata = libraryHandle.GetUnmanagedDelegate<GetMetaDelegate>();

            _command = libraryHandle.GetUnmanagedDelegate<CommandDelegate>();
            _sync = libraryHandle.GetUnmanagedDelegate<SyncDelegate>();
        }
开发者ID:hendryten,项目名称:ejdb-csharp,代码行数:21,代码来源:Database.cs

示例11: ProxyFrame

        public ProxyFrame(string[] args)
        {
            bool externalPlugin = false;
            this.args = args;

            ProxyConfig proxyConfig = new ProxyConfig("SLProxy", "Austin Jennings / Andrew Ortman", args);
            proxy = new Proxy(proxyConfig);

            // add delegates for login
            proxy.SetLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest));
            proxy.SetLoginResponseDelegate(new XmlRpcResponseDelegate(LoginResponse));

            // add a delegate for outgoing chat
            proxy.AddDelegate(PacketType.ChatFromViewer, Direction.Outgoing, new PacketDelegate(ChatFromViewerOut));

            //  handle command line arguments
            foreach (string arg in args)
                if (arg == "--log-login")
                    logLogin = true;
                else if (arg.Substring(0, 2) == "--")
                {
                    int ipos = arg.IndexOf("=");
                    if (ipos != -1)
                    {
                        string sw = arg.Substring(0, ipos);
                        string val = arg.Substring(ipos + 1);
                        Console.WriteLine("arg '" + sw + "' val '" + val + "'");
                        if (sw == "--load")
                        {
                            externalPlugin = true;
                            LoadPlugin(val);
                        }
                    }
                }

            commandDelegates["/load"] = new CommandDelegate(CmdLoad);

            if (!externalPlugin)
            {
                ProxyPlugin analyst = new Analyst(this);
                analyst.Init();
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:43,代码来源:SLProxyLoader.cs

示例12: Condition

 /// <summary>
 /// A Condition command allows branching behaviour. After a condition evaluates to <c>true</c>
 /// then onTrue will be evaluated until it finishes. Otherise onFalse will be evaluated, (if it 
 /// isn't null). When nested in a Repeat command, conditions will be re-evaluated once for every
 /// repeat.
 /// </summary>
 /// <param name="condition"> 
 /// The condition to evaluate. Must be non-null.
 /// </param>
 /// <param name="onTrue"> 
 /// The command to execute if condition evaluates to true. Must be non-null.
 /// </param>
 /// <param name="onFalse"> 
 /// The command to execute if condition evaluates to false.
 /// </param>
 /// <exception cref="System.ArgumentNullException"></exception>
 public static CommandDelegate Condition(CommandCondition condition, CommandDelegate onTrue, CommandDelegate onFalse = null)
 {
     CheckArgumentNonNull(condition, "condition");
     CheckArgumentNonNull(onTrue, "onTrue");
     CommandDelegate result = onFalse;
     return Sequence(
     Commands.Do( () => {
         result = onFalse;
         if (condition()) {
             result = onTrue;
         }
     }),
     (ref double deltaTime) => {
         if (result != null) {
             return result(ref deltaTime);
         }
         return true;
     }
     );
 }
开发者ID:darcy-rayner,项目名称:colib,代码行数:36,代码来源:Commands.cs

示例13: Command

 public Command(string permissionneeded, CommandDelegate cmd, params string[] names)
     : this(cmd, names)
 {
     Permission = permissionneeded;
 }
开发者ID:Icehawk78,项目名称:TShock,代码行数:5,代码来源:Commands.cs

示例14: InternalCommand

 internal InternalCommand( CommandDelegate Command, string Line )
 {
     command = Command;
     line = Line;
 }
开发者ID:Grivaryg,项目名称:LibClassicBot,代码行数:5,代码来源:BotCommands.cs

示例15: FromXml

        public void FromXml(XmlElement root, CommandDelegate fn)
        {
            CommandInfo help = (CommandInfo)((Dictionary<string, object>)tree["help"])[String.Empty];
            ((Dictionary<string, object>)tree["help"]).Remove(string.Empty);
            if (((Dictionary<string, object>)tree["help"]).Count == 0)
                tree.Remove("help");

            CommandInfo quit = (CommandInfo)((Dictionary<string, object>)tree["quit"])[String.Empty];
            ((Dictionary<string, object>)tree["quit"]).Remove(string.Empty);
            if (((Dictionary<string, object>)tree["quit"]).Count == 0)
                tree.Remove("quit");

            tree.Clear();

            ReadTreeLevel(tree, root, fn);

            if (!tree.ContainsKey("help"))
                tree["help"] = (object) new Dictionary<string, object>();
            ((Dictionary<string, object>)tree["help"])[String.Empty] = help;

            if (!tree.ContainsKey("quit"))
                tree["quit"] = (object) new Dictionary<string, object>();
            ((Dictionary<string, object>)tree["quit"])[String.Empty] = quit;
        }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:24,代码来源:CommandConsole.cs


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