diff options
author | mingchen | 2007-11-03 15:09:21 +0000 |
---|---|---|
committer | mingchen | 2007-11-03 15:09:21 +0000 |
commit | 51488ee7f415950583ba389582692900a2c32831 (patch) | |
tree | 7b63fdbb54e9a1bbb3ae7a6ed8d6eac8933e8dbb /OpenSim/Framework/RegionLoader | |
parent | testing different rest post method/class for Grid asset client. (possible tha... (diff) | |
download | opensim-SC-51488ee7f415950583ba389582692900a2c32831.zip opensim-SC-51488ee7f415950583ba389582692900a2c32831.tar.gz opensim-SC-51488ee7f415950583ba389582692900a2c32831.tar.bz2 opensim-SC-51488ee7f415950583ba389582692900a2c32831.tar.xz |
*Moved region loading into its own interface IRegionLoader
*Added ability to load regioninfo remotely from a webserver from a single file. See share/RegionLoading/HOWTO_REMOTE_REGION_LOADING.txt for more info and an example file.
Diffstat (limited to '')
4 files changed, 394 insertions, 0 deletions
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/OpenSim.Framework.RegionLoader.Filesystem.csproj b/OpenSim/Framework/RegionLoader/Filesystem/OpenSim.Framework.RegionLoader.Filesystem.csproj new file mode 100644 index 0000000..d353d1b --- /dev/null +++ b/OpenSim/Framework/RegionLoader/Filesystem/OpenSim.Framework.RegionLoader.Filesystem.csproj | |||
@@ -0,0 +1,112 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{9A0DA098-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Framework.RegionLoader.Filesystem</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Framework.RegionLoader.Filesystem</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Db4objects.Db4o.dll" > | ||
62 | <HintPath>..\..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="Nini.dll" > | ||
70 | <HintPath>..\..\..\..\bin\Nini.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System" > | ||
74 | <HintPath>System.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | <Reference Include="XMLRPC.dll" > | ||
82 | <HintPath>..\..\..\..\bin\XMLRPC.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
85 | </ItemGroup> | ||
86 | <ItemGroup> | ||
87 | <ProjectReference Include="..\..\OpenSim.Framework.csproj"> | ||
88 | <Name>OpenSim.Framework</Name> | ||
89 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
90 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
91 | <Private>False</Private> | ||
92 | </ProjectReference> | ||
93 | <ProjectReference Include="..\..\Console\OpenSim.Framework.Console.csproj"> | ||
94 | <Name>OpenSim.Framework.Console</Name> | ||
95 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
96 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
97 | <Private>False</Private> | ||
98 | </ProjectReference> | ||
99 | </ItemGroup> | ||
100 | <ItemGroup> | ||
101 | <Compile Include="RegionLoaderFileSystem.cs"> | ||
102 | <SubType>Code</SubType> | ||
103 | </Compile> | ||
104 | </ItemGroup> | ||
105 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
106 | <PropertyGroup> | ||
107 | <PreBuildEvent> | ||
108 | </PreBuildEvent> | ||
109 | <PostBuildEvent> | ||
110 | </PostBuildEvent> | ||
111 | </PropertyGroup> | ||
112 | </Project> | ||
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs new file mode 100644 index 0000000..5ebcb64 --- /dev/null +++ b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs | |||
@@ -0,0 +1,72 @@ | |||
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 OpenSim 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 | using System.Text; | ||
31 | using Nini.Config; | ||
32 | using OpenSim.Framework; | ||
33 | using System.IO; | ||
34 | |||
35 | namespace OpenSim.Framework.RegionLoader.Filesystem | ||
36 | { | ||
37 | public class RegionLoaderFileSystem : IRegionLoader | ||
38 | { | ||
39 | public void SetIniConfigSource(IniConfigSource configSource) | ||
40 | { | ||
41 | } | ||
42 | public RegionInfo[] LoadRegions() | ||
43 | { | ||
44 | string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); | ||
45 | |||
46 | if (!Directory.Exists(regionConfigPath)) | ||
47 | { | ||
48 | Directory.CreateDirectory(regionConfigPath); | ||
49 | } | ||
50 | |||
51 | string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); | ||
52 | |||
53 | if (configFiles.Length == 0) | ||
54 | { | ||
55 | new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "default.xml")); | ||
56 | configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); | ||
57 | } | ||
58 | |||
59 | RegionInfo[] regionInfos = new RegionInfo[configFiles.Length]; | ||
60 | for (int i = 0; i < configFiles.Length; i++) | ||
61 | { | ||
62 | |||
63 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i]); | ||
64 | regionInfos[i] = regionInfo; | ||
65 | } | ||
66 | |||
67 | |||
68 | return regionInfos; | ||
69 | } | ||
70 | |||
71 | } | ||
72 | } | ||
diff --git a/OpenSim/Framework/RegionLoader/Web/OpenSim.Framework.RegionLoader.Web.csproj b/OpenSim/Framework/RegionLoader/Web/OpenSim.Framework.RegionLoader.Web.csproj new file mode 100644 index 0000000..18dcebf --- /dev/null +++ b/OpenSim/Framework/RegionLoader/Web/OpenSim.Framework.RegionLoader.Web.csproj | |||
@@ -0,0 +1,112 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{CA806165-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Framework.RegionLoader.Web</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Framework.RegionLoader.Web</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Db4objects.Db4o.dll" > | ||
62 | <HintPath>..\..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="Nini.dll" > | ||
70 | <HintPath>..\..\..\..\bin\Nini.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System" > | ||
74 | <HintPath>System.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | <Reference Include="XMLRPC.dll" > | ||
82 | <HintPath>..\..\..\..\bin\XMLRPC.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
85 | </ItemGroup> | ||
86 | <ItemGroup> | ||
87 | <ProjectReference Include="..\..\OpenSim.Framework.csproj"> | ||
88 | <Name>OpenSim.Framework</Name> | ||
89 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
90 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
91 | <Private>False</Private> | ||
92 | </ProjectReference> | ||
93 | <ProjectReference Include="..\..\Console\OpenSim.Framework.Console.csproj"> | ||
94 | <Name>OpenSim.Framework.Console</Name> | ||
95 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
96 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
97 | <Private>False</Private> | ||
98 | </ProjectReference> | ||
99 | </ItemGroup> | ||
100 | <ItemGroup> | ||
101 | <Compile Include="RegionLoaderWebServer.cs"> | ||
102 | <SubType>Code</SubType> | ||
103 | </Compile> | ||
104 | </ItemGroup> | ||
105 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
106 | <PropertyGroup> | ||
107 | <PreBuildEvent> | ||
108 | </PreBuildEvent> | ||
109 | <PostBuildEvent> | ||
110 | </PostBuildEvent> | ||
111 | </PropertyGroup> | ||
112 | </Project> | ||
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs new file mode 100644 index 0000000..6a52a43 --- /dev/null +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | |||
@@ -0,0 +1,98 @@ | |||
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 OpenSim 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.Net; | ||
30 | using System.IO; | ||
31 | using System.Xml; | ||
32 | using System.Collections.Generic; | ||
33 | using System.Text; | ||
34 | using Nini.Config; | ||
35 | using OpenSim.Framework; | ||
36 | |||
37 | namespace OpenSim.Framework.RegionLoader.Web | ||
38 | { | ||
39 | public class RegionLoaderWebServer : IRegionLoader | ||
40 | { | ||
41 | private IniConfigSource m_configSouce; | ||
42 | public void SetIniConfigSource(IniConfigSource configSource) | ||
43 | { | ||
44 | m_configSouce = configSource; | ||
45 | } | ||
46 | public RegionInfo[] LoadRegions() | ||
47 | { | ||
48 | if (m_configSouce == null) | ||
49 | { | ||
50 | Console.MainLog.Instance.Error("Unable to load configuration source! (WebServer Region Loader)"); | ||
51 | return null; | ||
52 | } | ||
53 | else | ||
54 | { | ||
55 | IniConfig startupConfig = (IniConfig)m_configSouce.Configs["Startup"]; | ||
56 | string url = startupConfig.GetString("regionload_webserver_url","").Trim(); | ||
57 | if (url == "") | ||
58 | { | ||
59 | Console.MainLog.Instance.Error("Unable to load webserver URL - URL was empty (WebServer Region Loader"); | ||
60 | return null; | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | |||
65 | HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); | ||
66 | webRequest.Timeout = 30000; //30 Second Timeout | ||
67 | Console.MainLog.Instance.Debug("Sending Download Request..."); | ||
68 | HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); | ||
69 | Console.MainLog.Instance.Debug("Downloading Region Information From Remote Server..."); | ||
70 | StreamReader reader = new StreamReader(webResponse.GetResponseStream()); | ||
71 | string xmlSource = ""; | ||
72 | string tempStr = reader.ReadLine(); | ||
73 | while (tempStr != null) | ||
74 | { | ||
75 | xmlSource = xmlSource + tempStr; | ||
76 | tempStr = reader.ReadLine(); | ||
77 | } | ||
78 | Console.MainLog.Instance.Debug("Done downloading region information from server. Total Bytes: " + xmlSource.Length); | ||
79 | XmlDocument xmlDoc = new XmlDocument(); | ||
80 | xmlDoc.LoadXml(xmlSource); | ||
81 | if (xmlDoc.FirstChild.Name == "Regions") | ||
82 | { | ||
83 | RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count]; | ||
84 | int i; | ||
85 | for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) | ||
86 | { | ||
87 | Console.MainLog.Instance.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); | ||
88 | regionInfos[i] = new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i]); | ||
89 | } | ||
90 | |||
91 | return regionInfos; | ||
92 | } | ||
93 | return null; | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | } | ||
98 | } | ||