diff options
author | lbsa71 | 2007-10-30 09:05:31 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-30 09:05:31 +0000 |
commit | 67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch) | |
tree | 20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | |
parent | * Deleted .user file (diff) | |
download | opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2 opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz |
* Optimized usings
* Shortened type references
* Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs')
-rw-r--r-- | OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index efe6ebb..0d48683 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | |||
@@ -26,21 +26,18 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.IO; | 29 | using System.IO; |
30 | using System.Net; | ||
33 | using System.Text; | 31 | using System.Text; |
34 | 32 | using OpenSim.Framework.Console; | |
35 | using OpenSim.Framework; | ||
36 | 33 | ||
37 | namespace OpenSim.Framework.Configuration.HTTP | 34 | namespace OpenSim.Framework.Configuration.HTTP |
38 | { | 35 | { |
39 | public class HTTPConfiguration : IGenericConfig | 36 | public class HTTPConfiguration : IGenericConfig |
40 | { | 37 | { |
41 | RemoteConfigSettings remoteConfigSettings; | 38 | private RemoteConfigSettings remoteConfigSettings; |
42 | 39 | ||
43 | XmlConfiguration xmlConfig; | 40 | private XmlConfiguration xmlConfig; |
44 | 41 | ||
45 | private string configFileName = ""; | 42 | private string configFileName = ""; |
46 | 43 | ||
@@ -62,8 +59,9 @@ namespace OpenSim.Framework.Configuration.HTTP | |||
62 | StringBuilder sb = new StringBuilder(); | 59 | StringBuilder sb = new StringBuilder(); |
63 | 60 | ||
64 | byte[] buf = new byte[8192]; | 61 | byte[] buf = new byte[8192]; |
65 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.remoteConfigSettings.baseConfigURL + this.configFileName); | 62 | HttpWebRequest request = |
66 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | 63 | (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); |
64 | HttpWebResponse response = (HttpWebResponse) request.GetResponse(); | ||
67 | 65 | ||
68 | Stream resStream = response.GetResponseStream(); | 66 | Stream resStream = response.GetResponseStream(); |
69 | 67 | ||
@@ -78,13 +76,14 @@ namespace OpenSim.Framework.Configuration.HTTP | |||
78 | tempString = Encoding.ASCII.GetString(buf, 0, count); | 76 | tempString = Encoding.ASCII.GetString(buf, 0, count); |
79 | sb.Append(tempString); | 77 | sb.Append(tempString); |
80 | } | 78 | } |
81 | } | 79 | } while (count > 0); |
82 | while (count > 0); | ||
83 | LoadDataFromString(sb.ToString()); | 80 | LoadDataFromString(sb.ToString()); |
84 | } | 81 | } |
85 | catch (WebException) | 82 | catch (WebException) |
86 | { | 83 | { |
87 | Console.MainLog.Instance.Warn("Unable to connect to remote configuration file (" + remoteConfigSettings.baseConfigURL + configFileName + "). Creating local file instead."); | 84 | MainLog.Instance.Warn("Unable to connect to remote configuration file (" + |
85 | remoteConfigSettings.baseConfigURL + configFileName + | ||
86 | "). Creating local file instead."); | ||
88 | xmlConfig.SetFileName(configFileName); | 87 | xmlConfig.SetFileName(configFileName); |
89 | xmlConfig.LoadData(); | 88 | xmlConfig.LoadData(); |
90 | } | 89 | } |
@@ -93,7 +92,6 @@ namespace OpenSim.Framework.Configuration.HTTP | |||
93 | public void LoadDataFromString(string data) | 92 | public void LoadDataFromString(string data) |
94 | { | 93 | { |
95 | xmlConfig.LoadDataFromString(data); | 94 | xmlConfig.LoadDataFromString(data); |
96 | |||
97 | } | 95 | } |
98 | 96 | ||
99 | public string GetAttribute(string attributeName) | 97 | public string GetAttribute(string attributeName) |
@@ -114,4 +112,4 @@ namespace OpenSim.Framework.Configuration.HTTP | |||
114 | { | 112 | { |
115 | } | 113 | } |
116 | } | 114 | } |
117 | } | 115 | } \ No newline at end of file |