示例#1
0
        /// <summary>
        /// Most interesting/complex code paths in AutoBackup begin here.
        /// We read lots of Nini config, maybe set a timer, add members to state tracking Dictionaries, etc.
        /// </summary>
        /// <param name="scene">The scene to (possibly) perform AutoBackup on.</param>
        void IRegionModuleBase.RegionLoaded(Scene scene)
        {
            if (!this.m_enabled)
            {
                return;
            }

            // This really ought not to happen, but just in case, let's pretend it didn't...
            if (scene == null)
            {
                return;
            }

            AutoBackupModuleState abms = this.ParseConfig(scene, false);

            m_log.Debug("[AUTO BACKUP]: Config for " + scene.RegionInfo.RegionName);
            m_log.Debug((abms == null ? "DEFAULT" : abms.ToString()));
        }
示例#2
0
        /// <summary>
        /// Called once in the lifetime of the module at startup.
        /// </summary>
        /// <param name="source">The input config source for OpenSim.ini.</param>
        public void Initialise(IConfigSource source)
        {
            // Determine if we have been enabled at all in OpenSim.ini -- this is part and parcel of being an optional module
            m_configSource = source;
            IConfig moduleConfig = source.Configs["AutoBackupModule"];

            if (moduleConfig == null)
            {
                m_enabled = false;
                return;
            }

            m_enabled = moduleConfig.GetBoolean("AutoBackupModuleEnabled", false);
            if (!m_enabled)
            {
                return;
            }

            ParseDefaultConfig(moduleConfig);
            if (!m_enabled)
            {
                return;
            }

            m_log.Debug("[AUTO BACKUP]: Default config:");
            m_log.Debug(m_defaultState.ToString());

            m_log.Info("[AUTO BACKUP]: AutoBackupModule enabled");
            m_masterTimer           = new Timer();
            m_masterTimer.Interval  = m_baseInterval;
            m_masterTimer.Elapsed  += HandleElapsed;
            m_masterTimer.AutoReset = false;

            m_console = MainConsole.Instance;

            m_console.Commands.AddCommand(
                "AutoBackup", true, "dooarbackup",
                "dooarbackup <regionName> | ALL",
                "saves the single region <regionName> to a oar or ALL regions in instance to oars, using same settings as AutoBackup. Note it restarts time interval", DoBackup);
            m_busy = true;
        }
示例#3
0
        /// <summary>
        /// Called once in the lifetime of the module at startup.
        /// </summary>
        /// <param name="source">The input config source for OpenSim.ini.</param>
        void IRegionModuleBase.Initialise(IConfigSource source)
        {
            // Determine if we have been enabled at all in OpenSim.ini -- this is part and parcel of being an optional module
            this.m_configSource = source;
            IConfig moduleConfig = source.Configs["AutoBackupModule"];

            if (moduleConfig == null)
            {
                this.m_enabled = false;
                return;
            }
            else
            {
                this.m_enabled = moduleConfig.GetBoolean("AutoBackupModuleEnabled", false);
                if (this.m_enabled)
                {
                    m_log.Info("[AUTO BACKUP]: AutoBackupModule enabled");
                }
                else
                {
                    return;
                }
            }

            Timer defTimer = new Timer(43200000);

            this.m_defaultState.Timer = defTimer;
            this.m_timers.Add(43200000, defTimer);
            defTimer.Elapsed  += this.HandleElapsed;
            defTimer.AutoReset = true;
            defTimer.Start();

            AutoBackupModuleState abms = this.ParseConfig(null, true);

            m_log.Debug("[AUTO BACKUP]: Here is the default config:");
            m_log.Debug(abms.ToString());
        }