📄 instantmessage.cs
字号:
namespace Imps.Client.Core
{
using System;
public class InstantMessage : IMessage
{
private string _body;
private string _extend;
private string _id;
private PlayerCollection _receiver;
private DateTime _receiveTime;
private Player _sender;
private string _sipcUri;
private MessageType _type;
public InstantMessage()
{
this._receiver = new PlayerCollection();
}
public InstantMessage(string id, Player sender, string body) : this(id, sender, body, string.Empty, null)
{
}
public InstantMessage(string id, Player sender, string body, MessageType type) : this(id, sender, body, type, null)
{
}
public InstantMessage(string id, Player sender, string body, string sipcUri) : this(id, sender, body, sipcUri, null)
{
}
public InstantMessage(string id, Player sender, string body, params Player[] receiver) : this(id, sender, body, string.Empty, receiver)
{
}
public InstantMessage(string id, Player sender, string body, MessageType type, params Player[] receiver) : this(id, sender, body, string.Empty, type, receiver)
{
}
public InstantMessage(string id, Player sender, string body, string sipcUri, params Player[] receiver) : this(id, sender, body, sipcUri, MessageType.IM, receiver)
{
}
public InstantMessage(string id, Player sender, string body, string sipcUri, MessageType type, params Player[] receiver) : this()
{
this._id = string.IsNullOrEmpty(id) ? Guid.NewGuid().ToString("N") : id;
this._sender = sender;
this._body = body;
this._type = type;
this._sipcUri = sipcUri;
if (receiver != null)
{
foreach (Player player in receiver)
{
this._receiver.Add(player);
}
}
}
public string Body
{
get
{
return this._body;
}
set
{
this._body = value;
}
}
public string Extend
{
get
{
return this._extend;
}
set
{
this._extend = value;
}
}
public string ID
{
get
{
return this._id;
}
set
{
this._id = value;
}
}
public PlayerCollection Receivers
{
get
{
return this._receiver;
}
}
public Player Sender
{
get
{
return this._sender;
}
set
{
this._sender = value;
}
}
public DateTime Time
{
get
{
return this._receiveTime;
}
set
{
this._receiveTime = value;
}
}
public MessageType Type
{
get
{
return this._type;
}
set
{
this._type = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -