OpenSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
AutoBackupModuleState.cs
Go to the documentation of this file.
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 {
39  public class AutoBackupModuleState
40  {
41  private Dictionary<Guid, string> m_liveRequests = null;
42 
44  {
45  this.Enabled = false;
46  this.BackupDir = ".";
47  this.BusyCheck = true;
48  this.SkipAssets = false;
49  this.Timer = null;
50  this.NamingType = NamingType.Time;
51  this.Script = null;
52  this.KeepFilesForDays = 0;
53  }
54 
55  public Dictionary<Guid, string> LiveRequests
56  {
57  get {
58  return this.m_liveRequests ??
59  (this.m_liveRequests = new Dictionary<Guid, string>(1));
60  }
61  }
62 
63  public bool Enabled
64  {
65  get;
66  set;
67  }
68 
69  public System.Timers.Timer Timer
70  {
71  get;
72  set;
73  }
74 
75  public double IntervalMinutes
76  {
77  get
78  {
79  if (this.Timer == null)
80  {
81  return -1.0;
82  }
83  else
84  {
85  return this.Timer.Interval / 60000.0;
86  }
87  }
88  }
89 
90  public bool BusyCheck
91  {
92  get;
93  set;
94  }
95 
96  public bool SkipAssets
97  {
98  get;
99  set;
100  }
101 
102  public string Script
103  {
104  get;
105  set;
106  }
107 
108  public string BackupDir
109  {
110  get;
111  set;
112  }
113 
114  public NamingType NamingType
115  {
116  get;
117  set;
118  }
119 
120  public int KeepFilesForDays
121  {
122  get;
123  set;
124  }
125 
126  public new string ToString()
127  {
128  string retval = "";
129 
130  retval += "[AUTO BACKUP]: AutoBackup: " + (Enabled ? "ENABLED" : "DISABLED") + "\n";
131  retval += "[AUTO BACKUP]: Interval: " + IntervalMinutes + " minutes" + "\n";
132  retval += "[AUTO BACKUP]: Do Busy Check: " + (BusyCheck ? "Yes" : "No") + "\n";
133  retval += "[AUTO BACKUP]: Naming Type: " + NamingType.ToString() + "\n";
134  retval += "[AUTO BACKUP]: Backup Dir: " + BackupDir + "\n";
135  retval += "[AUTO BACKUP]: Script: " + Script + "\n";
136  return retval;
137  }
138  }
139 }
140 
AutoBackupModuleState: Auto-Backup state for one region (scene). If you use this class in any way out...
System.Timers.Timer Timer
NamingType
Choose between ways of naming the backup files that are generated.