本文整理匯總了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);
}
}
}