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


C# Engine.CommandModel类代码示例

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


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

示例1: ExecuteCommand

        public void ExecuteCommand(string cmd)
        {
            if (!(cmd.Length > 0)) {
                return;
            }

            bool handled = false;
            CommandModel cd = new CommandModel(Frontend.FrontendManager, null,
                                    (string)Frontend.UserConfig["Interface/Entry/CommandCharacter"],
                                    cmd);
            //handled = _Command(cd);
            if (!handled) {
                handled = Frontend.Session.Command(cd);
            }
            if (!handled) {
                // we may have no network manager yet
                Engine.IProtocolManager nm = Frontend.FrontendManager.CurrentProtocolManager;
                if (nm != null) {
                    handled = nm.Command(cd);
                } else {
                    handled = false;
                }
            }
            if (!handled) {
               _CommandUnknown(cd);
            }
        }
开发者ID:RoninBG,项目名称:smuxi,代码行数:27,代码来源:Entry.cs

示例2: Parser

        public void Parser()
        {
            var cmd = new CommandModel(null, null, "/", "/test foobar");
            Assert.IsTrue(cmd.IsCommand);
            Assert.AreEqual("test", cmd.Command);
            Assert.AreEqual("foobar", cmd.Parameter);

            cmd = new CommandModel(null, null, "/", "/test foo bar");
            Assert.IsTrue(cmd.IsCommand);
            Assert.AreEqual("test", cmd.Command);
            Assert.AreEqual("foo bar", cmd.Parameter);

            cmd = new CommandModel(null, null, "/", "/test  foo bar");
            Assert.IsTrue(cmd.IsCommand);
            Assert.AreEqual("test", cmd.Command);
            Assert.AreEqual(" foo bar", cmd.Parameter);

            cmd = new CommandModel(null, null, "/", "/test foo bar ");
            Assert.IsTrue(cmd.IsCommand);
            Assert.AreEqual("test", cmd.Command);
            Assert.AreEqual("foo bar ", cmd.Parameter);

            cmd = new CommandModel(null, null, "/", "/test  foo bar ");
            Assert.IsTrue(cmd.IsCommand);
            Assert.AreEqual("test", cmd.Command);
            Assert.AreEqual(" foo bar ", cmd.Parameter);
        }
开发者ID:grendello,项目名称:smuxi,代码行数:27,代码来源:CommandModelTests.cs

示例3: CommandHookEnvironment

        public CommandHookEnvironment(CommandModel cmd)
        {
            if (cmd == null) {
                throw new ArgumentNullException("cmd");
            }

            this["CMD"] = cmd.Command;
            this["CMD_PARAMETER"] = cmd.Parameter;
            this["CMD_CHARACTER"] = cmd.CommandCharacter;
        }
开发者ID:pacificIT,项目名称:smuxi,代码行数:10,代码来源:CommandHookEnvironment.cs

示例4: CommandSay

 public void CommandSay(CommandModel cd)
 {
     _Say(cd.Chat, cd.Parameter);
 }
开发者ID:oli-obk,项目名称:smuxi,代码行数:4,代码来源:XmppProtocolManager.cs

示例5: CommandGenerateMessages

        void CommandGenerateMessages(CommandModel cmd)
        {
            var chat = ChatViewManager.CurrentChatView;
            _CommandManager.CommandGenerateMessages(cmd, chat);

            var builder = new MessageBuilder();
            builder.AppendText(
                "ChatView.AddMessage(): MessageTextTagTable.Size: {0}",
                chat.OutputMessageTextView.MessageTextTagTable.Size
            );
            chat.AddMessage(builder.ToMessage());
        }
开发者ID:pacificIT,项目名称:smuxi,代码行数:12,代码来源:Entry.cs

示例6: Command

        public override bool Command(CommandModel command)
        {
            Trace.Call(command);

            bool handled = false;
            if (IsConnected) {
                if (command.IsCommand) {
                } else {
                    _Say(command.Chat, command.Data);
                    handled = true;
                }
            } else {
                if (command.IsCommand) {
                    // commands which work even without beeing connected
                    switch (command.Command) {
                        case "help":
                            CommandHelp(command);
                            handled = true;
                            break;
                        case "connect":
                            CommandConnect(command);
                            handled = true;
                            break;
                    }
                } else {
                    // normal text, without connection
                    NotConnected(command);
                    handled = true;
                }
            }

            return handled;
        }
开发者ID:RoninBG,项目名称:smuxi,代码行数:33,代码来源:OscarProtocolManager.cs

示例7: CommandHelp

        public void CommandHelp(CommandModel cd)
        {
            MessageModel fmsg = new MessageModel();
            TextMessagePartModel fmsgti;

            fmsgti = new TextMessagePartModel();
            fmsgti.Text = _("[OscarProtocolManager Commands]");
            fmsgti.Bold = true;
            fmsg.MessageParts.Add(fmsgti);

            this.Session.AddMessageToChat(cd.FrontendManager.CurrentChat, fmsg);

            string[] help = {
            "help",
            "connect aim/icq username password",
            };

            foreach (string line in help) {
                cd.FrontendManager.AddTextToCurrentChat("-!- " + line);
            }
        }
开发者ID:RoninBG,项目名称:smuxi,代码行数:21,代码来源:OscarProtocolManager.cs

示例8: _CommandHelp

        private void _CommandHelp(CommandModel cd)
        {
            var chatView = ChatViewManager.GetChat(cd.Chat);
            var builder = new MessageBuilder();
            // TRANSLATOR: this line is used as a label / category for a
            // list of commands below
            builder.AppendHeader(_("Frontend Commands"));
            chatView.AddMessage(builder.ToMessage());

            string[] help = {
            "window (number|channelname|queryname|close)",
            "sync",
            "sort",
            "clear",
            "echo data",
            "exec command",
            "detach",
            "list [search key]",
            };

            foreach (string line in help) {
                builder = new MessageBuilder();
                builder.AppendEventPrefix();
                builder.AppendText(line);
                chatView.AddMessage(builder.ToMessage());
            }
        }
开发者ID:pacificIT,项目名称:smuxi,代码行数:27,代码来源:Entry.cs

示例9: _CommandSync

        private void _CommandSync(CommandModel cmd)
        {
            if (Frontend.IsLocalEngine) {
                return;
            }

            var chatView = ChatViewManager.CurrentChatView;
            ThreadPool.QueueUserWorkItem(delegate {
                try {
                    var oldValue = Frontend.UseLowBandwidthMode;
                    // HACK: force a full sync
                    Frontend.UseLowBandwidthMode = false;
                    chatView.Sync();
                    Frontend.UseLowBandwidthMode = oldValue;

                    Gtk.Application.Invoke(delegate {
                        Frontend.UseLowBandwidthMode = false;
                        chatView.Populate();
                        Frontend.UseLowBandwidthMode = oldValue;
                        chatView.ScrollToEnd();
                    });
                } catch (Exception ex) {
                    Frontend.ShowError(null, ex);
                }
            });
        }
开发者ID:pacificIT,项目名称:smuxi,代码行数:26,代码来源:Entry.cs

示例10: Command

        public override bool Command(CommandModel command)
        {
            Trace.Call(command);

            bool handled = false;

            switch (command.Command) {
                case "j":
                case "join":
                    CommandJoin(command);
                    handled = true;
                    break;
                case "say":
                    CommandSay(command);
                    handled = true;
                    break;
                case "help":
                    CommandHelp(command);
                    handled = true;
                    break;
                case "topic":
                    CommandTopic(command);
                    handled = true;
                    break;
                case "uploads":
                    CommandUploads(command);
                    handled = true;
                    break;
                default: // nothing, normal chat
                    handled = true;
                    if (command.Chat is GroupChatModel)
                        SendMessage((GroupChatModel) command.Chat, command.Data);
                    break;
            }

            return handled;
        }
开发者ID:glwu,项目名称:smuxi,代码行数:37,代码来源:CampfireProtocolManager.cs

示例11: _CommandClear

 private void _CommandClear(CommandModel cd)
 {
     ChatViewManager.CurrentChatView.Clear();
 }
开发者ID:pacificIT,项目名称:smuxi,代码行数:4,代码来源:Entry.cs

示例12: CommandHelp

        public void CommandHelp(CommandModel cd)
        {
            MessageModel fmsg = new MessageModel();
            TextMessagePartModel fmsgti;

            fmsgti = new TextMessagePartModel();
            // TRANSLATOR: this line is used as a label / category for a
            // list of commands below
            fmsgti.Text = "[" + _("MSN Commands") + "]";
            fmsgti.Bold = true;
            fmsg.MessageParts.Add(fmsgti);

            Session.AddMessageToChat(cd.Chat, fmsg);

            string[] help = {
            "help",
            "connect msn username password",
            };

            foreach (string line in help) {
                cd.FrontendManager.AddTextToChat(cd.Chat, "-!- " + line);
            }
        }
开发者ID:tuukka,项目名称:smuxi,代码行数:23,代码来源:MsnpProtocolManager.cs

示例13: _Say

        private void _Say(CommandModel command, string text)
        {
            if (!command.Chat.IsEnabled) {
                return;
            }

            //            string target = command.Chat.ID;
            //
            //            _JabberClient.Message(target, text);

            MessageModel msg = new MessageModel();
            TextMessagePartModel msgPart;

            msgPart = new TextMessagePartModel();
            msgPart.Text = "<";
            msg.MessageParts.Add(msgPart);

            msgPart = new TextMessagePartModel();
            msgPart.Text = _UsersAddress;
            //msgPart.ForegroundColor = IrcTextColor.Blue;
            msgPart.ForegroundColor = new TextColor(0x0000FF);
            msg.MessageParts.Add(msgPart);

            msgPart = new TextMessagePartModel();
            msgPart.Text = "> ";
            msg.MessageParts.Add(msgPart);

            msgPart = new TextMessagePartModel();
            msgPart.Text = text;
            msg.MessageParts.Add(msgPart);

                Session.AddMessageToChat(command.Chat, msg);
        }
开发者ID:tuukka,项目名称:smuxi,代码行数:33,代码来源:MsnpProtocolManager.cs

示例14: CommandConnect

        public void CommandConnect(CommandModel cd)
        {
            FrontendManager fm = cd.FrontendManager;

            string user;
            if (cd.DataArray.Length >= 1) {
                user = cd.DataArray[2];
            } else {
                NotEnoughParameters(cd);
                return;
            }

            string pass;
            if (cd.DataArray.Length >= 2) {
                pass = cd.DataArray[3];
            } else {
                NotEnoughParameters(cd);
                return;
            }

            Connect(fm, null, 0, user, pass);
        }
开发者ID:tuukka,项目名称:smuxi,代码行数:22,代码来源:MsnpProtocolManager.cs

示例15: Run

 public override void Run(string commandLine)
 {
     var cmd = new CommandModel(null, Chat, CommandCharacter, commandLine);
     ProtocolManager.Command(cmd);
 }
开发者ID:RAOF,项目名称:smuxi,代码行数:5,代码来源:ProtocolManagerHookCommand.cs


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