diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Autooar')
-rw-r--r-- | OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs b/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs index 6c10928..580c8e1 100644 --- a/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs +++ b/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs | |||
@@ -1,72 +1,72 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.IO; | 3 | using System.IO; |
4 | using System.Text; | 4 | using System.Text; |
5 | using System.Timers; | 5 | using System.Timers; |
6 | using Nini.Config; | 6 | using Nini.Config; |
7 | using OpenSim.Region.Framework.Interfaces; | 7 | using OpenSim.Region.Framework.Interfaces; |
8 | using OpenSim.Region.Framework.Scenes; | 8 | using OpenSim.Region.Framework.Scenes; |
9 | 9 | ||
10 | namespace OpenSim.Region.OptionalModules.Autooar | 10 | namespace OpenSim.Region.OptionalModules.Autooar |
11 | { | 11 | { |
12 | public class AutooarModule : IRegionModule | 12 | public class AutooarModule : IRegionModule |
13 | { | 13 | { |
14 | private readonly Timer m_timer = new Timer(60000*20); | 14 | private readonly Timer m_timer = new Timer(60000*20); |
15 | private readonly List<Scene> m_scenes = new List<Scene>(); | 15 | private readonly List<Scene> m_scenes = new List<Scene>(); |
16 | private IConfigSource config; | 16 | private IConfigSource config; |
17 | private bool m_enabled = false; | 17 | private bool m_enabled = false; |
18 | 18 | ||
19 | 19 | ||
20 | public void Initialise(Scene scene, IConfigSource source) | 20 | public void Initialise(Scene scene, IConfigSource source) |
21 | { | 21 | { |
22 | m_scenes.Add(scene); | 22 | m_scenes.Add(scene); |
23 | config = source; | 23 | config = source; |
24 | } | 24 | } |
25 | 25 | ||
26 | public void PostInitialise() | 26 | public void PostInitialise() |
27 | { | 27 | { |
28 | if(config.Configs["autooar"] != null) | 28 | if(config.Configs["autooar"] != null) |
29 | { | 29 | { |
30 | m_enabled = config.Configs["autooar"].GetBoolean("Enabled", m_enabled); | 30 | m_enabled = config.Configs["autooar"].GetBoolean("Enabled", m_enabled); |
31 | } | 31 | } |
32 | 32 | ||
33 | if(m_enabled) | 33 | if(m_enabled) |
34 | { | 34 | { |
35 | m_timer.Elapsed += m_timer_Elapsed; | 35 | m_timer.Elapsed += m_timer_Elapsed; |
36 | m_timer.AutoReset = true; | 36 | m_timer.AutoReset = true; |
37 | m_timer.Start(); | 37 | m_timer.Start(); |
38 | } | 38 | } |
39 | } | 39 | } |
40 | 40 | ||
41 | void m_timer_Elapsed(object sender, ElapsedEventArgs e) | 41 | void m_timer_Elapsed(object sender, ElapsedEventArgs e) |
42 | { | 42 | { |
43 | if (!Directory.Exists("autooars")) | 43 | if (!Directory.Exists("autooars")) |
44 | Directory.CreateDirectory("autooars"); | 44 | Directory.CreateDirectory("autooars"); |
45 | 45 | ||
46 | foreach (Scene scene in m_scenes) | 46 | foreach (Scene scene in m_scenes) |
47 | { | 47 | { |
48 | IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>(); | 48 | IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>(); |
49 | 49 | ||
50 | archiver.ArchiveRegion(Path.Combine("autooars", | 50 | archiver.ArchiveRegion(Path.Combine("autooars", |
51 | scene.RegionInfo.RegionName + "_" + scene.RegionInfo.RegionLocX + | 51 | scene.RegionInfo.RegionName + "_" + scene.RegionInfo.RegionLocX + |
52 | "x" + scene.RegionInfo.RegionLocY + ".oar.tar.gz")); | 52 | "x" + scene.RegionInfo.RegionLocY + ".oar.tar.gz")); |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | public void Close() | 56 | public void Close() |
57 | { | 57 | { |
58 | if (m_timer.Enabled) | 58 | if (m_timer.Enabled) |
59 | m_timer.Stop(); | 59 | m_timer.Stop(); |
60 | } | 60 | } |
61 | 61 | ||
62 | public string Name | 62 | public string Name |
63 | { | 63 | { |
64 | get { return "Automatic OAR Module"; } | 64 | get { return "Automatic OAR Module"; } |
65 | } | 65 | } |
66 | 66 | ||
67 | public bool IsSharedModule | 67 | public bool IsSharedModule |
68 | { | 68 | { |
69 | get { return true; } | 69 | get { return true; } |
70 | } | 70 | } |
71 | } | 71 | } |
72 | } | 72 | } |