本文整理汇总了C#中OpenMetaverse.StructuredData.OSDMap.Add方法的典型用法代码示例。如果您正苦于以下问题:C# OSDMap.Add方法的具体用法?C# OSDMap.Add怎么用?C# OSDMap.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenMetaverse.StructuredData.OSDMap
的用法示例。
在下文中一共展示了OSDMap.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDisplayable
/// <summary>
/// A statistics collection returns an OSD structure which is a map
/// of maps. The top level map are the individual counters and
/// their value is a map of the variables that make up the counter.
/// </summary>
/// <returns></returns>
public OMVSD.OSDMap GetDisplayable()
{
OMVSD.OSDMap values = new OMVSD.OSDMap();
foreach (ICounter cntr in m_counters) {
try {
OMVSD.OSDMap ivals = new OMVSD.OSDMap();
ivals.Add("count", new OMVSD.OSDInteger((int)cntr.Count));
if (cntr is IIntervalCounter) {
IIntervalCounter icntr = (IIntervalCounter)cntr;
ivals.Add("average", new OMVSD.OSDInteger((int)icntr.Average));
ivals.Add("low", new OMVSD.OSDInteger((int)icntr.Low));
ivals.Add("high", new OMVSD.OSDInteger((int)icntr.High));
ivals.Add("last", new OMVSD.OSDInteger((int)icntr.Last));
ivals.Add("total", new OMVSD.OSDInteger((int)icntr.Total));
}
values.Add(cntr.Name, ivals);
}
catch (Exception e) {
Logging.LogManager.Log.Log(LookingGlass.Framework.Logging.LogLevel.DBADERROR,
"FAILURE getting Displayable value: n={0}, {1}", cntr.Name, e.ToString());
}
}
return values;
}
示例2: GetDisplayable
/// <summary>
/// The parameterset values can change because of teh delgates. This returns a current
/// view of teh parameterset.
/// </summary>
/// <returns></returns>
public OMVSD.OSDMap GetDisplayable()
{
try {
OMVSD.OSDMap built = new OMVSD.OSDMap();
lock (m_params) {
this.ForEach(delegate(string k, OMVSD.OSD v) {
OMVSD.OSDMap valueMap = new OMVSD.OSDMap();
valueMap.Add("value", v);
if (m_paramDescription.ContainsKey(k)) {
valueMap.Add("description", m_paramDescription[k]);
}
built.Add(k, valueMap);
});
}
return built;
}
catch (Exception e) {
LogManager.Log.Log(LogLevel.DBADERROR, "GetDisplayable: exception {0}", e.ToString());
}
return new OMVSD.OSDMap();
}
示例3: RenderJson
/// <summary>
/// Convert active connections information to JSON string. Returns a structure:
/// <pre>
/// {"regionName": {
/// "presenceName": {
/// "name": "presenceName",
/// "position": "<x,y,z>",
/// "isRoot": "false",
/// "throttle": {
/// },
/// "queue": {
/// }
/// },
/// ... // multiple presences in the scene
/// },
/// ... // multiple regions in the sim
/// }
///
/// </pre>
/// </summary>
/// <param name="pModelResult"></param>
/// <returns></returns>
public string RenderJson(Hashtable pModelResult)
{
List<Scene> all_scenes = (List<Scene>) pModelResult["hdata"];
OSDMap regionInfo = new OSDMap();
foreach (Scene scene in all_scenes)
{
OSDMap sceneInfo = new OpenMetaverse.StructuredData.OSDMap();
List<ScenePresence> avatarInScene = scene.GetScenePresences();
foreach (ScenePresence av in avatarInScene)
{
OSDMap presenceInfo = new OSDMap();
presenceInfo.Add("Name", new OSDString(av.Name));
Dictionary<string,string> queues = new Dictionary<string, string>();
if (av.ControllingClient is IStatsCollector)
{
IStatsCollector isClient = (IStatsCollector) av.ControllingClient;
queues = decodeQueueReport(isClient.Report());
}
OSDMap queueInfo = new OpenMetaverse.StructuredData.OSDMap();
foreach (KeyValuePair<string, string> kvp in queues) {
queueInfo.Add(kvp.Key, new OSDString(kvp.Value));
}
sceneInfo.Add("queues", queueInfo);
if (av.IsChildAgent)
presenceInfo.Add("isRoot", new OSDString("false"));
else
presenceInfo.Add("isRoot", new OSDString("true"));
if (av.AbsolutePosition == DefaultNeighborPosition)
{
presenceInfo.Add("position", new OSDString("<0, 0, 0>"));
}
else
{
presenceInfo.Add("position", new OSDString(string.Format("<{0},{1},{2}>",
(int)av.AbsolutePosition.X,
(int) av.AbsolutePosition.Y,
(int) av.AbsolutePosition.Z)) );
}
Dictionary<string, int> throttles = DecodeClientThrottles(av.ControllingClient.GetThrottlesPacked(1));
OSDMap throttleInfo = new OpenMetaverse.StructuredData.OSDMap();
foreach (string throttlename in throttles.Keys)
{
throttleInfo.Add(throttlename, new OSDString(throttles[throttlename].ToString()));
}
presenceInfo.Add("throttle", throttleInfo);
sceneInfo.Add(av.Name, presenceInfo);
}
regionInfo.Add(scene.RegionInfo.RegionName, sceneInfo);
}
return regionInfo.ToString();
}
示例4: 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.FromString(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;
}
示例5: 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.FromString(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;
}
示例6: GetDisplayable
public OMVSD.OSDMap GetDisplayable()
{
OMVSD.OSDMap aMap = new OMVSD.OSDMap();
aMap.Add("Name", new OMVSD.OSDString(this.Name));
aMap.Add("Total", new OMVSD.OSDInteger((int)this.TotalQueued));
aMap.Add("Current", new OMVSD.OSDInteger((int)this.CurrentQueued));
return aMap;
}
示例7: GetHandler
private OMVSD.OSD GetHandler(RestHandler handler, Uri uri, String after)
{
OMVSD.OSDMap ret = new OMVSD.OSDMap();
lock (m_avatars) {
foreach (KeyValuePair<string, IEntityAvatar> kvp in m_avatars) {
OMVSD.OSDMap oneAV = new OMVSD.OSDMap();
IEntityAvatar iav = kvp.Value;
try {
oneAV.Add("Name", new OMVSD.OSDString(iav.DisplayName));
oneAV.Add("Region", new OMVSD.OSDString(iav.RegionContext.Name.Name));
oneAV.Add("X", new OMVSD.OSDString(iav.RegionPosition.X.ToString("###0.###")));
oneAV.Add("Y", new OMVSD.OSDString(iav.RegionPosition.Y.ToString("###0.###")));
oneAV.Add("Z", new OMVSD.OSDString(iav.RegionPosition.Z.ToString("###0.###")));
float dist = 0f;
if (m_agentAV != null) {
dist = OMV.Vector3.Distance(m_agentAV.RegionPosition, iav.RegionPosition);
}
oneAV.Add("Distance", new OMVSD.OSDString(dist.ToString("###0.###")));
oneAV.Add("Flags", new OMVSD.OSDString(iav.ActivityFlags));
if (iav is LLEntityAvatar) {
OMV.Avatar av = ((LLEntityAvatar)iav).Avatar;
if (av != null) {
OMVSD.OSDMap avTextures = new OMVSD.OSDMap();
OMV.Primitive.TextureEntry texEnt = av.Textures;
if (texEnt != null) {
OMV.Primitive.TextureEntryFace[] texFaces = texEnt.FaceTextures;
if (texFaces != null) {
if (texFaces[(int)OMV.AvatarTextureIndex.HeadBaked] != null)
avTextures.Add("head", new OMVSD.OSDString(texFaces[(int)OMV.AvatarTextureIndex.HeadBaked].TextureID.ToString()));
if (texFaces[(int)OMV.AvatarTextureIndex.UpperBaked] != null)
avTextures.Add("upper", new OMVSD.OSDString(texFaces[(int)OMV.AvatarTextureIndex.UpperBaked].TextureID.ToString()));
if (texFaces[(int)OMV.AvatarTextureIndex.LowerBaked] != null)
avTextures.Add("lower", new OMVSD.OSDString(texFaces[(int)OMV.AvatarTextureIndex.LowerBaked].TextureID.ToString()));
if (texFaces[(int)OMV.AvatarTextureIndex.EyesBaked] != null)
avTextures.Add("eyes", new OMVSD.OSDString(texFaces[(int)OMV.AvatarTextureIndex.EyesBaked].TextureID.ToString()));
if (texFaces[(int)OMV.AvatarTextureIndex.HairBaked] != null)
avTextures.Add("hair", new OMVSD.OSDString(texFaces[(int)OMV.AvatarTextureIndex.HairBaked].TextureID.ToString()));
if (texFaces[(int)OMV.AvatarTextureIndex.SkirtBaked] != null)
avTextures.Add("skirt", new OMVSD.OSDString(texFaces[(int)OMV.AvatarTextureIndex.SkirtBaked].TextureID.ToString()));
oneAV.Add("LLtextures", avTextures);
}
}
}
}
}
catch (Exception e) {
LogManager.Log.Log(LogLevel.DBADERROR, "AvatarTracker.GetHandler: exception building response: {0}", e);
}
ret.Add(kvp.Value.Name.Name.Replace('/', '-'), oneAV);
}
}
return ret;
}
示例8: PrimListToOSD
/// <summary>
/// Converts a list of primitives to an object that can be serialized
/// with the LLSD system
/// </summary>
/// <param name="prims">Primitives to convert to a serializable object</param>
/// <returns>An object that can be serialized with LLSD</returns>
public static StructuredData.OSD PrimListToOSD(List<Primitive> prims)
{
StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(prims.Count);
for (int i = 0; i < prims.Count; i++)
map.Add(prims[i].LocalID.ToString(), prims[i].GetOSD());
return map;
}
示例9: PostActionTeleport
private OMVSD.OSDMap PostActionTeleport(OMVSD.OSD body)
{
OMVSD.OSDMap ret = new OMVSD.OSDMap();
ParameterSet loginParams = new ParameterSet();
try {
OMVSD.OSDMap paramMap = (OMVSD.OSDMap)body;
string dest = paramMap["DESTINATION"].AsString();
m_log.Log(LogLevel.DCOMMDETAIL, "Request to teleport to {0}", dest);
m_comm.DoTeleport(dest);
}
catch (Exception e) {
m_log.Log(LogLevel.DBADERROR, "CONNECT EXCEPTION: " + e.ToString());
ret.Add(RestHandler.RESTREQUESTERRORCODE, new OMVSD.OSDInteger(1));
ret.Add(RestHandler.RESTREQUESTERRORMSG, new OMVSD.OSDString("Connection threw exception: " + e.ToString()));
return ret;
}
return ret;
}
示例10: PostActionLogin
private OMVSD.OSDMap PostActionLogin(OMVSD.OSD body)
{
OMVSD.OSDMap ret = new OMVSD.OSDMap();
ParameterSet loginParams = new ParameterSet();
try {
OMVSD.OSDMap paramMap = (OMVSD.OSDMap)body;
loginParams.Add(CommLLLP.FIELDFIRST, paramMap["LOGINFIRST"].AsString());
loginParams.Add(CommLLLP.FIELDLAST, paramMap["LOGINLAST"].AsString());
loginParams.Add(CommLLLP.FIELDPASS, paramMap["LOGINPASS"].AsString());
loginParams.Add(CommLLLP.FIELDGRID, paramMap["LOGINGRID"].AsString());
loginParams.Add(CommLLLP.FIELDSIM, paramMap["LOGINSIM"].AsString());
}
catch {
m_log.Log(LogLevel.DBADERROR, "MISFORMED POST REQUEST: ");
ret.Add(RestHandler.RESTREQUESTERRORCODE, new OMVSD.OSDInteger(1));
ret.Add(RestHandler.RESTREQUESTERRORMSG, new OMVSD.OSDString("Misformed POST request"));
return ret;
}
try {
if (!m_comm.Connect(loginParams)) {
m_log.Log(LogLevel.DBADERROR, "CONNECT FAILED");
ret.Add(RestHandler.RESTREQUESTERRORCODE, new OMVSD.OSDInteger(1));
ret.Add(RestHandler.RESTREQUESTERRORMSG, new OMVSD.OSDString("Could not log in"));
return ret;
}
}
catch (Exception e) {
m_log.Log(LogLevel.DBADERROR, "CONNECT EXCEPTION: " + e.ToString());
ret.Add(RestHandler.RESTREQUESTERRORCODE, new OMVSD.OSDInteger(1));
ret.Add(RestHandler.RESTREQUESTERRORMSG, new OMVSD.OSDString("Connection threw exception: " + e.ToString()));
return ret;
}
return ret;
}
示例11: ProcessPost
/// <summary>
/// Posting to this communication instance. The URI comes in as "/api/MYNAME/ACTION" where
/// ACTION is "login", "logout".
/// </summary>
/// <param name="uri"></param>
/// <param name="body"></param>
/// <returns></returns>
public OMVSD.OSD ProcessPost(RestHandler handler, Uri uri, string after, OMVSD.OSD body)
{
OMVSD.OSDMap ret = new OMVSD.OSDMap();
if (m_comm == null) {
m_log.Log(LogLevel.DBADERROR, "POST WITHOUT COMM CONNECTION!! URL=" + uri.ToString());
return new OMVSD.OSD();
}
m_log.Log(LogLevel.DCOMMDETAIL, "Post action: {0}", uri.ToString());
switch (after) {
case "/login":
ret = PostActionLogin(body);
break;
case "/teleport":
ret = PostActionTeleport(body);
break;
case "/logout":
ret = PostActionLogout(body);
break;
case "/exit":
ret = PostActionExit(body);
break;
default:
m_log.Log(LogLevel.DBADERROR, "UNKNOWN ACTION: " + uri.ToString());
ret.Add(RestHandler.RESTREQUESTERRORCODE, new OMVSD.OSDInteger(1));
ret.Add(RestHandler.RESTREQUESTERRORMSG, new OMVSD.OSDString("Unknown action"));
break;
}
return ret;
}
示例12: RenderJson
/// <summary>
/// Return stat information for all regions in the sim. Returns data of the form:
/// <pre>
/// {"REGIONNAME": {
/// "region": "REGIONNAME",
/// "timeDilation": "101",
/// ... // the rest of the stat info
/// },
/// ... // entries for each region
/// }
/// </pre>
/// </summary>
/// <param name="pModelResult"></param>
/// <returns></returns>
public string RenderJson(Hashtable pModelResult)
{
List<Scene> all_scenes = (List<Scene>) pModelResult["hdata"];
Dictionary<UUID, USimStatsData> sdatadic = (Dictionary<UUID,USimStatsData>)pModelResult["simstats"];
OSDMap allStatsInfo = new OpenMetaverse.StructuredData.OSDMap();
foreach (USimStatsData sdata in sdatadic.Values)
{
OSDMap statsInfo = new OpenMetaverse.StructuredData.OSDMap();
string regionName = "unknown";
foreach (Scene sn in all_scenes)
{
if (sn.RegionInfo.RegionID == sdata.RegionId)
{
regionName = sn.RegionInfo.RegionName;
break;
}
}
statsInfo.Add("region", new OSDString(regionName));
statsInfo.Add("timeDilation", new OSDString(sdata.TimeDilation.ToString()));
statsInfo.Add("simFPS", new OSDString(sdata.SimFps.ToString()));
statsInfo.Add("physicsFPS", new OSDString(sdata.PhysicsFps.ToString()));
statsInfo.Add("agentUpdates", new OSDString(sdata.AgentUpdates.ToString()));
statsInfo.Add("rootAgents", new OSDString(sdata.RootAgents.ToString()));
statsInfo.Add("childAgents", new OSDString(sdata.ChildAgents.ToString()));
statsInfo.Add("totalPrims", new OSDString(sdata.TotalPrims.ToString()));
statsInfo.Add("activePrims", new OSDString(sdata.ActivePrims.ToString()));
statsInfo.Add("activeScripts", new OSDString(sdata.ActiveScripts.ToString()));
statsInfo.Add("scriptLinesPerSec", new OSDString(sdata.ScriptLinesPerSecond.ToString()));
statsInfo.Add("totalFrameTime", new OSDString(sdata.TotalFrameTime.ToString()));
statsInfo.Add("agentFrameTime", new OSDString(sdata.AgentFrameTime.ToString()));
statsInfo.Add("physicsFrameTime", new OSDString(sdata.PhysicsFrameTime.ToString()));
statsInfo.Add("otherFrameTime", new OSDString(sdata.OtherFrameTime.ToString()));
statsInfo.Add("outPacketsPerSec", new OSDString(sdata.OutPacketsPerSecond.ToString()));
statsInfo.Add("inPacketsPerSec", new OSDString(sdata.InPacketsPerSecond.ToString()));
statsInfo.Add("unackedByptes", new OSDString(sdata.UnackedBytes.ToString()));
statsInfo.Add("pendingDownloads", new OSDString(sdata.PendingDownloads.ToString()));
statsInfo.Add("pendingUploads", new OSDString(sdata.PendingUploads.ToString()));
allStatsInfo.Add(regionName, statsInfo);
}
return allStatsInfo.ToString();
}
示例13: MapizeTheBody
private OMVSD.OSDMap MapizeTheBody(string body)
{
OMVSD.OSDMap retMap = new OMVSD.OSDMap();
if (body.Length > 0 && body.Substring(0, 1).Equals("{")) { // kludge test for JSON formatted body
try {
retMap = (OMVSD.OSDMap)OMVSD.OSDParser.DeserializeJson(body);
}
catch (Exception e) {
m_log.Log(LogLevel.DREST, "Failed parsing of JSON body: " + e.ToString());
}
}
else {
try {
string[] amp = body.Split('&');
if (amp.Length > 0) {
foreach (string kvp in amp) {
string[] kvpPieces = kvp.Split('=');
if (kvpPieces.Length == 2) {
retMap.Add(kvpPieces[0].Trim(), new OMVSD.OSDString(kvpPieces[1].Trim()));
}
}
}
}
catch (Exception e) {
m_log.Log(LogLevel.DREST, "Failed parsing of query body: " + e.ToString());
}
}
return retMap;
}
示例14: GetHandler
private OMVSD.OSD GetHandler(RestHandler handler, Uri uri, String after)
{
OMVSD.OSDMap ret = new OMVSD.OSDMap();
string lastDate = "xx";
lock (m_chats) {
while (m_chats.Count > 0) {
ChatEntry ce = m_chats.Dequeue();
string dateString = ce.time.ToString("yyyyMMddhhmmssfff");
OMVSD.OSDMap chat = new OMVSD.OSDMap();
chat.Add("Time", new OMVSD.OSDString(dateString));
chat.Add("From", new OMVSD.OSDString(ce.fromName));
chat.Add("Message", new OMVSD.OSDString(ce.message));
chat.Add("Type", new OMVSD.OSDString(ce.chatTypeString));
chat.Add("EntryType", new OMVSD.OSDString(ChatEntryTypeString[(int)ce.chatEntryType]));
chat.Add("Position", new OMVSD.OSDString(ce.position.ToString()));
if (ce.ownerID != null) {
chat.Add("OwnerID", new OMVSD.OSDString(ce.ownerID.ToString()));
}
while (ret.ContainsKey(dateString)) {
dateString += "1";
}
ret.Add(dateString, chat);
lastDate = dateString;
}
}
return ret;
}
示例15: RenderJson
/// <summary>
/// Return the last log lines. Output in the format:
/// <pre>
/// {"logLines": [
/// "line1",
/// "line2",
/// ...
/// ]
/// }
/// </pre>
/// </summary>
/// <param name="pModelResult"></param>
/// <returns></returns>
public string RenderJson(Hashtable pModelResult)
{
OSDMap logInfo = new OpenMetaverse.StructuredData.OSDMap();
OSDArray logLines = new OpenMetaverse.StructuredData.OSDArray();
string tmp = normalizeEndLines.Replace(pModelResult["loglines"].ToString(), "\n");
string[] result = Regex.Split(tmp, "\n");
for (int i = 0; i < result.Length; i++)
{
logLines.Add(new OSDString(result[i]));
}
logInfo.Add("logLines", logLines);
return logInfo.ToString();
}