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

C# CommandDelegate类代码示例

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

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



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


示例16: ReadTreeLevel

        private void ReadTreeLevel(Dictionary<string, object> level, XmlNode node, CommandDelegate fn)
        {
            Dictionary<string, object> next;
            string name;

            XmlNodeList nodeL = node.ChildNodes;
            XmlNodeList cmdL;
            CommandInfo c;

            foreach (XmlNode part in nodeL)
            {
                switch (part.Name)
                {
                case "Level":
                    name = ((XmlElement)part).GetAttribute("Name");
                    next = new Dictionary<string, object>();
                    level[name] = next;
                    ReadTreeLevel(next, part, fn);
                    break;
                case "Command":
                    cmdL = part.ChildNodes;
                    c = new CommandInfo();
                    foreach (XmlNode cmdPart in cmdL)
                    {
                        switch (cmdPart.Name)
                        {
                        case "Module":
                            c.module = cmdPart.InnerText;
                            break;
                        case "Shared":
                            c.shared = Convert.ToBoolean(cmdPart.InnerText);
                            break;
                        case "HelpText":
                            c.help_text = cmdPart.InnerText;
                            break;
                        case "LongHelp":
                            c.long_help = cmdPart.InnerText;
                            break;
                        case "Description":
                            c.descriptive_help = cmdPart.InnerText;
                            break;
                        }
                    }
                    c.fn = new List<CommandDelegate>();
                    c.fn.Add(fn);
                    level[String.Empty] = c;
                    break;
                }
            }
        }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:50,代码来源:CommandConsole.cs


示例17: AddCommand

 public void AddCommand(string module, bool shared, string command, string help, string longhelp, string descriptivehelp, CommandDelegate fn) {}
开发者ID:BogusCurry,项目名称:halcyon,代码行数:1,代码来源:MockConsole.cs


示例18: AddCommand

        /// <summary>
        /// Add a command to those which can be invoked from the console.
        /// </summary>
        /// <param name="module"></param>
        /// <param name="command"></param>
        /// <param name="help"></param>
        /// <param name="longhelp"></param>
        /// <param name="descriptivehelp"></param>
        /// <param name="fn"></param>
        public void AddCommand(string module, bool shared, string command,
                string help, string longhelp, string descriptivehelp,
                CommandDelegate fn)
        {
            string[] parts = Parser.Parse(command);

            Dictionary<string, Object> current = tree;
            
            foreach (string part in parts)
            {
                if (current.ContainsKey(part))
                {
                    if (current[part] is Dictionary<string, Object>)
                        current = (Dictionary<string, Object>)current[part];
                    else
                        return;
                }
                else
                {
                    current[part] = new Dictionary<string, Object>();
                    current = (Dictionary<string, Object>)current[part];
                }
            }

            CommandInfo info;

            if (current.ContainsKey(String.Empty))
            {
                info = (CommandInfo)current[String.Empty];
                if (!info.shared && !info.fn.Contains(fn))
                    info.fn.Add(fn);

                return;
            }
            
            info = new CommandInfo();
            info.module = module;
            info.shared = shared;
            info.help_text = help;
            info.long_help = longhelp;
            info.descriptive_help = descriptivehelp;
            info.fn = new List<CommandDelegate>();
            info.fn.Add(fn);
            current[String.Empty] = info;

            // Now add command to modules dictionary
            lock (m_modulesCommands)
            {
                List<CommandInfo> commands;
                if (m_modulesCommands.ContainsKey(module))
                {
                    commands = m_modulesCommands[module];
                }
                else
                {
                    commands = new List<CommandInfo>();
                    m_modulesCommands[module] = commands;
                }

//                m_log.DebugFormat("[COMMAND CONSOLE]: Adding to category {0} command {1}", module, command);
                commands.Add(info);
            }
        }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:72,代码来源:CommandConsole.cs


示例19: FromXml

 public void FromXml(XmlElement root, CommandDelegate fn) {}
开发者ID:BogusCurry,项目名称:halcyon,代码行数:1,代码来源:MockConsole.cs


示例20: Command

 public Command(string cmdname, string permissionneeded, CommandDelegate cmd)
 {
     Name = cmdname;
     permission = permissionneeded;
     command = cmd;
 }
开发者ID:Scal,项目名称:TShock,代码行数:6,代码来源:Commands.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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