From dd13fa361b12fa2fb1c91c9f74379a305935a87d Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 29 Oct 2009 05:56:37 -0700
Subject: * Misc. formatting cleanup for the previous patch * Added the new
AppDomainLoading variable to the [XEngine] section in the example config
---
.../ScriptEngine/Shared/CodeTools/Compiler.cs | 51 +++++++++++-----------
.../ScriptEngine/Shared/Instance/ScriptInstance.cs | 8 ++--
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 18 ++++----
3 files changed, 40 insertions(+), 37 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index d781a1a..3080c71 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -174,8 +174,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
else
{
#if DEBUG
-// m_log.Debug("[Compiler]: " +
-// "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language.");
+ // m_log.Debug("[Compiler]: " +
+ // "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language.");
#endif
// LANGUAGE IS IN ALLOW-LIST
DefaultCompileLanguage = LanguageMapping[defaultCompileLanguage];
@@ -214,12 +214,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
catch (Exception ex)
{
m_log.Error("[Compiler]: Exception trying to create ScriptEngine directory \"" + Path.Combine(ScriptEnginesPath,
- m_scriptEngine.World.RegionInfo.RegionID.ToString())+ "\": " + ex.ToString());
+ m_scriptEngine.World.RegionInfo.RegionID.ToString()) + "\": " + ex.ToString());
}
}
foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath,
- m_scriptEngine.World.RegionInfo.RegionID.ToString()),FilePrefix + "_compiled*"))
+ m_scriptEngine.World.RegionInfo.RegionID.ToString()), FilePrefix + "_compiled*"))
{
try
{
@@ -273,8 +273,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
///
/// LSL script
/// Filename to .dll assembly
- public void PerformScriptCompile(string Script, string asset, UUID ownerUUID,
- out string assembly, out Dictionary, KeyValuePair> linemap)
+ public void PerformScriptCompile(string Script, string asset, UUID ownerUUID,
+ out string assembly, out Dictionary, KeyValuePair> linemap)
{
linemap = null;
m_warnings.Clear();
@@ -352,13 +352,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
throw new Exception(errtext);
}
- if (m_scriptEngine.World.Permissions.CanCompileScript(ownerUUID, (int)language) == false) {
+ if (m_scriptEngine.World.Permissions.CanCompileScript(ownerUUID, (int)language) == false)
+ {
// Not allowed to compile to this language!
string errtext = String.Empty;
errtext += ownerUUID + " is not in list of allowed users for this scripting language. Script will not be executed!";
throw new Exception(errtext);
}
-
+
string compileScript = Script;
if (language == enumCompileType.lsl)
@@ -373,7 +374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
AddWarning(warning);
}
- linemap = ((CSCodeGenerator) LSL_Converter).PositionMap;
+ linemap = ((CSCodeGenerator)LSL_Converter).PositionMap;
// Write the linemap to a file and save it in our dictionary for next time.
m_lineMaps[assembly] = linemap;
WriteMapFile(assembly + ".map", linemap);
@@ -487,7 +488,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
}
catch (Exception e) // NOTLEGIT - Should be just FileIOException
{
- throw new Exception("Unable to delete old existing "+
+ throw new Exception("Unable to delete old existing " +
"script-file before writing new. Compile aborted: " +
e.ToString());
}
@@ -506,7 +507,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
}
catch (Exception ex) //NOTLEGIT - Should be just FileIOException
{
- m_log.Error("[Compiler]: Exception while "+
+ m_log.Error("[Compiler]: Exception while " +
"trying to write script source to file \"" +
srcFileName + "\": " + ex.ToString());
}
@@ -547,7 +548,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
case enumCompileType.cs:
case enumCompileType.lsl:
bool complete = false;
- bool retried = false;
+ bool retried = false;
do
{
lock (CScodeProvider)
@@ -588,7 +589,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
parameters, Script);
break;
default:
- throw new Exception("Compiler is not able to recongnize "+
+ throw new Exception("Compiler is not able to recongnize " +
"language type \"" + lang.ToString() + "\"");
}
@@ -641,7 +642,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
if (!File.Exists(assembly))
{
- for (int i=0; i<20 && !File.Exists(assembly); i++)
+ for (int i = 0; i < 20 && !File.Exists(assembly); i++)
{
System.Threading.Thread.Sleep(250);
}
@@ -654,8 +655,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
}
}
-// m_log.DebugFormat("[Compiler] Compiled new assembly "+
-// "for {0}", asset);
+ // m_log.DebugFormat("[Compiler] Compiled new assembly "+
+ // "for {0}", asset);
// Because windows likes to perform exclusive locks, we simply
// write out a textual representation of the file here
@@ -694,17 +695,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
Byte[] buf = enc.GetBytes(filetext);
- FileStream sfs = File.Create(assembly+".text");
+ FileStream sfs = File.Create(assembly + ".text");
sfs.Write(buf, 0, buf.Length);
sfs.Close();
return assembly;
}
- private class kvpSorter : IComparer>
+ private class kvpSorter : IComparer>
{
- public int Compare(KeyValuePair a,
- KeyValuePair b)
+ public int Compare(KeyValuePair a,
+ KeyValuePair b)
{
return a.Key.CompareTo(b.Key);
}
@@ -723,8 +724,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
out ret))
return ret;
- List> sorted =
- new List>(positionMap.Keys);
+ List> sorted =
+ new List>(positionMap.Keys);
sorted.Sort(new kvpSorter());
@@ -791,18 +792,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
}
- private static Dictionary, KeyValuePair> ReadMapFile(string filename)
+ private static Dictionary, KeyValuePair> ReadMapFile(string filename)
{
Dictionary, KeyValuePair> linemap;
try
{
StreamReader r = File.OpenText(filename);
linemap = new Dictionary, KeyValuePair>();
-
+
string line;
while ((line = r.ReadLine()) != null)
{
- String[] parts = line.Split(new Char[] {','});
+ String[] parts = line.Split(new Char[] { ',' });
int kk = System.Convert.ToInt32(parts[0]);
int kv = System.Convert.ToInt32(parts[1]);
int vk = System.Convert.ToInt32(parts[2]);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 37ec5df..f16aefc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
private StateSource m_stateSource;
private bool m_postOnRez;
private bool m_startedFromSavedState = false;
- private int m_CurrentStateHash;
+ private UUID m_CurrentStateHash;
private UUID m_RegionID = UUID.Zero;
private Dictionary, KeyValuePair>
@@ -901,7 +901,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
// Compare hash of the state we just just created with the state last written to disk
// If the state is different, update the disk file.
- if(xml.GetHashCode() != m_CurrentStateHash)
+ UUID hash = UUID.Parse(Utils.MD5String(xml));
+
+ if(hash != m_CurrentStateHash)
{
try
{
@@ -919,7 +921,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
//{
// throw new Exception("Completed persistence save, but no file was created");
//}
- m_CurrentStateHash = xml.GetHashCode();
+ m_CurrentStateHash = hash;
}
}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 57042e9..b13e0de 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -710,15 +710,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
evidence, appSetup);
else
sandbox = AppDomain.CurrentDomain;
- /*
- PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
- AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
- PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet");
- PolicyStatement sandboxPolicyStatement = new PolicyStatement(sandboxPermissionSet);
- CodeGroup sandboxCodeGroup = new UnionCodeGroup(sandboxMembershipCondition, sandboxPolicyStatement);
- sandboxPolicy.RootCodeGroup = sandboxCodeGroup;
- sandbox.SetAppDomainPolicy(sandboxPolicy);
- */
+
+ //PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
+ //AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
+ //PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet");
+ //PolicyStatement sandboxPolicyStatement = new PolicyStatement(sandboxPermissionSet);
+ //CodeGroup sandboxCodeGroup = new UnionCodeGroup(sandboxMembershipCondition, sandboxPolicyStatement);
+ //sandboxPolicy.RootCodeGroup = sandboxCodeGroup;
+ //sandbox.SetAppDomainPolicy(sandboxPolicy);
+
m_AppDomains[appDomain] = sandbox;
m_AppDomains[appDomain].AssemblyResolve +=
--
cgit v1.1