本文整理汇总了C#中OpenSim.Framework.GridInstantMessage.FromOSD方法的典型用法代码示例。如果您正苦于以下问题:C# GridInstantMessage.FromOSD方法的具体用法?C# GridInstantMessage.FromOSD怎么用?C# GridInstantMessage.FromOSD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Framework.GridInstantMessage
的用法示例。
在下文中一共展示了GridInstantMessage.FromOSD方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: processXMLRPCGridInstantMessage
/// <summary>
/// Process a XMLRPC Grid Instant Message
/// </summary>
/// <param name="request">XMLRPC parameters
/// </param>
/// <returns>Nothing much</returns>
protected virtual XmlRpcResponse processXMLRPCGridInstantMessage(XmlRpcRequest request, IPEndPoint remoteClient)
{
bool successful = false;
GridInstantMessage gim = new GridInstantMessage ();
Hashtable requestData = (Hashtable)request.Params[0];
if (requestData.ContainsKey ("message"))
{
//Deserialize it
gim.FromOSD ((OSDMap)OSDParser.DeserializeJson (requestData["message"].ToString ()));
if (gim.dialog == (byte)InstantMessageDialog.GodLikeRequestTeleport)
gim.dialog = (byte)InstantMessageDialog.RequestTeleport;
// Trigger the Instant message in the scene.
foreach (Scene scene in m_Scenes)
{
IScenePresence user;
if (scene.TryGetScenePresence (gim.toAgentID, out user))
{
if (!user.IsChildAgent)
{
scene.EventManager.TriggerIncomingInstantMessage (gim);
successful = true;
}
}
}
if (!successful)
{
// If the message can't be delivered to an agent, it
// is likely to be a group IM. On a group IM, the
// imSessionID = toAgentID = group id. Raise the
// unhandled IM event to give the groups module
// a chance to pick it up. We raise that in a random
// scene, since the groups module is shared.
//
m_Scenes[0].EventManager.TriggerUnhandledInstantMessage (gim);
}
}
//Send response back to region calling if it was successful
// calling region uses this to know when to look up a user's location again.
XmlRpcResponse resp = new XmlRpcResponse();
Hashtable respdata = new Hashtable();
if (successful)
respdata["success"] = "TRUE";
else
respdata["success"] = "FALSE";
resp.Value = respdata;
return resp;
}
示例2: processXMLRPCGridInstantMessage
/// <summary>
/// Process a XMLRPC Grid Instant Message
/// </summary>
/// <param name="request">XMLRPC parameters
/// </param>
/// <returns>Nothing much</returns>
protected virtual XmlRpcResponse processXMLRPCGridInstantMessage(XmlRpcRequest request, IPEndPoint remoteClient)
{
bool successful = false;
GridInstantMessage gim = new GridInstantMessage ();
Hashtable requestData = (Hashtable)request.Params[0];
if (requestData.ContainsKey ("message"))
{
try
{
//Deserialize it
gim.FromOSD ((OSDMap)OSDParser.DeserializeJson (requestData["message"].ToString ()));
}
catch
{
UUID fromAgentID = UUID.Zero;
UUID toAgentID = UUID.Zero;
UUID imSessionID = UUID.Zero;
uint timestamp = 0;
string fromAgentName = "";
string message = "";
byte dialog = (byte)0;
bool fromGroup = false;
byte offline = (byte)0;
uint ParentEstateID = 0;
Vector3 Position = Vector3.Zero;
UUID RegionID = UUID.Zero;
byte[] binaryBucket = new byte[0];
float pos_x = 0;
float pos_y = 0;
float pos_z = 0;
if (requestData.ContainsKey ("from_agent_id")
&& requestData.ContainsKey ("to_agent_id") && requestData.ContainsKey ("im_session_id")
&& requestData.ContainsKey ("timestamp") && requestData.ContainsKey ("from_agent_name")
&& requestData.ContainsKey ("message") && requestData.ContainsKey ("dialog")
&& requestData.ContainsKey ("from_group")
&& requestData.ContainsKey ("offline") && requestData.ContainsKey ("parent_estate_id")
&& requestData.ContainsKey ("position_x") && requestData.ContainsKey ("position_y")
&& requestData.ContainsKey ("position_z") && requestData.ContainsKey ("region_id")
&& requestData.ContainsKey ("binary_bucket"))
{
// Do the easy way of validating the UUIDs
UUID.TryParse ((string)requestData["from_agent_id"], out fromAgentID);
UUID.TryParse ((string)requestData["to_agent_id"], out toAgentID);
UUID.TryParse ((string)requestData["im_session_id"], out imSessionID);
UUID.TryParse ((string)requestData["region_id"], out RegionID);
try
{
timestamp = (uint)Convert.ToInt32 ((string)requestData["timestamp"]);
}
catch (ArgumentException)
{
}
catch (FormatException)
{
}
catch (OverflowException)
{
}
fromAgentName = (string)requestData["from_agent_name"];
message = (string)requestData["message"];
if (message == null)
message = string.Empty;
// Bytes don't transfer well over XMLRPC, so, we Base64 Encode them.
string requestData1 = (string)requestData["dialog"];
if (string.IsNullOrEmpty (requestData1))
{
dialog = 0;
}
else
{
byte[] dialogdata = Convert.FromBase64String (requestData1);
dialog = dialogdata[0];
}
if ((string)requestData["from_group"] == "TRUE")
fromGroup = true;
string requestData2 = (string)requestData["offline"];
if (String.IsNullOrEmpty (requestData2))
{
offline = 0;
}
else
{
byte[] offlinedata = Convert.FromBase64String (requestData2);
offline = offlinedata[0];
}
try
//.........这里部分代码省略.........