本文整理汇总了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);
}
}
示例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);
}
示例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;
}
示例4: CommandSay
public void CommandSay(CommandModel cd)
{
_Say(cd.Chat, cd.Parameter);
}
示例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());
}
示例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;
}
示例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);
}
}
示例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());
}
}
示例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);
}
});
}
示例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;
}
示例11: _CommandClear
private void _CommandClear(CommandModel cd)
{
ChatViewManager.CurrentChatView.Clear();
}
示例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);
}
}
示例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);
}
示例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);
}
示例15: Run
public override void Run(string commandLine)
{
var cmd = new CommandModel(null, Chat, CommandCharacter, commandLine);
ProtocolManager.Command(cmd);
}