本文整理汇总了C#中Messages.Send方法的典型用法代码示例。如果您正苦于以下问题:C# Messages.Send方法的具体用法?C# Messages.Send怎么用?C# Messages.Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messages
的用法示例。
在下文中一共展示了Messages.Send方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSendMessageOutput
public static string GetSendMessageOutput(Messages.ISendMessage message)
{
MemoryStream stream = new MemoryStream();
message.Send(new StreamWriter(stream) { AutoFlush = true }, new Client());
StreamReader reader = new StreamReader(stream);
stream.Position = 0;
return reader.ReadToEnd().Trim();
}
示例2: Send
/// <summary>
/// Send a message to the connected server.
/// </summary>
/// <param name="message">The NetIRC.SendMessage instance to be sent.</param>
public void Send(Messages.ISendMessage message)
{
SendMessageEventArgs e = new SendMessageEventArgs(message);
this.TriggerOnSend(e);
if (e.Message == null) return;
using (MemoryStream stream = new MemoryStream())
{
message.Send(new StreamWriter(stream) {AutoFlush = true}, this);
StreamReader reader = new StreamReader(stream);
stream.Position = 0;
while (true)
{
string line = reader.ReadLine();
if (string.IsNullOrEmpty(line))
{
break;
}
foreach (Type writerType in this._outputWriters)
{
IWriter instance = (IWriter)Activator.CreateInstance(writerType);
instance.ProcessSendMessage(line, this);
}
}
}
}
示例3: Tranceive
public void Tranceive(Messages.Message message)
{
Tracer.WriteLineInfo("Sending {0}", message.GetType().Name);
message.Send(PortStream);
message.Receive(PortStream);
}