123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
-
- using System;
- using System.Collections.Generic;
- using System.Reflection;
- using OpenMetaverse;
- using OpenMetaverse.StructuredData;
- using log4net;
- namespace OpenSim.Server.Handlers.Simulation
- {
- public class Utils
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
-
-
-
-
-
- public static bool GetParams(string uri, out UUID uuid, out UUID regionID, out string action)
- {
- uuid = UUID.Zero;
- regionID = UUID.Zero;
- action = "";
- uri = uri.Trim(new char[] { '/' });
- string[] parts = uri.Split('/');
- if (parts.Length <= 1)
- {
- return false;
- }
- else
- {
- if (!UUID.TryParse(parts[1], out uuid))
- return false;
- if (parts.Length >= 3)
- UUID.TryParse(parts[2], out regionID);
- if (parts.Length >= 4)
- action = parts[3];
- return true;
- }
- }
- public static OSDMap GetOSDMap(string data)
- {
- OSDMap args = null;
- try
- {
- OSD buffer;
-
- buffer = OSDParser.DeserializeJson(data);
- if (buffer.Type == OSDType.Map)
- {
- args = (OSDMap)buffer;
- return args;
- }
- else
- {
-
- m_log.Debug(("[REST COMMS]: Got OSD of unexpected type " + buffer.Type.ToString()));
- return null;
- }
- }
- catch (Exception ex)
- {
- m_log.Debug("[REST COMMS]: exception on parse of REST message " + ex.Message);
- return null;
- }
- }
- }
- }
|