aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs99
1 files changed, 0 insertions, 99 deletions
diff --git a/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs b/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs
deleted file mode 100644
index 6a31794..0000000
--- a/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Text;
32using System.Timers;
33using Nini.Config;
34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes;
36
37namespace OpenSim.Region.OptionalModules.Autooar
38{
39 public class AutooarModule : IRegionModule
40 {
41 private readonly Timer m_timer = new Timer(60000*20);
42 private readonly List<Scene> m_scenes = new List<Scene>();
43 private IConfigSource config;
44 private bool m_enabled = false;
45
46
47 public void Initialise(Scene scene, IConfigSource source)
48 {
49 m_scenes.Add(scene);
50 config = source;
51 }
52
53 public void PostInitialise()
54 {
55 if (config.Configs["autooar"] != null)
56 {
57 m_enabled = config.Configs["autooar"].GetBoolean("Enabled", m_enabled);
58 }
59
60 if (m_enabled)
61 {
62 m_timer.Elapsed += m_timer_Elapsed;
63 m_timer.AutoReset = true;
64 m_timer.Start();
65 }
66 }
67
68 void m_timer_Elapsed(object sender, ElapsedEventArgs e)
69 {
70 if (!Directory.Exists("autooars"))
71 Directory.CreateDirectory("autooars");
72
73 foreach (Scene scene in m_scenes)
74 {
75 IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
76
77 archiver.ArchiveRegion(Path.Combine("autooars",
78 scene.RegionInfo.RegionName + "_" + scene.RegionInfo.RegionLocX +
79 "x" + scene.RegionInfo.RegionLocY + ".oar.tar.gz"));
80 }
81 }
82
83 public void Close()
84 {
85 if (m_timer.Enabled)
86 m_timer.Stop();
87 }
88
89 public string Name
90 {
91 get { return "Automatic OAR Module"; }
92 }
93
94 public bool IsSharedModule
95 {
96 get { return true; }
97 }
98 }
99}