mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
OSSL remove functions with illegal lsl types, also redundante
This commit is contained in:
@@ -1923,81 +1923,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return m_ScriptEngine.World.GetSimulatorVersion();
|
||||
}
|
||||
|
||||
private Hashtable osdToHashtable(OSDMap map)
|
||||
{
|
||||
Hashtable result = new Hashtable();
|
||||
foreach (KeyValuePair<string, OSD> item in map) {
|
||||
result.Add(item.Key, osdToObject(item.Value));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private ArrayList osdToArray(OSDArray list)
|
||||
{
|
||||
ArrayList result = new ArrayList();
|
||||
foreach ( OSD item in list ) {
|
||||
result.Add(osdToObject(item));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Object osdToObject(OSD decoded)
|
||||
{
|
||||
if ( decoded is OSDString ) {
|
||||
return (string) decoded.AsString();
|
||||
} else if ( decoded is OSDInteger ) {
|
||||
return (int) decoded.AsInteger();
|
||||
} else if ( decoded is OSDReal ) {
|
||||
return (float) decoded.AsReal();
|
||||
} else if ( decoded is OSDBoolean ) {
|
||||
return (bool) decoded.AsBoolean();
|
||||
} else if ( decoded is OSDMap ) {
|
||||
return osdToHashtable((OSDMap) decoded);
|
||||
} else if ( decoded is OSDArray ) {
|
||||
return osdToArray((OSDArray) decoded);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Object osParseJSONNew(string JSON)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.None, "osParseJSONNew");
|
||||
|
||||
try
|
||||
{
|
||||
OSD decoded = OSDParser.DeserializeJson(JSON);
|
||||
return osdToObject(decoded);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
OSSLError("osParseJSONNew: Problems decoding JSON string " + JSON + " : " + e.Message) ;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Hashtable osParseJSON(string JSON)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.None, "osParseJSON");
|
||||
|
||||
Object decoded = osParseJSONNew(JSON);
|
||||
|
||||
if ( decoded is Hashtable ) {
|
||||
return (Hashtable) decoded;
|
||||
} else if ( decoded is ArrayList ) {
|
||||
ArrayList decoded_list = (ArrayList) decoded;
|
||||
Hashtable fakearray = new Hashtable();
|
||||
int i = 0;
|
||||
for ( i = 0; i < decoded_list.Count ; i++ ) {
|
||||
fakearray.Add(i, decoded_list[i]);
|
||||
}
|
||||
return fakearray;
|
||||
} else {
|
||||
OSSLError("osParseJSON: unable to parse JSON string " + JSON);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a message to to object identified by the given UUID
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user