本文整理汇总了C#中OpenSim.Framework.Capabilities.OSDMap类的典型用法代码示例。如果您正苦于以下问题:C# OSDMap类的具体用法?C# OSDMap怎么用?C# OSDMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OSDMap类属于OpenSim.Framework.Capabilities命名空间,在下文中一共展示了OSDMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SimulatorFeaturesCAP
private Hashtable SimulatorFeaturesCAP (Hashtable mDhttpMethod)
{
//OSDMap rm = (OSDMap)OSDParser.DeserializeLLSDXml((string)mDhttpMethod["requestbody"]);
OSDMap data = new OSDMap ();
data["MeshRezEnabled"] = true;
data["MeshUploadEnabled"] = true;
data["MeshXferEnabled"] = true;
data["PhysicsMaterialsEnabled"] = true;
OSDMap typesMap = new OSDMap ();
typesMap["convex"] = true;
typesMap["none"] = true;
typesMap["prim"] = true;
data["PhysicsShapeTypes"] = typesMap;
//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(data);
return responsedata;
}
示例2: EventManager_OnRegisterCaps
private OSDMap EventManager_OnRegisterCaps(UUID agentID, IHttpServer server)
{
OSDMap retVal = new OSDMap();
retVal["EnvironmentSettings"] = CapsUtil.CreateCAPS("EnvironmentSettings", "");
#if (!ISWIN)
//Sets the windlight settings
server.AddStreamHandler(new RestHTTPHandler("POST", retVal["EnvironmentSettings"],
delegate(Hashtable m_dhttpMethod)
{
return SetEnvironment(m_dhttpMethod, agentID);
}));
//Sets the windlight settings
server.AddStreamHandler(new RestHTTPHandler("GET", retVal["EnvironmentSettings"],
delegate(Hashtable m_dhttpMethod)
{
return EnvironmentSettings(m_dhttpMethod, agentID);
}));
#else
//Sets the windlight settings
server.AddStreamHandler(new RestHTTPHandler("POST", retVal["EnvironmentSettings"],
m_dhttpMethod => SetEnvironment(m_dhttpMethod, agentID)));
//Sets the windlight settings
server.AddStreamHandler(new RestHTTPHandler("GET", retVal["EnvironmentSettings"],
m_dhttpMethod => EnvironmentSettings(m_dhttpMethod, agentID)));
#endif
return retVal;
}
示例3: RegisterCaps
public OSDMap RegisterCaps (UUID agentID, IHttpServer server)
{
OSDMap retVal = new OSDMap ();
retVal["SimulatorFeatures"] = CapsUtil.CreateCAPS ("SimulatorFeatures", "");
server.AddStreamHandler (new RestHTTPHandler ("GET", retVal["SimulatorFeatures"],
delegate (Hashtable m_dhttpMethod)
{
return SimulatorFeaturesCAP (m_dhttpMethod);
}));
return retVal;
}
示例4: RegisterCaps
public OSDMap RegisterCaps(UUID agentID, IHttpServer server)
{
OSDMap retVal = new OSDMap();
retVal["ObjectAdd"] = CapsUtil.CreateCAPS("ObjectAdd", "");
server.AddStreamHandler(new RestHTTPHandler("POST", retVal["ObjectAdd"],
delegate(Hashtable m_dhttpMethod)
{
return ProcessAdd(m_dhttpMethod, agentID);
}));
retVal["ServerReleaseNotes"] = CapsUtil.CreateCAPS("ServerReleaseNotes", "");
server.AddStreamHandler(new RestHTTPHandler("POST", retVal["ServerReleaseNotes"],
delegate(Hashtable m_dhttpMethod)
{
return ProcessServerReleaseNotes(m_dhttpMethod, agentID);
}));
return retVal;
}
示例5: RegisterCaps
/// <summary>
/// Set up the CAPS for display names
/// </summary>
/// <param name="agentID"></param>
/// <param name="caps"></param>
public OSDMap RegisterCaps(UUID agentID, IHttpServer server)
{
OSDMap retVal = new OSDMap();
retVal["SetDisplayName"] = CapsUtil.CreateCAPS("SetDisplayName", "");
server.AddStreamHandler(new RestHTTPHandler("POST", retVal["SetDisplayName"],
delegate(Hashtable m_dhttpMethod)
{
return ProcessSetDisplayName(m_dhttpMethod, agentID);
}));
retVal["GetDisplayNames"] = CapsUtil.CreateCAPS("GetDisplayNames", "");
server.AddStreamHandler(new RestHTTPHandler("POST", retVal["GetDisplayNames"],
delegate(Hashtable m_dhttpMethod)
{
return ProcessGetDisplayName(m_dhttpMethod, agentID);
}));
return retVal;
}
示例6: MeshUploadFlagCAP
private Hashtable MeshUploadFlagCAP(Hashtable mDhttpMethod)
{
OSDMap data = new OSDMap();
UserAccount acct = m_userService.GetUserAccount(UUID.Zero, m_service.AgentID);
IUserProfileInfo info = m_profileConnector.GetUserProfile(m_service.AgentID);
data["id"] = m_service.AgentID;
data["username"] = acct.Name;
data["display_name"] = info.DisplayName;
data["display_name_next_update"] = Utils.UnixTimeToDateTime(0);
data["legacy_first_name"] = acct.FirstName;
data["legacy_last_name"] = acct.LastName;
data["mesh_upload_status"] = "valid"; // add if account has ability to upload mesh?
bool isDisplayNameNDefault = (info.DisplayName == acct.Name) || (info.DisplayName == acct.FirstName + "." + acct.LastName);
data["is_display_name_default"] = isDisplayNameNDefault;
//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(data);
return responsedata;
}
示例7: LoadAssets
private void LoadAssets(OSDMap assets, AvatarAppearance appearance)
{
foreach (KeyValuePair<string, OSD> kvp in assets)
{
UUID AssetID = UUID.Parse(kvp.Key);
OSDMap assetMap = (OSDMap)kvp.Value;
AssetBase asset = AssetService.Get(AssetID.ToString());
m_log.Info("[AvatarArchive]: Loading asset " + AssetID.ToString());
if (asset == null) //Don't overwrite
{
asset = LoadAssetBase(assetMap);
UUID oldassetID = asset.ID;
UUID newAssetID = AssetService.Store(asset);
asset.ID = newAssetID;
//Fix the IDs
AvatarWearable[] wearables = new AvatarWearable[appearance.Wearables.Length];
appearance.Wearables.CopyTo(wearables, 0);
for (int a = 0; a < wearables.Length; a++)
{
for (int i = 0; i < wearables[a].Count; i++)
{
if (wearables[a][i].AssetID == oldassetID)
{
//Fix the ItemID
AvatarWearable w = wearables[a];
UUID itemID = w.GetItem(oldassetID);
w.RemoveItem(oldassetID);
w.Add(itemID, newAssetID);
appearance.SetWearable(a, w);
break;
}
}
}
}
}
}
示例8: SaveItem
private void SaveItem(UUID ItemID, OSDMap itemMap, OSDMap assets)
{
InventoryItemBase saveItem = InventoryService.GetItem(new InventoryItemBase(ItemID));
if (saveItem == null)
{
m_log.Warn("[AvatarArchive]: Could not find item to save: " + ItemID.ToString());
return;
}
m_log.Info("[AvatarArchive]: Saving item " + ItemID.ToString());
string serialization = OpenSim.Framework.Serialization.External.UserInventoryItemSerializer.Serialize(saveItem);
itemMap[ItemID.ToString()] = OSD.FromString(serialization);
SaveAsset(saveItem.AssetID, assets);
}
示例9: LoadAssetBase
private AssetBase LoadAssetBase(OSDMap map)
{
AssetBase asset = new AssetBase();
asset.Data = map["AssetData"].AsBinary();
asset.TypeString = map["ContentType"].AsString();
asset.CreationDate = map["CreationDate"].AsDate();
asset.CreatorID = map["CreatorID"].AsUUID();
asset.Description = map["Description"].AsString();
asset.ID = map["ID"].AsUUID();
asset.Name = map["Name"].AsString();
asset.Type = map["Type"].AsInteger();
return asset;
}
示例10: CreateMetaDataMap
private void CreateMetaDataMap(AssetBase data, OSDMap map)
{
map["ContentType"] = OSD.FromString(data.TypeString);
map["CreationDate"] = OSD.FromDate(data.CreationDate);
map["CreatorID"] = OSD.FromUUID(data.CreatorID);
map["Description"] = OSD.FromString(data.Description);
map["ID"] = OSD.FromUUID(data.ID);
map["Name"] = OSD.FromString(data.Name);
map["Type"] = OSD.FromInteger(data.Type);
}
示例11: HandleInventoryItemCreate
public string HandleInventoryItemCreate(string request, UUID AgentID)
{
OSDMap map = (OSDMap)OSDParser.DeserializeLLSDXml(request);
string asset_type = map["asset_type"].AsString();
//m_log.Info("[CAPS]: NewAgentInventoryRequest Request is: " + map.ToString());
//m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type);
if (asset_type == "texture" ||
asset_type == "animation" ||
asset_type == "sound")
{
/* Disabled until we have a money module that can hook up to this
* IMoneyModule mm = .RequestModuleInterface<IMoneyModule>();
if (mm != null)
{
if (!mm.UploadCovered(client, mm.UploadCharge))
{
if (client != null)
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
map = new OSDMap();
map["uploader"] = "";
map["state"] = "error";
return OSDParser.SerializeLLSDXmlString(map);
}
else
mm.ApplyUploadCharge(client.AgentId, mm.UploadCharge, "Upload asset.");
}
*/
}
string assetName = map["name"].AsString();
string assetDes = map["description"].AsString();
UUID parentFolder = map["folder_id"].AsUUID();
string inventory_type = map["inventory_type"].AsString();
UUID newAsset = UUID.Random();
UUID newInvItem = UUID.Random();
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
string uploadpath = m_service.CreateCAPS("Upload" + uploaderPath, uploaderPath);
AssetUploader uploader =
new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, inventory_type,
asset_type, uploadpath, "Upload" + uploaderPath, m_service, this);
m_service.AddStreamHandler("Upload" + uploaderPath,
new BinaryStreamHandler("POST", uploadpath, uploader.uploaderCaps));
string uploaderURL = m_service.HostUri + uploadpath;
map = new OSDMap();
map["uploader"] = uploaderURL;
map["state"] = "upload";
return OSDParser.SerializeLLSDXmlString(map);
}
示例12: OnChatSessionRequest
private string OnChatSessionRequest(UUID Agent, OSDMap rm)
{
string method = rm["method"].AsString();
UUID sessionid = UUID.Parse(rm["session-id"].AsString());
IScenePresence SP = findScenePresence(Agent);
IEventQueueService eq = SP.Scene.RequestModuleInterface<IEventQueueService>();
if (method == "start conference")
{
//Create the session.
CreateSession(new ChatSession
{
Members = new List<ChatSessionMember>(),
SessionID = sessionid,
Name = SP.Name + " Conference"
});
OSDArray parameters = (OSDArray) rm["params"];
//Add other invited members.
foreach (OSD param in parameters)
{
AddDefaultPermsMemberToSession(param.AsUUID(), sessionid);
}
//Add us to the session!
AddMemberToGroup(new ChatSessionMember
{
AvatarKey = Agent,
CanVoiceChat = true,
IsModerator = true,
MuteText = false,
MuteVoice = false,
HasBeenAdded = true
}, sessionid);
//Inform us about our room
ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block =
new ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock
{
AgentID = Agent,
CanVoiceChat = true,
IsModerator = true,
MuteText = false,
MuteVoice = false,
Transition = "ENTER"
};
eq.ChatterBoxSessionAgentListUpdates(sessionid, new[] {block}, Agent, "ENTER",
findScene(Agent).RegionInfo.RegionHandle);
ChatterBoxSessionStartReplyMessage cs = new ChatterBoxSessionStartReplyMessage
{
VoiceEnabled = true,
TempSessionID = UUID.Random(),
Type = 1,
Success = true,
SessionID = sessionid,
SessionName = SP.Name + " Conference",
ModeratedVoice = true
};
return cs.Serialize().ToString();
}
else if (method == "accept invitation")
{
//They would like added to the group conversation
List<ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock> Us =
new List<ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock>();
List<ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock> NotUsAgents =
new List<ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock>();
ChatSession session = GetSession(sessionid);
if (session != null)
{
ChatSessionMember thismember = FindMember(sessionid, Agent);
//Tell all the other members about the incoming member
foreach (ChatSessionMember sessionMember in session.Members)
{
ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block =
new ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock
{
AgentID = sessionMember.AvatarKey,
CanVoiceChat = sessionMember.CanVoiceChat,
IsModerator = sessionMember.IsModerator,
MuteText = sessionMember.MuteText,
MuteVoice = sessionMember.MuteVoice,
Transition = "ENTER"
};
if (sessionMember.AvatarKey == thismember.AvatarKey)
Us.Add(block);
else
{
if (sessionMember.HasBeenAdded)
// Don't add not joined yet agents. They don't want to be here.
NotUsAgents.Add(block);
}
}
thismember.HasBeenAdded = true;
//.........这里部分代码省略.........
示例13: 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);
}
}
示例14: ProcessServerReleaseNotes
private Hashtable ProcessServerReleaseNotes(Hashtable m_dhttpMethod, UUID agentID)
{
Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 200; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
OSDMap osd = new OSDMap();
osd.Add("ServerReleaseNotes", new OSDString(Aurora.Framework.Utilities.GetServerReleaseNotesURL()));
string response = OSDParser.SerializeLLSDXmlString(osd);
responsedata["str_response_string"] = response;
return responsedata;
}
示例15: OnMessageReceived
protected OSDMap OnMessageReceived(OSDMap message)
{
if (!message.ContainsKey("Method"))
return null;
UUID AgentID = message["AgentID"].AsUUID();
ulong requestingRegion = message["RequestingRegion"].AsULong();
ICapsService capsService = m_registry.RequestModuleInterface<ICapsService>();
if (capsService == null)
{
//m_log.Info("[AgentProcessing]: Failed OnMessageReceived ICapsService is null");
return new OSDMap();
}
IClientCapsService clientCaps = capsService.GetClientCapsService(AgentID);
IRegionClientCapsService regionCaps = null;
if (clientCaps != null)
regionCaps = clientCaps.GetCapsService(requestingRegion);
if (message["Method"] == "LogoutRegionAgents")
{
LogOutAllAgentsForRegion(requestingRegion);
}
else if (message["Method"] == "RegionIsOnline") //This gets fired when the scene is fully finished starting up
{
//Log out all the agents first, then add any child agents that should be in this region
LogOutAllAgentsForRegion(requestingRegion);
IGridService GridService = m_registry.RequestModuleInterface<IGridService>();
if (GridService != null)
{
int x, y;
Util.UlongToInts(requestingRegion, out x, out y);
GridRegion requestingGridRegion = GridService.GetRegionByPosition(UUID.Zero, x, y);
if (requestingGridRegion != null)
EnableChildAgentsForRegion(requestingGridRegion);
}
}
else if (message["Method"] == "DisableSimulator")
{
//KILL IT!
if (regionCaps == null || clientCaps == null)
return null;
IEventQueueService eventQueue = m_registry.RequestModuleInterface<IEventQueueService> ();
eventQueue.DisableSimulator (regionCaps.AgentID, regionCaps.RegionHandle);
//regionCaps.Close();
//clientCaps.RemoveCAPS(requestingRegion);
}
else if (message["Method"] == "ArrivedAtDestination")
{
if (regionCaps == null || clientCaps == null)
return null;
//Recieved a callback
if (clientCaps.InTeleport) //Only set this if we are in a teleport,
// otherwise (such as on login), this won't check after the first tp!
clientCaps.CallbackHasCome = true;
regionCaps.Disabled = false;
//The agent is getting here for the first time (eg. login)
OSDMap body = ((OSDMap)message["Message"]);
//Parse the OSDMap
int DrawDistance = body["DrawDistance"].AsInteger();
AgentCircuitData circuitData = new AgentCircuitData();
circuitData.UnpackAgentCircuitData((OSDMap)body["Circuit"]);
//Now do the creation
EnableChildAgents(AgentID, requestingRegion, DrawDistance, circuitData);
}
else if (message["Method"] == "CancelTeleport")
{
if (regionCaps == null || clientCaps == null)
return null;
//Only the region the client is root in can do this
IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService ();
if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle)
{
//The user has requested to cancel the teleport, stop them.
clientCaps.RequestToCancelTeleport = true;
regionCaps.Disabled = false;
}
}
else if (message["Method"] == "AgentLoggedOut")
{
//ONLY if the agent is root do we even consider it
if (regionCaps != null)
{
if (regionCaps.RootAgent)
{
LogoutAgent(regionCaps);
}
}
}
else if (message["Method"] == "SendChildAgentUpdate")
{
if (regionCaps == null || clientCaps == null)
return null;
IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService ();
if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle)
{
//.........这里部分代码省略.........