diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs new file mode 100644 index 0000000..2db718c --- /dev/null +++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs | |||
@@ -0,0 +1,126 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | |||
31 | |||
32 | namespace OpenSim.Region.OptionalModules.World.AutoBackup | ||
33 | { | ||
34 | /// <summary>AutoBackupModuleState: Auto-Backup state for one region (scene). | ||
35 | /// If you use this class in any way outside of AutoBackupModule, you should treat the class as opaque. | ||
36 | /// Since it is not part of the framework, you really should not rely upon it outside of the AutoBackupModule implementation. | ||
37 | /// </summary> | ||
38 | /// | ||
39 | public class AutoBackupModuleState | ||
40 | { | ||
41 | private Dictionary<Guid, string> m_liveRequests = null; | ||
42 | |||
43 | public AutoBackupModuleState() | ||
44 | { | ||
45 | this.Enabled = false; | ||
46 | this.BackupDir = "."; | ||
47 | this.BusyCheck = true; | ||
48 | this.Timer = null; | ||
49 | this.NamingType = NamingType.Time; | ||
50 | this.Script = null; | ||
51 | } | ||
52 | |||
53 | public Dictionary<Guid, string> LiveRequests | ||
54 | { | ||
55 | get { | ||
56 | return this.m_liveRequests ?? | ||
57 | (this.m_liveRequests = new Dictionary<Guid, string>(1)); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | public bool Enabled | ||
62 | { | ||
63 | get; | ||
64 | set; | ||
65 | } | ||
66 | |||
67 | public System.Timers.Timer Timer | ||
68 | { | ||
69 | get; | ||
70 | set; | ||
71 | } | ||
72 | |||
73 | public double IntervalMinutes | ||
74 | { | ||
75 | get | ||
76 | { | ||
77 | if (this.Timer == null) | ||
78 | { | ||
79 | return -1.0; | ||
80 | } | ||
81 | else | ||
82 | { | ||
83 | return this.Timer.Interval / 60000.0; | ||
84 | } | ||
85 | } | ||
86 | } | ||
87 | |||
88 | public bool BusyCheck | ||
89 | { | ||
90 | get; | ||
91 | set; | ||
92 | } | ||
93 | |||
94 | public string Script | ||
95 | { | ||
96 | get; | ||
97 | set; | ||
98 | } | ||
99 | |||
100 | public string BackupDir | ||
101 | { | ||
102 | get; | ||
103 | set; | ||
104 | } | ||
105 | |||
106 | public NamingType NamingType | ||
107 | { | ||
108 | get; | ||
109 | set; | ||
110 | } | ||
111 | |||
112 | public new string ToString() | ||
113 | { | ||
114 | string retval = ""; | ||
115 | |||
116 | retval += "[AUTO BACKUP]: AutoBackup: " + (Enabled ? "ENABLED" : "DISABLED") + "\n"; | ||
117 | retval += "[AUTO BACKUP]: Interval: " + IntervalMinutes + " minutes" + "\n"; | ||
118 | retval += "[AUTO BACKUP]: Do Busy Check: " + (BusyCheck ? "Yes" : "No") + "\n"; | ||
119 | retval += "[AUTO BACKUP]: Naming Type: " + NamingType.ToString() + "\n"; | ||
120 | retval += "[AUTO BACKUP]: Backup Dir: " + BackupDir + "\n"; | ||
121 | retval += "[AUTO BACKUP]: Script: " + Script + "\n"; | ||
122 | return retval; | ||
123 | } | ||
124 | } | ||
125 | } | ||
126 | |||