mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 09:45:47 +08:00
Added forgotten ApplicationPlugins directory and moved the load region code out to a plugin.
To make opensim search for the new plugin, you will need to delete the "addin-db-000" and "addins" sub directories in bin if you have them.
This commit is contained in:
58
OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
Normal file
58
OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.RegionLoader.Filesystem;
|
||||
using OpenSim.Framework.RegionLoader.Web;
|
||||
using Mono.Addins;
|
||||
using Mono.Addins.Description;
|
||||
using Nini;
|
||||
using Nini.Config;
|
||||
|
||||
[assembly:Addin]
|
||||
[assembly:AddinDependency ("OpenSim", "0.4")]
|
||||
|
||||
namespace OpenSim.ApplicationPlugins.Example
|
||||
{
|
||||
[Extension("/OpenSim/Startup")]
|
||||
public class LoadRegionsPlugin : IApplicationPlugin
|
||||
{
|
||||
public void Initialise(OpenSimMain openSim)
|
||||
{
|
||||
System.Console.WriteLine("Load Regions addin being initialised");
|
||||
|
||||
IRegionLoader regionLoader;
|
||||
if (openSim.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
|
||||
{
|
||||
MainLog.Instance.Notice("Loading Region Info from filesystem");
|
||||
regionLoader = new RegionLoaderFileSystem();
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Notice("Loading Region Info from web");
|
||||
regionLoader = new RegionLoaderWebServer();
|
||||
}
|
||||
|
||||
regionLoader.SetIniConfigSource(openSim.ConfigSource);
|
||||
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
|
||||
|
||||
openSim.ModuleLoader.LoadDefaultSharedModules();
|
||||
|
||||
for (int i = 0; i < regionsToLoad.Length; i++)
|
||||
{
|
||||
MainLog.Instance.Debug("Creating Region: " + regionsToLoad[i].RegionName);
|
||||
openSim.CreateRegion(regionsToLoad[i]);
|
||||
}
|
||||
|
||||
openSim.ModuleLoader.PostInitialise();
|
||||
openSim.ModuleLoader.ClearCache();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenSim.Addin")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("OpenSim.Addin")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2007")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("45b979d9-d8d4-42fd-9780-fe9ac7e86cb4")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Reference in New Issue
Block a user