本文整理汇总了C#中ClientMessage.Get方法的典型用法代码示例。如果您正苦于以下问题:C# ClientMessage.Get方法的具体用法?C# ClientMessage.Get怎么用?C# ClientMessage.Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClientMessage
的用法示例。
在下文中一共展示了ClientMessage.Get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: process
public override void process(ClientMessage message, Transceiver connection)
{
if(message.type == "newUser")
{
this.RequestKey(message.Get("username"));
}
}
示例2: process
public override void process(ClientMessage message, Transceiver connection)
{
if(message.type == "userRequest")
{
if(this._user_cache.ContainsKey(message.Get("username")))
{
this.StartChat(message.Get("username"), (string)this._user_cache[message.Get("username")]);
}
else
{
this.SendRequest(message.Get("username"), connection);
}
}
else if(message.type == "userMessage")
{
this.SendUserMessage(message, connection);
}
}
示例3: SendUserMessage
private void SendUserMessage(ClientMessage cmessage, Transceiver connection)
{
Message message = new Message();
message.type = Message.Type.UserToUser;
message.destination_plugin_hash = cmessage.Get("destination");
Chat content = new Chat();
content.AddContent("message", cmessage.Get("message"));
content.AddContent("time", cmessage.Get("time"));
message.content = content;
connection.Write(message);
Logger.log("Messenger: Chat message sent.", Logger.Verbosity.moderate);
}
示例4: process
public override void process(ClientMessage message, Transceiver connection)
{
Logger.log("Processing connection message.", Logger.Verbosity.moderate);
if(message.type == "connect")
{
string server = message.Get("server");
string port_s = message.Get("port");
this._username = message.Get("username");
this._password = message.Get("password");
int port = Convert.ToInt32(port_s);
Logger.log("Making connection.", Logger.Verbosity.moderate);
if(this.EstablishConnection(server, port))
{
Message notice = new Message();
notice.type = Message.Type.Loop;
notice.creator_plugin_hash = this._hash_code;
notice.origin = connection;
Event connected = new Event();
connected.etype = "connection";
connected.AddContent("status", "connected");
connected.type = BasicContent.Type.Event;
notice.content = connected;
this._controller.message_pump.process_message(notice);
this.SendUINotice("Connected");
Logger.log("Client now connected to server.", Logger.Verbosity.moderate);
this.SendPluginListing(connection);
Logger.log("Connection steps are now complete.", Logger.Verbosity.moderate);
}
else
{
this.SendUINotice("Failed");
Logger.log("Failed to establish connection to server.", Logger.Verbosity.moderate);
}
}
}