diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 49 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 9 |
2 files changed, 29 insertions, 29 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 9379f8f..de5f92d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -663,9 +663,8 @@ namespace SecondLife | |||
663 | 663 | ||
664 | try | 664 | try |
665 | { | 665 | { |
666 | FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read); | 666 | using (FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read)) |
667 | fs.Read(data, 0, data.Length); | 667 | fs.Read(data, 0, data.Length); |
668 | fs.Close(); | ||
669 | } | 668 | } |
670 | catch (Exception) | 669 | catch (Exception) |
671 | { | 670 | { |
@@ -680,9 +679,8 @@ namespace SecondLife | |||
680 | 679 | ||
681 | Byte[] buf = Encoding.ASCII.GetBytes(filetext); | 680 | Byte[] buf = Encoding.ASCII.GetBytes(filetext); |
682 | 681 | ||
683 | FileStream sfs = File.Create(assembly + ".text"); | 682 | using (FileStream sfs = File.Create(assembly + ".text")) |
684 | sfs.Write(buf, 0, buf.Length); | 683 | sfs.Write(buf, 0, buf.Length); |
685 | sfs.Close(); | ||
686 | 684 | ||
687 | return assembly; | 685 | return assembly; |
688 | } | 686 | } |
@@ -775,7 +773,6 @@ namespace SecondLife | |||
775 | return message; | 773 | return message; |
776 | } | 774 | } |
777 | 775 | ||
778 | |||
779 | private static void WriteMapFile(string filename, Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap) | 776 | private static void WriteMapFile(string filename, Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap) |
780 | { | 777 | { |
781 | string mapstring = String.Empty; | 778 | string mapstring = String.Empty; |
@@ -787,40 +784,42 @@ namespace SecondLife | |||
787 | } | 784 | } |
788 | 785 | ||
789 | Byte[] mapbytes = Encoding.ASCII.GetBytes(mapstring); | 786 | Byte[] mapbytes = Encoding.ASCII.GetBytes(mapstring); |
790 | FileStream mfs = File.Create(filename); | ||
791 | mfs.Write(mapbytes, 0, mapbytes.Length); | ||
792 | mfs.Close(); | ||
793 | } | ||
794 | 787 | ||
788 | using (FileStream mfs = File.Create(filename)) | ||
789 | mfs.Write(mapbytes, 0, mapbytes.Length); | ||
790 | } | ||
795 | 791 | ||
796 | private static Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> ReadMapFile(string filename) | 792 | private static Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> ReadMapFile(string filename) |
797 | { | 793 | { |
798 | Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap; | 794 | Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap; |
799 | try | 795 | try |
800 | { | 796 | { |
801 | StreamReader r = File.OpenText(filename); | 797 | using (StreamReader r = File.OpenText(filename)) |
802 | linemap = new Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>(); | ||
803 | |||
804 | string line; | ||
805 | while ((line = r.ReadLine()) != null) | ||
806 | { | 798 | { |
807 | String[] parts = line.Split(new Char[] { ',' }); | 799 | linemap = new Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>(); |
808 | int kk = System.Convert.ToInt32(parts[0]); | ||
809 | int kv = System.Convert.ToInt32(parts[1]); | ||
810 | int vk = System.Convert.ToInt32(parts[2]); | ||
811 | int vv = System.Convert.ToInt32(parts[3]); | ||
812 | 800 | ||
813 | KeyValuePair<int, int> k = new KeyValuePair<int, int>(kk, kv); | 801 | string line; |
814 | KeyValuePair<int, int> v = new KeyValuePair<int, int>(vk, vv); | 802 | while ((line = r.ReadLine()) != null) |
803 | { | ||
804 | String[] parts = line.Split(new Char[] { ',' }); | ||
805 | int kk = System.Convert.ToInt32(parts[0]); | ||
806 | int kv = System.Convert.ToInt32(parts[1]); | ||
807 | int vk = System.Convert.ToInt32(parts[2]); | ||
808 | int vv = System.Convert.ToInt32(parts[3]); | ||
809 | |||
810 | KeyValuePair<int, int> k = new KeyValuePair<int, int>(kk, kv); | ||
811 | KeyValuePair<int, int> v = new KeyValuePair<int, int>(vk, vv); | ||
815 | 812 | ||
816 | linemap[k] = v; | 813 | linemap[k] = v; |
814 | } | ||
817 | } | 815 | } |
818 | } | 816 | } |
819 | catch | 817 | catch |
820 | { | 818 | { |
821 | linemap = new Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>(); | 819 | linemap = new Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>(); |
822 | } | 820 | } |
821 | |||
823 | return linemap; | 822 | return linemap; |
824 | } | 823 | } |
825 | } | 824 | } |
826 | } | 825 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 9da2168..637c556 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -1065,10 +1065,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
1065 | { | 1065 | { |
1066 | try | 1066 | try |
1067 | { | 1067 | { |
1068 | FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")); | 1068 | using (FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state"))) |
1069 | Byte[] buf = Util.UTF8NoBomEncoding.GetBytes(xml); | 1069 | { |
1070 | fs.Write(buf, 0, buf.Length); | 1070 | Byte[] buf = Util.UTF8NoBomEncoding.GetBytes(xml); |
1071 | fs.Close(); | 1071 | fs.Write(buf, 0, buf.Length); |
1072 | } | ||
1072 | } | 1073 | } |
1073 | catch(Exception) | 1074 | catch(Exception) |
1074 | { | 1075 | { |