本文整理汇总了C#中ISender.ToUri方法的典型用法代码示例。如果您正苦于以下问题:C# ISender.ToUri方法的具体用法?C# ISender.ToUri怎么用?C# ISender.ToUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISender
的用法示例。
在下文中一共展示了ISender.ToUri方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBuddyWithSender
/**
* @return the buddy in the list that has the given Address
*/
public Buddy GetBuddyWithSender(ISender a)
{
return (Buddy)_add_to_buddy[a.ToUri()];
}
示例2: HandleRpc
public void HandleRpc(ISender caller, string method, IList arguments, object request_state) {
if( method == "message") {
var sr = new System.IO.StringReader((string)arguments[0]);
XmlReader r = new XmlTextReader(sr);
var mser = new XmlSerializer(typeof(Brunet.Chat.Message));
var message = (Brunet.Chat.Message)mser.Deserialize(r);
var args = new ChatEventArgs(caller, message);
Buddy b = GetBuddyWithSender(caller);
ChatEvent(b, args);
_node.Value.Rpc.SendResult(request_state, true);
}
else if( method == "presence" ) {
Buddy b = GetBuddyWithSender(caller);
if (b == null) { throw new Exception("Unknown buddy: " + caller.ToUri()); }
//Read the presence information:
var sr = new System.IO.StringReader((string)arguments[0]);
XmlReader r = new XmlTextReader(sr);
var pser = new XmlSerializer(typeof(Brunet.Chat.Presence));
Brunet.Chat.Presence pres = (Brunet.Chat.Presence)pser.Deserialize(r);
b.Presence = pres;
//Send our response:
System.IO.StringWriter sw = new System.IO.StringWriter();
var tw = new XmlTextWriter(sw);
Brunet.Chat.Presence local_p = new Brunet.Chat.Presence();
local_p.Show = User.Show;
local_p.Status = User.Status;
pser.Serialize(tw, local_p);
_node.Value.Rpc.SendResult(request_state, sw.ToString());
}
else {
throw new Exception("Unknown method: " + method);
}
}