From 706a2df5169fa72fb87f38858d4672c8ff26695a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 26 Mar 2009 15:06:20 +0000 Subject: Read the .map files in on sim startup. Also clean them up when an assembly is deleted. --- .../ScriptEngine/Shared/CodeTools/Compiler.cs | 30 +++++++++++++++++++++- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 3 +++ 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 5215b90..5cf7a06 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -309,7 +309,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools // if (File.Exists(OutFile) && File.Exists(OutFile+".text") && File.Exists(OutFile+".map")) { - // TODO: Read .map file here + ReadMapFile(OutFile+".map"); return OutFile; } @@ -750,5 +750,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools return ret; } + + private void ReadMapFile(string filename) + { + try + { + StreamReader r = File.OpenText(filename); + + m_positionMap = new Dictionary, KeyValuePair>(); + + string line; + while ((line = r.ReadLine()) != null) + { + 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]); + int vv = System.Convert.ToInt32(parts[3]); + + KeyValuePair k = new KeyValuePair(kk, kv); + KeyValuePair v = new KeyValuePair(vk, vv); + + m_positionMap[k] = v; + } + } + catch (Exception e) + { + } + } } } diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 0431d90..09480f6 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -780,6 +780,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (File.Exists(m_Assemblies[assetID]+".mdb")) File.Delete(m_Assemblies[assetID]+".mdb"); + + if (File.Exists(m_Assemblies[assetID]+".map")) + File.Delete(m_Assemblies[assetID]+".map"); } catch (Exception) { -- cgit v1.1