diff options
author | gareth | 2007-04-02 02:11:51 +0000 |
---|---|---|
committer | gareth | 2007-04-02 02:11:51 +0000 |
commit | 843f547684ef8a084e336361a440b72090370dd1 (patch) | |
tree | b468bc22188c1cbed2be9c0124d6995efae8b8f9 /OpenGridServices.GridServer/Main.cs | |
parent | ditto (diff) | |
download | opensim-SC_OLD-843f547684ef8a084e336361a440b72090370dd1.zip opensim-SC_OLD-843f547684ef8a084e336361a440b72090370dd1.tar.gz opensim-SC_OLD-843f547684ef8a084e336361a440b72090370dd1.tar.bz2 opensim-SC_OLD-843f547684ef8a084e336361a440b72090370dd1.tar.xz |
Moved grid configuration to Db4o database
Diffstat (limited to 'OpenGridServices.GridServer/Main.cs')
-rw-r--r-- | OpenGridServices.GridServer/Main.cs | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/OpenGridServices.GridServer/Main.cs b/OpenGridServices.GridServer/Main.cs index ce24d72..5b7f921 100644 --- a/OpenGridServices.GridServer/Main.cs +++ b/OpenGridServices.GridServer/Main.cs | |||
@@ -32,10 +32,12 @@ using System.IO; | |||
32 | using System.Text; | 32 | using System.Text; |
33 | using System.Timers; | 33 | using System.Timers; |
34 | using System.Net; | 34 | using System.Net; |
35 | using System.Reflection; | ||
35 | using libsecondlife; | 36 | using libsecondlife; |
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Sims; | 38 | using OpenSim.Framework.Sims; |
38 | using OpenSim.Framework.Console; | 39 | using OpenSim.Framework.Console; |
40 | using OpenSim.Framework.Interfaces; | ||
39 | 41 | ||
40 | namespace OpenGridServices.GridServer | 42 | namespace OpenGridServices.GridServer |
41 | { | 43 | { |
@@ -43,6 +45,8 @@ namespace OpenGridServices.GridServer | |||
43 | /// </summary> | 45 | /// </summary> |
44 | public class OpenGrid_Main : conscmd_callback | 46 | public class OpenGrid_Main : conscmd_callback |
45 | { | 47 | { |
48 | private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll"; | ||
49 | private GridConfig Cfg; | ||
46 | public static OpenGrid_Main thegrid; | 50 | public static OpenGrid_Main thegrid; |
47 | public string GridOwner; | 51 | public string GridOwner; |
48 | public string DefaultStartupMsg; | 52 | public string DefaultStartupMsg; |
@@ -91,22 +95,10 @@ namespace OpenGridServices.GridServer | |||
91 | 95 | ||
92 | public void Startup() | 96 | public void Startup() |
93 | { | 97 | { |
94 | m_console.WriteLine("Main.cs:Startup() - Please press enter to retain default settings"); | 98 | m_console.WriteLine("Main.cs:Startup() - Loading configuration"); |
99 | Cfg = this.LoadConfigDll(this.ConfigDll); | ||
100 | Cfg.InitConfig(); | ||
95 | 101 | ||
96 | this.GridOwner = m_console.CmdPrompt("Grid owner [OGS development team]: ", "OGS development team"); | ||
97 | this.DefaultStartupMsg = m_console.CmdPrompt("Default startup message for clients [Welcome to OGS!]: ", "Welcome to OGS!"); | ||
98 | |||
99 | this.DefaultAssetServer = m_console.CmdPrompt("Default asset server [no default]: "); | ||
100 | this.AssetSendKey = m_console.CmdPrompt("Key to send to asset server: "); | ||
101 | this.AssetRecvKey = m_console.CmdPrompt("Key to expect from asset server: "); | ||
102 | |||
103 | this.DefaultUserServer = m_console.CmdPrompt("Default user server [no default]: "); | ||
104 | this.UserSendKey = m_console.CmdPrompt("Key to send to user server: "); | ||
105 | this.UserRecvKey = m_console.CmdPrompt("Key to expect from user server: "); | ||
106 | |||
107 | this.SimSendKey = m_console.CmdPrompt("Key to send to sims: "); | ||
108 | this.SimRecvKey = m_console.CmdPrompt("Key to expect from sims: "); | ||
109 | |||
110 | m_console.WriteLine("Main.cs:Startup() - Loading sim profiles from database"); | 102 | m_console.WriteLine("Main.cs:Startup() - Loading sim profiles from database"); |
111 | this._regionmanager = new SimProfileManager(); | 103 | this._regionmanager = new SimProfileManager(); |
112 | _regionmanager.LoadProfiles(); | 104 | _regionmanager.LoadProfiles(); |
@@ -121,6 +113,34 @@ namespace OpenGridServices.GridServer | |||
121 | SimCheckTimer.Enabled=true; | 113 | SimCheckTimer.Enabled=true; |
122 | } | 114 | } |
123 | 115 | ||
116 | private GridConfig LoadConfigDll(string dllName) | ||
117 | { | ||
118 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
119 | GridConfig config = null; | ||
120 | |||
121 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
122 | { | ||
123 | if (pluginType.IsPublic) | ||
124 | { | ||
125 | if (!pluginType.IsAbstract) | ||
126 | { | ||
127 | Type typeInterface = pluginType.GetInterface("IGridConfig", true); | ||
128 | |||
129 | if (typeInterface != null) | ||
130 | { | ||
131 | IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
132 | config = plug.GetConfigObject(); | ||
133 | break; | ||
134 | } | ||
135 | |||
136 | typeInterface = null; | ||
137 | } | ||
138 | } | ||
139 | } | ||
140 | pluginAssembly = null; | ||
141 | return config; | ||
142 | } | ||
143 | |||
124 | public void CheckSims(object sender, ElapsedEventArgs e) { | 144 | public void CheckSims(object sender, ElapsedEventArgs e) { |
125 | foreach(SimProfileBase sim in _regionmanager.SimProfiles.Values) { | 145 | foreach(SimProfileBase sim in _regionmanager.SimProfiles.Values) { |
126 | string SimResponse=""; | 146 | string SimResponse=""; |