本文整理汇总了C#中Event.AddContent方法的典型用法代码示例。如果您正苦于以下问题:C# Event.AddContent方法的具体用法?C# Event.AddContent怎么用?C# Event.AddContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event.AddContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Disconnect
private void Disconnect(Transceiver connection)
{
Logger.log("Connector: Disconnected from server. Sending notice.", Logger.Verbosity.moderate);
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", "disconnected");
connected.type = BasicContent.Type.Event;
notice.content = connected;
this._controller.message_pump.process_message(notice);
}
示例2: 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);
}
}
}
示例3: HookConnection
private void HookConnection(Transceiver connection)
{
connection.plugin_writers += new WriterOverload(this.WriteEncrypted);
connection.plugin_readers += new ReaderOverload(this.ReadEncrypted);
connection.filter_writer += new WriteFilter(this.WriteFilter);
Message message = new Message();
message.type = Message.Type.Loop;
message.creator_plugin_hash = this._hash_code;
Event content = new Event();
content.type = MessageContent.Type.Event;
content.etype = "Encryption";
content.AddContent("status", "crypted");
this.SendUINotice("Channel Encrypted.");
message.content = content;
this._controller.message_pump.process_message(message);
Logger.log("Encryption hooks have been placed.", Logger.Verbosity.moderate);
}