本文整理汇总了C#中UserInfo.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# UserInfo.ContainsKey方法的具体用法?C# UserInfo.ContainsKey怎么用?C# UserInfo.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserInfo
的用法示例。
在下文中一共展示了UserInfo.ContainsKey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RES
public RES(IConnection con, ContentInfo info, string token, UserInfo usr)
: base(con, null)
{
this.info = info;
if (
usr.ContainsKey(UserInfo.UDPPORT)
&& usr.ContainsKey("SU")
&& usr.ContainsKey(UserInfo.IP)
&& (usr.Get("SU").Contains("UDP4") || usr.Get("SU").Contains("UDP6"))
)
{
type = "U";
int port = -1;
string addr = usr.Get(UserInfo.IP);
try
{
port = int.Parse(usr.Get(UserInfo.UDPPORT));
if (port < 0 || port > 65535)
port = 0;
address = new System.Net.IPEndPoint(System.Net.IPAddress.Parse(addr), port);
}
catch { }
}
else if (con is Hub)
{
type = "D";
}
else
{
type = "C";
}
System.Text.StringBuilder sb = new System.Text.StringBuilder();
if (info.ContainsKey(ContentInfo.VIRTUAL))
sb.Append(" FN" + AdcProtocol.ConvertOutgoing(info.Get(ContentInfo.VIRTUAL)));
sb.Append(" SI" + info.Size.ToString());
if (!string.IsNullOrEmpty(token))
sb.Append(" TO" + token);
// TODO : Add Slots handling
Raw = string.Format("{0}RES{1}\n", type, sb.ToString());
}
示例2: MyINFO
public MyINFO(Hub hub, byte flg)
: base(hub, null)
{
this.info = hub.Me;
this.statusFlag = flg;
System.Text.StringBuilder tag = new System.Text.StringBuilder();
tag.Append("<");
tag.Append(info.TagInfo.Version);
tag.Append(",M:");
switch (info.TagInfo.Mode) {
case Enums.ConnectionTypes.Socket5: // Socket5
tag.Append("5"); break;
case Enums.ConnectionTypes.Direct: // Active
tag.Append("A"); break;
case Enums.ConnectionTypes.Passive: // Passive
default:
tag.Append("P"); break;
}
tag.Append(",H:");
tag.Append(info.TagInfo.Normal.ToString() + "/"); // Normal
tag.Append(info.TagInfo.Regged.ToString() + "/"); // Regged
tag.Append(info.TagInfo.OP.ToString() + ""); // OP
tag.Append(",S:" + (info.TagInfo.Slots == -1 ? 0 : info.TagInfo.Slots).ToString() + ">");
UserStatusFlag status = ConvertByteToStatusFlag(statusFlag);
if (info.ContainsKey(UserInfo.SECURE))
status |= UserStatusFlag.TLS;
Raw = "$MyINFO $ALL "
+ info.DisplayName
+ " "
+ info.Description
+ tag
+ "$ $"
+ info.Connection
+ hub.Protocol.Encoding.GetString(new byte[] { ConvertStatusFlagToByte(status) }) + "$"
+ info.Email + "$"
+ (string.IsNullOrEmpty(info.Share) ? "0" : info.Share)
+ "$|";
IsValid = true;
}
示例3: MSG
/// <summary>
/// Constructor for sending Private messages
/// </summary>
/// <param name="hub"></param>
/// <param name="me"></param>
/// <param name="content"></param>
/// <param name="to"></param>
/// <param name="group"></param>
public MSG(IConnection con, UserInfo usr, bool me, string content, string to, string group)
: base(con, null)
{
this.to = to;
this.pmgroup = group;
this.me = me;
this.content = content;
if (usr.ContainsKey(UserInfo.SID))
this.from = usr.Get(UserInfo.SID);
if (this.to == null || this.pmgroup == null)
{
if (this.pmgroup != null)
this.to = this.pmgroup;
}
// DMSG SHJV SH5B PIIP!! PMSHJV
//Raw = "DMSG " + this.from + " " + this.to + " " + AdcProtocol.ConvertOutgoing(this.content) + (this.me ? " ME1" : "") + " PM"+((this.pmgroup != null) ? (this.pmgroup) : this.from) + "\n";
Raw = "EMSG " + this.from + " " + this.to + " " + AdcProtocol.ConvertOutgoing(this.content) + (this.me ? " ME1" : "") + " PM" + ((this.pmgroup != null) ? (this.pmgroup) : this.from) + "\n";
}
示例4: MyINFO
public MyINFO(Hub hub, byte flg)
: base(hub, null)
{
//$MyINFO $ALL DisplayName Description goes here † ZPoc V:3.00a, S:2, M:A † $ [email protected]$0$|
this.info = hub.Me;
this.statusFlag = flg;
System.Text.StringBuilder tag = new System.Text.StringBuilder();
//ZPoC fix -- Tosk
tag.Append(" ");
string cross = "†";
tag.Append(cross);
tag.Append(" ");
tag.Append(info.TagInfo.Version);
tag.Append(", S:" + (info.TagInfo.Slots == -1 ? 0 : info.TagInfo.Slots).ToString());
tag.Append(", M:");
switch (info.TagInfo.Mode) {
case Enums.ConnectionTypes.Socket5: // Socket5
tag.Append("5"); break;
case Enums.ConnectionTypes.Direct: // Active
tag.Append("A"); break;
case Enums.ConnectionTypes.Passive: // Passive
default:
tag.Append("P"); break;
}
tag.Append(" ");
tag.Append(cross);
tag.Append(" ");
UserStatusFlag status = ConvertByteToStatusFlag(statusFlag);
if (info.ContainsKey(UserInfo.SECURE))
status |= UserStatusFlag.TLS;
Raw = "$MyINFO $ALL "
+ info.DisplayName
+ " "
+ info.Description
+ tag
+ "$ $"
+ info.Connection
+ hub.Protocol.Encoding.GetString(new byte[] { ConvertStatusFlagToByte(status) }) + "$"
+ info.Email + "$"
//+ info.Share
+ "0"
+ "$|";
IsValid = true;
}