aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Configuration/HTTP
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Framework/Configuration/HTTP
parent* Deleted .user file (diff)
downloadopensim-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')
-rw-r--r--OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs26
-rw-r--r--OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs20
2 files changed, 22 insertions, 24 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
29using System;
30using System.Collections.Generic;
31using System.Net;
32using System.IO; 29using System.IO;
30using System.Net;
33using System.Text; 31using System.Text;
34 32using OpenSim.Framework.Console;
35using OpenSim.Framework;
36 33
37namespace OpenSim.Framework.Configuration.HTTP 34namespace 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
diff --git a/OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs b/OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs
index 3ac03bb..332066c 100644
--- a/OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs
+++ b/OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs
@@ -26,12 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33using OpenSim.Framework;
34
35namespace OpenSim.Framework.Configuration.HTTP 29namespace OpenSim.Framework.Configuration.HTTP
36{ 30{
37 public class RemoteConfigSettings 31 public class RemoteConfigSettings
@@ -39,24 +33,30 @@ namespace OpenSim.Framework.Configuration.HTTP
39 private ConfigurationMember configMember; 33 private ConfigurationMember configMember;
40 34
41 public string baseConfigURL = ""; 35 public string baseConfigURL = "";
36
42 public RemoteConfigSettings(string filename) 37 public RemoteConfigSettings(string filename)
43 { 38 {
44 configMember = new ConfigurationMember(filename, "REMOTE CONFIG SETTINGS", loadConfigurationOptions, handleIncomingConfiguration); 39 configMember =
40 new ConfigurationMember(filename, "REMOTE CONFIG SETTINGS", loadConfigurationOptions,
41 handleIncomingConfiguration);
45 configMember.forceConfigurationPluginLibrary("OpenSim.Framework.Configuration.XML.dll"); 42 configMember.forceConfigurationPluginLibrary("OpenSim.Framework.Configuration.XML.dll");
46 configMember.performConfigurationRetrieve(); 43 configMember.performConfigurationRetrieve();
47 } 44 }
48 45
49 public void loadConfigurationOptions() 46 public void loadConfigurationOptions()
50 { 47 {
51 configMember.addConfigurationOption("base_config_url", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "URL Containing Configuration Files", "http://localhost/", false); 48 configMember.addConfigurationOption("base_config_url",
49 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
50 "URL Containing Configuration Files", "http://localhost/", false);
52 } 51 }
52
53 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 53 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
54 { 54 {
55 if (configuration_key == "base_config_url") 55 if (configuration_key == "base_config_url")
56 { 56 {
57 baseConfigURL = (string)configuration_result; 57 baseConfigURL = (string) configuration_result;
58 } 58 }
59 return true; 59 return true;
60 } 60 }
61 } 61 }
62} 62} \ No newline at end of file