diff options
author | MW | 2007-11-04 22:16:13 +0000 |
---|---|---|
committer | MW | 2007-11-04 22:16:13 +0000 |
commit | 1467720f6085dc5dfefdb3e83acd7afe21a11e28 (patch) | |
tree | 924d32f57782df808b35bb2b6e485be280f2860f /OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |
parent | * Small touchup of console messages (diff) | |
download | opensim-SC-1467720f6085dc5dfefdb3e83acd7afe21a11e28.zip opensim-SC-1467720f6085dc5dfefdb3e83acd7afe21a11e28.tar.gz opensim-SC-1467720f6085dc5dfefdb3e83acd7afe21a11e28.tar.bz2 opensim-SC-1467720f6085dc5dfefdb3e83acd7afe21a11e28.tar.xz |
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.
Diffstat (limited to 'OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs')
-rw-r--r-- | OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs new file mode 100644 index 0000000..f0232e6 --- /dev/null +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |||
@@ -0,0 +1,58 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim; | ||
5 | using OpenSim.Framework.Console; | ||
6 | using OpenSim.Framework; | ||
7 | using OpenSim.Framework.RegionLoader.Filesystem; | ||
8 | using OpenSim.Framework.RegionLoader.Web; | ||
9 | using Mono.Addins; | ||
10 | using Mono.Addins.Description; | ||
11 | using Nini; | ||
12 | using Nini.Config; | ||
13 | |||
14 | [assembly:Addin] | ||
15 | [assembly:AddinDependency ("OpenSim", "0.4")] | ||
16 | |||
17 | namespace OpenSim.ApplicationPlugins.Example | ||
18 | { | ||
19 | [Extension("/OpenSim/Startup")] | ||
20 | public class LoadRegionsPlugin : IApplicationPlugin | ||
21 | { | ||
22 | public void Initialise(OpenSimMain openSim) | ||
23 | { | ||
24 | System.Console.WriteLine("Load Regions addin being initialised"); | ||
25 | |||
26 | IRegionLoader regionLoader; | ||
27 | if (openSim.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") | ||
28 | { | ||
29 | MainLog.Instance.Notice("Loading Region Info from filesystem"); | ||
30 | regionLoader = new RegionLoaderFileSystem(); | ||
31 | } | ||
32 | else | ||
33 | { | ||
34 | MainLog.Instance.Notice("Loading Region Info from web"); | ||
35 | regionLoader = new RegionLoaderWebServer(); | ||
36 | } | ||
37 | |||
38 | regionLoader.SetIniConfigSource(openSim.ConfigSource); | ||
39 | RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); | ||
40 | |||
41 | openSim.ModuleLoader.LoadDefaultSharedModules(); | ||
42 | |||
43 | for (int i = 0; i < regionsToLoad.Length; i++) | ||
44 | { | ||
45 | MainLog.Instance.Debug("Creating Region: " + regionsToLoad[i].RegionName); | ||
46 | openSim.CreateRegion(regionsToLoad[i]); | ||
47 | } | ||
48 | |||
49 | openSim.ModuleLoader.PostInitialise(); | ||
50 | openSim.ModuleLoader.ClearCache(); | ||
51 | } | ||
52 | |||
53 | public void Close() | ||
54 | { | ||
55 | |||
56 | } | ||
57 | } | ||
58 | } | ||