mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +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>
|
||||
|
||||
@@ -269,8 +269,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
LSL_Integer osCheckODE();
|
||||
string osGetPhysicsEngineType();
|
||||
string osGetPhysicsEngineName();
|
||||
Object osParseJSONNew(string JSON);
|
||||
Hashtable osParseJSON(string JSON);
|
||||
|
||||
void osMessageObject(key objectUUID,string message);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
public partial class ScriptBaseClass
|
||||
{
|
||||
// SCRIPTS CONSTANTS
|
||||
public static readonly LSLInteger OS_APIVERSION = 1;
|
||||
public static readonly LSLInteger OS_APIVERSION = 2;
|
||||
|
||||
public static readonly LSLInteger TRUE = 1;
|
||||
public static readonly LSLInteger FALSE = 0;
|
||||
|
||||
@@ -476,16 +476,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_OSSL_Functions.osGetSimulatorVersion();
|
||||
}
|
||||
|
||||
public Hashtable osParseJSON(string JSON)
|
||||
{
|
||||
return m_OSSL_Functions.osParseJSON(JSON);
|
||||
}
|
||||
|
||||
public Object osParseJSONNew(string JSON)
|
||||
{
|
||||
return m_OSSL_Functions.osParseJSONNew(JSON);
|
||||
}
|
||||
|
||||
public void osMessageObject(key objectUUID,string message)
|
||||
{
|
||||
m_OSSL_Functions.osMessageObject(objectUUID,message);
|
||||
|
||||
Reference in New Issue
Block a user