本文整理汇总了C#中OpenSim.Framework.Capabilities.OSDMap.Add方法的典型用法代码示例。如果您正苦于以下问题:C# OSDMap.Add方法的具体用法?C# OSDMap.Add怎么用?C# OSDMap.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Framework.Capabilities.OSDMap
的用法示例。
在下文中一共展示了OSDMap.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessQueue
public Hashtable ProcessQueue(Hashtable request, UUID agentID)
{
// TODO: this has to be redone to not busy-wait (and block the thread),
// TODO: as soon as we have a non-blocking way to handle HTTP-requests.
// if (m_log.IsDebugEnabled)
// {
// String debug = "[EVENTQUEUE]: Got request for agent {0} in region {1} from thread {2}: [ ";
// foreach (object key in request.Keys)
// {
// debug += key.ToString() + "=" + request[key].ToString() + " ";
// }
// m_log.DebugFormat(debug + " ]", agentID, m_scene.RegionInfo.RegionName, System.Threading.Thread.CurrentThread.Name);
// }
//m_log.Warn("Got EQM get at " + m_handler.CapsURL);
OSD element = null;
lock (queue)
{
if (queue.Count != 0)
element = queue.Dequeue(); // 15s timeout
}
Hashtable responsedata = new Hashtable();
if (element == null)
{
//m_log.ErrorFormat("[EVENTQUEUE]: Nothing to process in " + m_scene.RegionInfo.RegionName);
return NoEvents(UUID.Zero, agentID);
}
OSDArray array = new OSDArray();
array.Add(element);
lock (queue)
{
while (queue.Count > 0)
{
OSD item = queue.Dequeue();
if (item != null)
{
array.Add(item);
m_ids++;
}
}
}
//Look for disable Simulator EQMs so that we can disable ourselves safely
foreach (OSD ev in array)
{
try
{
OSDMap map = (OSDMap)ev;
if (map.ContainsKey("message") && map["message"] == "DisableSimulator")
{
//This will be the last bunch of EQMs that go through, so we can safely die now
m_service.ClientCaps.RemoveCAPS(m_service.RegionHandle);
}
}
catch
{
}
}
OSDMap events = new OSDMap();
events.Add("events", array);
events.Add("id", new OSDInteger(m_ids));
m_ids++;
responsedata["int_response_code"] = 200;
responsedata["content_type"] = "application/xml";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
//m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
return responsedata;
}
示例2: TeleportLocation
private Hashtable TeleportLocation (Hashtable mDhttpMethod, UUID agentID)
{
OSDMap rm = (OSDMap)OSDParser.DeserializeLLSDXml((string)mDhttpMethod["requestbody"]);
OSDMap pos = rm["LocationPos"] as OSDMap;
Vector3 position = new Vector3((float)pos["X"].AsReal(),
(float)pos["Y"].AsReal(),
(float)pos["Z"].AsReal());
OSDMap lookat = rm["LocationLookAt"] as OSDMap;
Vector3 lookAt = new Vector3((float)lookat["X"].AsReal(),
(float)lookat["Y"].AsReal(),
(float)lookat["Z"].AsReal());
ulong RegionHandle = rm["RegionHandle"].AsULong();
uint tpFlags = 16;
OSDMap retVal = new OSDMap();
string reason = "";
int x, y;
Util.UlongToInts(RegionHandle, out x, out y);
GridRegion destination = m_service.Registry.RequestModuleInterface<IGridService>().GetRegionByPosition(UUID.Zero,
x, y);
ISimulationService simService = m_service.Registry.RequestModuleInterface<ISimulationService>();
AgentData ad = new AgentData();
if(destination != null)
{
simService.RetrieveAgent(m_service.Region, m_service.AgentID, out ad);
if(ad != null)
ad.Position = position;
}
AgentCircuitData circuitData = m_service.CircuitData.Copy();
circuitData.reallyischild = false;
circuitData.Appearance = m_service.Registry.RequestModuleInterface<IAvatarService>().GetAppearance(m_service.AgentID);
circuitData.child = false;
if(destination != null && m_agentProcessing.TeleportAgent(ref destination, tpFlags, ad == null ? 0 : (int)ad.Far, circuitData, ad,
m_service.AgentID, m_service.RegionHandle, out reason))
{
retVal.Add("success", OSD.FromBoolean(true));
if(m_service.RegionHandle != destination.RegionHandle)
simService.MakeChildAgent(m_service.AgentID, m_service.Region);
}
else
{
if(destination == null)
retVal.Add("reason", "Could not find the destination region.");
else
retVal.Add("reason", reason);
retVal.Add("success", OSD.FromBoolean(false));
}
//Send back data
Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 200; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(retVal);
return responsedata;
}
示例3: GetEvents
public Hashtable GetEvents(UUID requestID, UUID pAgentId, string request)
{
OSDMap events = new OSDMap();
try
{
OSD element;
lock (queue)
{
if (queue.Count == 0)
return NoEvents(requestID, pAgentId);
element = queue.Dequeue(); // 15s timeout
}
OSDArray array = new OSDArray();
if (element == null) // didn't have an event in 15s
{
//return NoEvents(requestID, pAgentId);
// Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
OSDMap keepAliveEvent = new OSDMap(2);
keepAliveEvent.Add("body", new OSDMap());
keepAliveEvent.Add("message", new OSDString("FAKEEVENT"));
element = keepAliveEvent;
array.Add(keepAliveEvent);
//m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName);
}
array.Add(element);
lock (queue)
{
while (queue.Count > 0)
{
array.Add(queue.Dequeue());
m_ids++;
}
}
//Look for disable Simulator EQMs so that we can disable ourselves safely
foreach (OSD ev in array)
{
try
{
if (ev.Type == OSDType.Map)
{
OSDMap map = (OSDMap)ev;
if (map.ContainsKey("message") && map["message"] == "DisableSimulator")
{
//This will be the last bunch of EQMs that go through, so we can safely die now
m_service.ClientCaps.RemoveCAPS(m_service.RegionHandle);
m_log.Warn("[EQService]: Disabling Simulator " + m_service.RegionHandle);
}
}
}
catch
{
}
}
events.Add("events", array);
events.Add("id", new OSDInteger(m_ids));
m_ids++;
}
catch
{
}
Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 200;
responsedata["content_type"] = "application/xml";
responsedata["keepalive"] = false;
responsedata["reusecontext"] = false;
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
//m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
return responsedata;
}
示例4: HandleSaveAvatarArchive
protected void HandleSaveAvatarArchive(string[] cmdparams)
{
if (cmdparams.Length < 7)
{
m_log.Info("[AvatarArchive] Not enough parameters!");
return;
}
UserAccount account = UserAccountService.GetUserAccount(UUID.Zero, cmdparams[3], cmdparams[4]);
if (account == null)
{
m_log.Error("[AvatarArchive] User not found!");
return;
}
AvatarAppearance appearance = AvatarService.GetAppearance(account.PrincipalID);
OSDMap map = new OSDMap();
OSDMap body = new OSDMap();
OSDMap assets = new OSDMap();
OSDMap items = new OSDMap();
body = appearance.Pack();
body.Add("FolderName", OSD.FromString(cmdparams[6]));
try
{
foreach (AvatarWearable wear in appearance.Wearables)
{
for (int i = 0; i < wear.Count; i++)
{
WearableItem w = wear[i];
if (w.AssetID != UUID.Zero)
{
SaveItem(w.ItemID, items, assets);
}
}
}
}
catch (Exception ex)
{
m_log.Warn("Excpetion: " + ex.ToString());
}
try
{
List<AvatarAttachment> attachments = appearance.GetAttachments();
foreach (AvatarAttachment a in attachments)
{
if (a.AssetID != UUID.Zero)
{
SaveItem(a.ItemID, items, assets);
}
}
}
catch(Exception ex)
{
m_log.Warn("Excpetion: " + ex.ToString());
}
map.Add("Body", body);
map.Add("Assets", assets);
map.Add("Items", items);
//Write the map
if (cmdparams[5].EndsWith(".database"))
{
//Remove the .database
string ArchiveName = cmdparams[5].Substring(0, cmdparams[5].Length - 9);
string ArchiveXML = OSDParser.SerializeLLSDXmlString(map);
AvatarArchive archive = new AvatarArchive();
archive.ArchiveXML = ArchiveXML;
archive.Name = ArchiveName;
if ((cmdparams.Length >= 8) && (cmdparams[7].Length == 36)) archive.Snapshot = cmdparams[7];
if ((cmdparams.Length >= 9) && (cmdparams[8].Length == 1)) archive.IsPublic = int.Parse(cmdparams[8]);
DataManager.RequestPlugin<IAvatarArchiverConnector>().SaveAvatarArchive(archive);
m_log.Info("[AvatarArchive] Saved archive to database " + cmdparams[5]);
}
else
{
m_log.Info("[AvatarArchive] Saving archive to " + cmdparams[5]);
StreamWriter writer = new StreamWriter(cmdparams[5], false);
writer.Write(OSDParser.SerializeLLSDXmlString(map));
writer.Close();
writer.Dispose();
m_log.Info("[AvatarArchive] Saved archive to " + cmdparams[5]);
}
}
示例5: SendGroupMembershipInfoViaCaps
/// <summary>
/// Send 'remoteClient' the group membership 'data' for agent 'dataForAgentID'.
/// </summary>
private void SendGroupMembershipInfoViaCaps(IClientAPI remoteClient, UUID dataForAgentID, GroupMembershipData[] data)
{
if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
OSDArray AgentData = new OSDArray(1);
OSDMap AgentDataMap = new OSDMap(1);
AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID));
AgentData.Add(AgentDataMap);
OSDArray GroupData = new OSDArray(data.Length);
OSDArray NewGroupData = new OSDArray(data.Length);
foreach (GroupMembershipData membership in data)
{
if (GetRequestingAgentID(remoteClient) != dataForAgentID)
{
if (!membership.ListInProfile)
{
// If we're sending group info to remoteclient about another agent,
// filter out groups the other agent doesn't want to share.
continue;
}
}
OSDMap GroupDataMap = new OSDMap(6);
OSDMap NewGroupDataMap = new OSDMap(1);
GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID));
GroupDataMap.Add("GroupPowers", OSD.FromULong(membership.GroupPowers));
GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices));
GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture));
GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution));
GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName));
NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile));
GroupData.Add(GroupDataMap);
NewGroupData.Add(NewGroupDataMap);
}
OSDMap llDataStruct = new OSDMap(3);
llDataStruct.Add("AgentData", AgentData);
llDataStruct.Add("GroupData", GroupData);
llDataStruct.Add("NewGroupData", NewGroupData);
if (m_debugEnabled)
{
m_log.InfoFormat("[GROUPS]: {0}", OSDParser.SerializeJsonString(llDataStruct));
}
IEventQueueService queue = remoteClient.Scene.RequestModuleInterface<IEventQueueService>();
if (queue != null)
{
queue.Enqueue(buildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient), remoteClient.Scene.RegionInfo.RegionHandle);
}
}
示例6: BuildOpenRegionInfo
public OSD BuildOpenRegionInfo(IScenePresence sp)
{
OSDMap map = new OSDMap();
OSDMap body = new OSDMap();
IOpenRegionSettingsConnector orsc = DataManager.DataManager.RequestPlugin<IOpenRegionSettingsConnector>();
if (orsc != null)
{
if (sp.Scene.Permissions.CanIssueEstateCommand(sp.UUID, false))
body.Add("EditURL", OSD.FromString(orsc.AddOpenRegionSettingsHTMLPage(sp.Scene.RegionInfo.RegionID)));
}
if (m_settings.MaxDragDistance != -1)
body.Add("MaxDragDistance", OSD.FromReal(m_settings.MaxDragDistance));
if (m_settings.DefaultDrawDistance != -1)
{
body.Add("DrawDistance", OSD.FromReal(m_settings.DefaultDrawDistance));
body.Add("ForceDrawDistance", OSD.FromInteger(m_settings.ForceDrawDistance ? 1 : 0));
}
if (m_settings.MaximumPrimScale != -1)
body.Add("MaxPrimScale", OSD.FromReal(m_settings.MaximumPrimScale));
if (m_settings.MinimumPrimScale != -1)
body.Add("MinPrimScale", OSD.FromReal(m_settings.MinimumPrimScale));
if (m_settings.MaximumPhysPrimScale != -1)
body.Add("MaxPhysPrimScale", OSD.FromReal(m_settings.MaximumPhysPrimScale));
if (m_settings.MaximumHollowSize != -1)
body.Add("MaxHollowSize", OSD.FromReal(m_settings.MaximumHollowSize));
if (m_settings.MinimumHoleSize != -1)
body.Add("MinHoleSize", OSD.FromReal(m_settings.MinimumHoleSize));
body.Add("EnforceMaxBuild", OSD.FromInteger(m_settings.ClampPrimSizes ? 1 : 0));
if (m_settings.MaximumLinkCount != -1)
body.Add("MaxLinkCount", OSD.FromInteger(m_settings.MaximumLinkCount));
if (m_settings.MaximumLinkCountPhys != -1)
body.Add("MaxLinkCountPhys", OSD.FromInteger(m_settings.MaximumLinkCountPhys));
body.Add("LSLFunctions", m_settings.LSLCommands);
body.Add("WhisperDistance", OSD.FromReal(m_settings.WhisperDistance));
body.Add("SayDistance", OSD.FromReal(m_settings.WhisperDistance));
body.Add("ShoutDistance", OSD.FromReal(m_settings.WhisperDistance));
body.Add("RenderWater", OSD.FromInteger(m_settings.RenderWater ? 1 : 0));
body.Add("TerrainDetailScale", OSD.FromReal(m_settings.TerrainDetailScale));
if (m_settings.MaximumInventoryItemsTransfer != -1)
body.Add("MaxInventoryItemsTransfer", OSD.FromInteger(m_settings.MaximumInventoryItemsTransfer));
body.Add("AllowMinimap", OSD.FromInteger(m_settings.DisplayMinimap ? 1 : 0));
body.Add("AllowPhysicalPrims", OSD.FromInteger(m_settings.AllowPhysicalPrims ? 1 : 0));
body.Add("OffsetOfUTC", OSD.FromInteger(m_settings.OffsetOfUTC));
body.Add("OffsetOfUTCDST", OSD.FromInteger(m_settings.OffsetOfUTCDST ? 1 : 0));
body.Add("ToggleTeenMode", OSD.FromInteger(m_settings.EnableTeenMode ? 1 : 0));
body.Add("SetTeenMode", OSD.FromInteger(m_settings.SetTeenMode ? 1 : 0));
body.Add("ShowTags", OSD.FromInteger(m_settings.ShowTags));
if (m_settings.MaxGroups != -1)
body.Add("MaxGroups", OSD.FromInteger(m_settings.MaxGroups));
body.Add("AllowParcelWindLight", OSD.FromInteger(m_settings.AllowParcelWindLight ? 1 : 0));
//Add all the generic ones
foreach (KeyValuePair<string, string> KVP in additionalKVPs)
{
body.Add(KVP.Key, OSD.FromString(KVP.Value));
}
map.Add("body", body);
map.Add("message", OSD.FromString("OpenRegionInfo"));
return map;
}
示例7: SendConsoleEventEQM
/// <summary>
/// Send a console message to the viewer
/// </summary>
/// <param name="AgentID"></param>
/// <param name="text"></param>
private void SendConsoleEventEQM(UUID AgentID, string text)
{
OSDMap item = new OSDMap ();
item.Add ("body", text);
item.Add ("message", OSD.FromString ("SimConsoleResponse"));
IEventQueueService eq = m_scenes[0].RequestModuleInterface<IEventQueueService> ();
if (eq != null)
eq.Enqueue (item, AgentID, findScene(AgentID).RegionInfo.RegionHandle);
}
示例8: OpenRegionInfo
public OSD OpenRegionInfo()
{
OSDMap map = new OSDMap();
OSDMap body = new OSDMap();
if (m_settings.MaxDragDistance != -1)
body.Add("MaxDragDistance", OSD.FromReal(m_settings.MaxDragDistance));
if (m_settings.DefaultDrawDistance != -1)
{
body.Add("DrawDistance", OSD.FromReal(m_settings.DefaultDrawDistance));
body.Add("ForceDrawDistance", OSD.FromInteger(m_settings.ForceDrawDistance ? 1 : 0));
}
if (m_settings.MaximumPrimScale != -1)
body.Add("MaxPrimScale", OSD.FromReal(m_settings.MaximumPrimScale));
if (m_settings.MinimumPrimScale != -1)
body.Add("MinPrimScale", OSD.FromReal(m_settings.MinimumPrimScale));
if (m_settings.MaximumPhysPrimScale != -1)
body.Add("MaxPhysPrimScale", OSD.FromReal(m_settings.MaximumPhysPrimScale));
if (m_settings.MaximumHollowSize != -1)
body.Add("MaxHollowSize", OSD.FromReal(m_settings.MaximumHollowSize));
if (m_settings.MinimumHoleSize != -1)
body.Add("MinHoleSize", OSD.FromReal(m_settings.MinimumHoleSize));
body.Add("EnforceMaxBuild", OSD.FromInteger(m_settings.ClampPrimSizes ? 1 : 0));
if (m_settings.MaximumLinkCount != -1)
body.Add("MaxLinkCount", OSD.FromInteger(m_settings.MaximumLinkCount));
if (m_settings.MaximumLinkCountPhys != -1)
body.Add("MaxLinkCountPhys", OSD.FromInteger(m_settings.MaximumLinkCountPhys));
body.Add("LSLFunctions", m_settings.LSLCommands);
body.Add("WhisperDistance", OSD.FromReal(m_settings.WhisperDistance));
body.Add("SayDistance", OSD.FromReal(m_settings.WhisperDistance));
body.Add("ShoutDistance", OSD.FromReal(m_settings.WhisperDistance));
body.Add("RenderWater", OSD.FromInteger(m_settings.RenderWater ? 1 : 0));
if (m_settings.MaximumInventoryItemsTransfer != -1)
body.Add("MaxInventoryItemsTransfer", OSD.FromInteger(m_settings.MaximumInventoryItemsTransfer));
body.Add("AllowMinimap", OSD.FromInteger(m_settings.DisplayMinimap ? 1 : 0));
body.Add("AllowPhysicalPrims", OSD.FromInteger(m_settings.AllowPhysicalPrims ? 1 : 0));
body.Add("OffsetOfUTC", OSD.FromInteger (m_settings.OffsetOfUTC));
body.Add("OffsetOfUTCDST", OSD.FromInteger(m_settings.OffsetOfUTCDST ? 1 : 0));
body.Add("ToggleTeenMode", OSD.FromInteger(m_settings.EnableTeenMode ? 1 : 0));
body.Add("SetTeenMode", OSD.FromInteger(m_settings.SetTeenMode ? 1 : 0));
body.Add("ShowTags", OSD.FromInteger(m_settings.ShowTags));
if (m_settings.MaxGroups != -1)
body.Add("MaxGroups", OSD.FromInteger(m_settings.MaxGroups));
body.Add("AllowParcelWindLight", OSD.FromInteger(m_settings.AllowParcelWindLight ? 1 : 0));
//Add all the generic ones
foreach (KeyValuePair<string, string> KVP in additionalKVPs)
{
body.Add(KVP.Key, OSD.FromString(KVP.Value));
}
map.Add("body", body);
map.Add("message", OSD.FromString("OpenRegionInfo"));
return map;
}
示例9: AddToQueue
private bool AddToQueue(OSD ev, UUID avatarID, ulong regionHandle, bool async)
{
//m_log.DebugFormat("[EVENTQUEUE]: Enqueuing event for {0} in region {1}", avatarID, m_scene.RegionInfo.RegionName);
if (ev == null)
return false;
try
{
lock (m_eventsNotSentPasswordDoesNotExist)
{
//Make sure these exist
if (!m_eventsNotSentPasswordDoesNotExist.ContainsKey(avatarID))
m_eventsNotSentPasswordDoesNotExist.Add(avatarID, new EventQueueClient());
}
UUID Password;
if (!FindAndPopulateEQMPassword(avatarID, regionHandle, out Password))
{
lock (m_eventsNotSentPasswordDoesNotExist)
{
m_eventsNotSentPasswordDoesNotExist[avatarID].AddNewEvent(regionHandle, OSDParser.SerializeLLSDXmlString(ev));
}
m_log.Info("[EventQueueServiceConnector]: Could not find password for agent " + avatarID +
", all Caps will fail if this is not resolved!");
return false;
}
OSDMap request = new OSDMap();
request.Add("AgentID", avatarID);
request.Add("RegionHandle", regionHandle);
request.Add("Password", Password);
OSDArray events = new OSDArray();
//Note: we HAVE to convert it to xml, otherwise things like byte[] arrays will not be passed through correctly!
events.Add(OSDParser.SerializeLLSDXmlString(ev)); //Add this event
//Clear the queue above if the password was just found now
//Fire all of them sync for now... if this becomes a large problem, we can deal with it later
lock (m_eventsNotSentPasswordDoesNotExist)
{
foreach (OSD EQMessage in m_eventsNotSentPasswordDoesNotExist[avatarID].GetEvents(regionHandle))
{
try
{
if (EQMessage == null)
continue;
//We do NOT enqueue disable simulator as it will kill things badly, and they get in here
// because we can't
OSDMap map = (OSDMap)OSDParser.DeserializeLLSDXml(EQMessage.AsString());
if (!map.ContainsKey("message") || (map.ContainsKey("message") && map["message"] != "DisableSimulator"))
events.Add(EQMessage);
else
m_log.Warn("[EventQueueServicesConnector]: Found DisableSimulator in the not sent queue, not sending");
}
catch (Exception e)
{
m_log.Error("[EVENTQUEUE] Caught event not found exception: " + e.ToString());
return false;
}
}
//Clear it for now... we'll readd if it fails
m_eventsNotSentPasswordDoesNotExist[avatarID].ClearEvents(regionHandle);
}
request.Add("Events", events);
List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(avatarID.ToString(), "EventQueueServiceURI");
foreach (string serverURI in serverURIs)
{
if (async)
{
AsynchronousRestObjectRequester.MakeRequest("POST", serverURI + "/CAPS/EQMPOSTER",
OSDParser.SerializeJsonString(request),
delegate(string resp)
{
return RequestHandler(resp, events, avatarID, regionHandle);
});
return true;
}
else
{
string resp = SynchronousRestFormsRequester.MakeRequest("POST", serverURI + "/CAPS/EQMPOSTER",
OSDParser.SerializeJsonString(request));
return RequestHandler(resp, events, avatarID, regionHandle);
}
}
}
catch (Exception e)
{
m_log.Error("[EVENTQUEUE] Caught exception: " + e.ToString());
}
return false;
}
示例10: SaveAsset
private void SaveAsset(UUID AssetID, OSDMap assetMap)
{
AssetBase asset = AssetService.Get(AssetID.ToString());
if (asset != null)
{
OSDMap assetData = new OSDMap();
m_log.Info("[AvatarArchive]: Saving asset " + asset.ID);
CreateMetaDataMap(asset.Metadata, assetData);
assetData.Add("AssetData", OSD.FromBinary(asset.Data));
assetMap.Add(asset.ID, assetData);
}
}
示例11: ToOSD
public override OSDMap ToOSD()
{
OSDMap body = new OSDMap();
body.Add("MaxDragDistance", OSD.FromReal(MaxDragDistance));
body.Add("DrawDistance", OSD.FromReal(DefaultDrawDistance));
body.Add("ForceDrawDistance", OSD.FromInteger(ForceDrawDistance ? 1 : 0));
body.Add("MaxPrimScale", OSD.FromReal(MaximumPrimScale));
body.Add("MinPrimScale", OSD.FromReal(MinimumPrimScale));
body.Add("MaxPhysPrimScale", OSD.FromReal(MaximumPhysPrimScale));
body.Add("MaxHollowSize", OSD.FromReal(MaximumHollowSize));
body.Add("MinHoleSize", OSD.FromReal(MinimumHoleSize));
body.Add("EnforceMaxBuild", OSD.FromInteger(ClampPrimSizes ? 1 : 0));
body.Add("MaxLinkCount", OSD.FromInteger(MaximumLinkCount));
body.Add("MaxLinkCountPhys", OSD.FromInteger(MaximumLinkCountPhys));
body.Add("LSLFunctions", LSLCommands);
body.Add("RenderWater", OSD.FromInteger(RenderWater ? 1 : 0));
body.Add("MaxInventoryItemsTransfer", OSD.FromInteger(MaximumInventoryItemsTransfer));
body.Add("AllowMinimap", OSD.FromInteger(DisplayMinimap ? 1 : 0));
body.Add("AllowPhysicalPrims", OSD.FromInteger(AllowPhysicalPrims ? 1 : 0));
body.Add("OffsetOfUTC", OSD.FromInteger(OffsetOfUTC));
body.Add("OffsetOfUTCDST", OSD.FromInteger(OffsetOfUTCDST ? 1 : 0));
body.Add("ToggleTeenMode", OSD.FromInteger(EnableTeenMode ? 1 : 0));
body.Add("SetTeenMode", OSD.FromInteger(SetTeenMode ? 1 : 0));
body.Add("ShowTags", OSD.FromInteger(ShowTags));
body.Add("MaxGroups", OSD.FromInteger(MaxGroups));
body.Add("AllowParcelWindLight", OSD.FromInteger(AllowParcelWindLight ? 1 : 0));
return body;
}
示例12: HandleSaveAvatarArchive
protected void HandleSaveAvatarArchive(string module, string[] cmdparams)
{
if (cmdparams.Length != 7)
{
m_log.Debug("[AvatarArchive] Not enough parameters!");
}
UserAccount account = UserAccountService.GetUserAccount(UUID.Zero, cmdparams[3], cmdparams[4]);
if (account == null)
{
m_log.Error("[AvatarArchive] User not found!");
return;
}
AvatarData avatarData = AvatarService.GetAvatar(account.PrincipalID);
AvatarAppearance appearance = avatarData.ToAvatarAppearance(account.PrincipalID);
OSDMap map = new OSDMap();
OSDMap body = new OSDMap();
OSDMap assets = new OSDMap();
OSDMap items = new OSDMap();
body = appearance.Pack();
foreach (AvatarWearable wear in appearance.Wearables)
{
for (int i = 0; i < wear.Count; i++)
{
WearableItem w = wear[i];
if (w.AssetID != UUID.Zero)
{
SaveAsset(w.AssetID, assets);
SaveItem(w.ItemID, items);
}
}
}
List<AvatarAttachment> attachments = appearance.GetAttachments();
foreach (AvatarAttachment a in attachments)
{
SaveAsset(a.AssetID, assets);
SaveItem(a.ItemID, items);
}
map.Add("Body", body);
map.Add("Assets", assets);
map.Add("Items", items);
//Write the map
if (cmdparams[5].EndsWith(".database"))
{
//Remove the .database
string ArchiveName = cmdparams[5].Substring(0, cmdparams[5].Length - 9);
string ArchiveXML = OSDParser.SerializeLLSDXmlString(map);
AvatarArchive archive = new AvatarArchive();
archive.ArchiveXML = ArchiveXML;
archive.Name = ArchiveName;
DataManager.RequestPlugin<IAvatarArchiverConnector>().SaveAvatarArchive(archive);
m_log.Debug("[AvatarArchive] Saved archive to database " + cmdparams[5]);
}
else
{
StreamWriter writer = new StreamWriter(cmdparams[5]);
writer.Write(OSDParser.SerializeLLSDXmlString(map));
writer.Close();
writer.Dispose();
m_log.Debug("[AvatarArchive] Saved archive to " + cmdparams[5]);
}
}
示例13: DisplayNameUpdate
/// <summary>
/// Tell the user about an update
/// </summary>
/// <param name = "newDisplayName"></param>
/// <param name = "oldDisplayName"></param>
/// <param name = "ID"></param>
/// <param name = "isDefault"></param>
/// <param name = "First"></param>
/// <param name = "Last"></param>
/// <param name = "Account"></param>
/// <returns></returns>
public OSD DisplayNameUpdate(string newDisplayName, string oldDisplayName, UUID ID, bool isDefault, string First,
string Last, string Account)
{
OSDMap nameReply = new OSDMap {{"message", OSD.FromString("DisplayNameUpdate")}};
OSDMap body = new OSDMap();
OSDMap agentData = new OSDMap
{
{"display_name", OSD.FromString(newDisplayName)},
{
"display_name_next_update", OSD.FromDate(
DateTime.ParseExact("1970-01-01 00:00:00 +0", "yyyy-MM-dd hh:mm:ss z",
DateTimeFormatInfo.InvariantInfo).ToUniversalTime())
},
{"id", OSD.FromUUID(ID)},
{"is_display_name_default", OSD.FromBoolean(isDefault)},
{"legacy_first_name", OSD.FromString(First)},
{"legacy_last_name", OSD.FromString(Last)},
{"username", OSD.FromString(Account)}
};
body.Add("agent", agentData);
body.Add("agent_id", OSD.FromUUID(ID));
body.Add("old_display_name", OSD.FromString(oldDisplayName));
nameReply.Add("body", body);
return nameReply;
}
示例14: HandleSaveAvatarArchive
protected void HandleSaveAvatarArchive(string module, string[] cmdparams)
{
if (cmdparams.Length != 7)
{
m_log.Debug("[AvatarArchive] Not enough parameters!");
}
UserAccount account = UserAccountService.GetUserAccount(UUID.Zero, cmdparams[3], cmdparams[4]);
if (account == null)
{
m_log.Error("[AvatarArchive] User not found!");
return;
}
AvatarData avatarData = AvatarService.GetAvatar(account.PrincipalID);
AvatarAppearance appearance = avatarData.ToAvatarAppearance(account.PrincipalID);
OSDMap map = new OSDMap();
OSDMap body = new OSDMap();
OSDMap assets = new OSDMap();
OSDMap items = new OSDMap();
body.Add("AvatarHeight", OSD.FromReal(appearance.AvatarHeight));
body.Add("BodyAsset", OSD.FromUUID(appearance.BodyAsset));
body.Add("BodyItem", OSD.FromUUID(appearance.BodyItem));
body.Add("EyesAsset", OSD.FromUUID(appearance.EyesAsset));
body.Add("EyesItem", OSD.FromUUID(appearance.EyesItem));
body.Add("GlovesAsset", OSD.FromUUID(appearance.GlovesAsset));
body.Add("GlovesItem", OSD.FromUUID(appearance.GlovesItem));
body.Add("HairAsset", OSD.FromUUID(appearance.HairAsset));
body.Add("HairItem", OSD.FromUUID(appearance.HairItem));
body.Add("HipOffset", OSD.FromReal(appearance.HipOffset));
body.Add("JacketAsset", OSD.FromUUID(appearance.JacketAsset));
body.Add("JacketItem", OSD.FromUUID(appearance.JacketItem));
body.Add("Owner", OSD.FromUUID(appearance.Owner));
body.Add("PantsAsset", OSD.FromUUID(appearance.PantsAsset));
body.Add("Serial", OSD.FromInteger(appearance.Serial));
body.Add("ShirtAsset", OSD.FromUUID(appearance.ShirtAsset));
body.Add("ShirtItem", OSD.FromUUID(appearance.ShirtItem));
body.Add("ShoesAsset", OSD.FromUUID(appearance.ShoesAsset));
body.Add("ShoesItem", OSD.FromUUID(appearance.ShoesItem));
body.Add("SkinAsset", OSD.FromUUID(appearance.SkinAsset));
body.Add("SkirtAsset", OSD.FromUUID(appearance.SkirtAsset));
body.Add("SkirtItem", OSD.FromUUID(appearance.SkirtItem));
body.Add("SocksAsset", OSD.FromUUID(appearance.SocksAsset));
body.Add("SocksItem", OSD.FromUUID(appearance.SocksItem));
body.Add("UnderPantsAsset", OSD.FromUUID(appearance.UnderPantsAsset));
body.Add("UnderPantsItem", OSD.FromUUID(appearance.UnderPantsItem));
body.Add("UnderShirtAsset", OSD.FromUUID(appearance.UnderShirtAsset));
body.Add("UnderShirtItem", OSD.FromUUID(appearance.UnderShirtItem));
body.Add("TattooAsset", OSD.FromUUID(appearance.TattooAsset));
body.Add("TattooItem", OSD.FromUUID(appearance.TattooItem));
body.Add("AlphaAsset", OSD.FromUUID(appearance.AlphaAsset));
body.Add("AlphaItem", OSD.FromUUID(appearance.AlphaItem));
body.Add("FolderName", OSD.FromString(cmdparams[6]));
body.Add("VisualParams", OSD.FromBinary(appearance.VisualParams));
OSDArray wearables = new OSDArray();
foreach (AvatarWearable wear in appearance.Wearables)
{
OSDMap wearable = new OSDMap();
if (wear.AssetID != UUID.Zero)
{
SaveAsset(wear.AssetID, assets);
SaveItem(wear.ItemID, items);
}
wearable.Add("Asset", wear.AssetID);
wearable.Add("Item", wear.ItemID);
wearables.Add(wearable);
}
body.Add("AvatarWearables", wearables);
body.Add("Texture", appearance.Texture.GetOSD());
OSDArray attachmentsArray = new OSDArray();
Hashtable attachments = appearance.GetAttachments();
if (attachments != null)
{
foreach (DictionaryEntry element in attachments)
{
Hashtable attachInfo = (Hashtable)element.Value;
InventoryItemBase IB = new InventoryItemBase(UUID.Parse(attachInfo["item"].ToString()));
OSDMap attachment = new OSDMap();
SaveAsset(IB.AssetID, assets);
SaveItem(UUID.Parse(attachInfo["item"].ToString()), items);
attachment.Add("Asset", OSD.FromUUID(IB.AssetID));
attachment.Add("Item", OSD.FromUUID(UUID.Parse(attachInfo["item"].ToString())));
attachment.Add("Point", OSD.FromInteger((int)element.Key));
attachmentsArray.Add(attachment);
}
}
body.Add("Attachments", attachmentsArray);
map.Add("Body", body);
map.Add("Assets", assets);
map.Add("Items", items);
//Write the map
if (cmdparams[5].EndsWith(".database"))
{
//Remove the .database
//.........这里部分代码省略.........
示例15: HandleFetchLib
public string HandleFetchLib(string request, UUID AgentID)
{
try
{
//m_log.DebugFormat("[InventoryCAPS]: Received FetchLib request for {0}", AgentID);
OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(OpenMetaverse.Utils.StringToBytes(request));
OSDArray foldersrequested = (OSDArray)requestmap["items"];
string response = "";
OSDMap map = new OSDMap();
map.Add("agent_id", OSD.FromUUID(AgentID));
OSDArray items = new OSDArray();
for (int i = 0; i < foldersrequested.Count; i++)
{
OSDMap requestedFolders = (OSDMap)foldersrequested[i];
UUID owner_id = requestedFolders["owner_id"].AsUUID();
UUID item_id = requestedFolders["item_id"].AsUUID();
InventoryItemBase item = null;
if (m_libraryService != null && m_libraryService.LibraryRootFolder != null)
{
item = m_libraryService.LibraryRootFolder.FindItem(item_id);
}
if (item == null) //Try normal inventory them
item = m_inventoryService.GetItem(new InventoryItemBase(item_id, owner_id));
if (item != null)
{
items.Add(ConvertInventoryItem(item, owner_id));
}
}
map.Add("items", items);
response = OSDParser.SerializeLLSDXmlString(map);
return response;
}
catch (Exception ex)
{
m_log.Warn("[InventoryCaps]: SERIOUS ISSUE! " + ex.ToString());
}
OSDMap rmap = new OSDMap();
rmap["folders"] = new OSDArray();
return OSDParser.SerializeLLSDXmlString(rmap);
}