OSSL remove functions with illegal lsl types, also redundante

This commit is contained in:
UbitUmarov
2018-11-28 08:20:38 +00:00
parent a99055160b
commit 47bc1fb257
6 changed files with 24 additions and 125 deletions

View File

@@ -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>

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);