本文整理汇总了C#中UserInfo.Get方法的典型用法代码示例。如果您正苦于以下问题:C# UserInfo.Get方法的具体用法?C# UserInfo.Get怎么用?C# UserInfo.Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserInfo
的用法示例。
在下文中一共展示了UserInfo.Get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: get_and_set
public void get_and_set()
{
var foo = new Foo {Name = "Scooby"};
var bar = new Bar {Level = 33};
var user = new UserInfo();
user.Set(foo);
user.Set(bar);
user.Get<Foo>().ShouldBeTheSameAs(foo);
user.Get<Bar>().ShouldBeTheSameAs(bar);
}
示例2: 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());
}
示例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";
}