diff options
author | Melanie | 2009-11-26 12:08:20 +0000 |
---|---|---|
committer | Melanie | 2009-11-26 13:13:48 +0000 |
commit | 22c325aa5ae06b897e5eb10404c0aa3727f8237b (patch) | |
tree | 4f353c5972416bcaf7470543926dfe0a5918073d /OpenSim/Region/ScriptEngine/XEngine | |
parent | Improvements to rAdmin admin_shutdown and admin_restart. Both methods can now... (diff) | |
download | opensim-SC_OLD-22c325aa5ae06b897e5eb10404c0aa3727f8237b.zip opensim-SC_OLD-22c325aa5ae06b897e5eb10404c0aa3727f8237b.tar.gz opensim-SC_OLD-22c325aa5ae06b897e5eb10404c0aa3727f8237b.tar.bz2 opensim-SC_OLD-22c325aa5ae06b897e5eb10404c0aa3727f8237b.tar.xz |
Remove GetAssemblyName and friends from the SE interface. It's now handled
internally
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 95 |
1 files changed, 86 insertions, 9 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 8b94f28..4dc6cb8 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1248,20 +1248,97 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1248 | } | 1248 | } |
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | public string GetAssemblyName(UUID itemID) | ||
1252 | { | ||
1253 | IScriptInstance instance = GetInstance(itemID); | ||
1254 | if (instance == null) | ||
1255 | return ""; | ||
1256 | return instance.GetAssemblyName(); | ||
1257 | } | ||
1258 | |||
1259 | public string GetXMLState(UUID itemID) | 1251 | public string GetXMLState(UUID itemID) |
1260 | { | 1252 | { |
1261 | IScriptInstance instance = GetInstance(itemID); | 1253 | IScriptInstance instance = GetInstance(itemID); |
1262 | if (instance == null) | 1254 | if (instance == null) |
1263 | return ""; | 1255 | return ""; |
1264 | return instance.GetXMLState(); | 1256 | string xml = instance.GetXMLState(); |
1257 | |||
1258 | XmlDocument sdoc = new XmlDocument(); | ||
1259 | sdoc.LoadXml(xml); | ||
1260 | XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState"); | ||
1261 | XmlNode rootNode = rootL[0]; | ||
1262 | |||
1263 | // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> | ||
1264 | XmlDocument doc = new XmlDocument(); | ||
1265 | XmlElement stateData = doc.CreateElement("", "State", ""); | ||
1266 | XmlAttribute stateID = doc.CreateAttribute("", "UUID", ""); | ||
1267 | stateID.Value = itemID.ToString(); | ||
1268 | stateData.Attributes.Append(stateID); | ||
1269 | XmlAttribute assetID = doc.CreateAttribute("", "Asset", ""); | ||
1270 | assetID.Value = instance.AssetID.ToString(); | ||
1271 | stateData.Attributes.Append(assetID); | ||
1272 | doc.AppendChild(stateData); | ||
1273 | |||
1274 | // Add <ScriptState>...</ScriptState> | ||
1275 | XmlNode xmlstate = doc.ImportNode(rootNode, true); | ||
1276 | stateData.AppendChild(xmlstate); | ||
1277 | |||
1278 | string assemName = instance.GetAssemblyName(); | ||
1279 | |||
1280 | string fn = Path.GetFileName(assemName); | ||
1281 | |||
1282 | string assem = String.Empty; | ||
1283 | |||
1284 | if (File.Exists(assemName + ".text")) | ||
1285 | { | ||
1286 | FileInfo tfi = new FileInfo(assemName + ".text"); | ||
1287 | |||
1288 | if (tfi != null) | ||
1289 | { | ||
1290 | Byte[] tdata = new Byte[tfi.Length]; | ||
1291 | |||
1292 | try | ||
1293 | { | ||
1294 | FileStream tfs = File.Open(assemName + ".text", | ||
1295 | FileMode.Open, FileAccess.Read); | ||
1296 | tfs.Read(tdata, 0, tdata.Length); | ||
1297 | tfs.Close(); | ||
1298 | |||
1299 | assem = new System.Text.ASCIIEncoding().GetString(tdata); | ||
1300 | } | ||
1301 | catch (Exception e) | ||
1302 | { | ||
1303 | m_log.DebugFormat("[XEngine]: Unable to open script textfile {0}, reason: {1}", assemName+".text", e.Message); | ||
1304 | } | ||
1305 | } | ||
1306 | } | ||
1307 | else | ||
1308 | { | ||
1309 | FileInfo fi = new FileInfo(assemName); | ||
1310 | |||
1311 | if (fi != null) | ||
1312 | { | ||
1313 | Byte[] data = new Byte[fi.Length]; | ||
1314 | |||
1315 | try | ||
1316 | { | ||
1317 | FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read); | ||
1318 | fs.Read(data, 0, data.Length); | ||
1319 | fs.Close(); | ||
1320 | |||
1321 | assem = System.Convert.ToBase64String(data); | ||
1322 | } | ||
1323 | catch (Exception e) | ||
1324 | { | ||
1325 | m_log.DebugFormat("[XEngine]: Unable to open script assembly {0}, reason: {1}", assemName, e.Message); | ||
1326 | } | ||
1327 | |||
1328 | } | ||
1329 | } | ||
1330 | |||
1331 | XmlElement assemblyData = doc.CreateElement("", "Assembly", ""); | ||
1332 | XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", ""); | ||
1333 | |||
1334 | assemblyName.Value = fn; | ||
1335 | assemblyData.Attributes.Append(assemblyName); | ||
1336 | |||
1337 | assemblyData.InnerText = assem; | ||
1338 | |||
1339 | stateData.AppendChild(assemblyData); | ||
1340 | |||
1341 | return doc.InnerXml; | ||
1265 | } | 1342 | } |
1266 | 1343 | ||
1267 | public bool CanBeDeleted(UUID itemID) | 1344 | public bool CanBeDeleted(UUID itemID) |