diff options
author | Sean Dague | 2007-07-30 20:11:40 +0000 |
---|---|---|
committer | Sean Dague | 2007-07-30 20:11:40 +0000 |
commit | 74bb5282a09ec095a7ff810c62f79cc64e187686 (patch) | |
tree | e0a9b703bfcbbab59b04351dd71508fa913e741a /OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | |
parent | added OnDisconnectUser event to required classes (diff) | |
download | opensim-SC-74bb5282a09ec095a7ff810c62f79cc64e187686.zip opensim-SC-74bb5282a09ec095a7ff810c62f79cc64e187686.tar.gz opensim-SC-74bb5282a09ec095a7ff810c62f79cc64e187686.tar.bz2 opensim-SC-74bb5282a09ec095a7ff810c62f79cc64e187686.tar.xz |
mass update of files to have native line endings
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index d72c40f..8b74195 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | |||
@@ -1,89 +1,89 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Net; | 3 | using System.Net; |
4 | using System.IO; | 4 | using System.IO; |
5 | using System.Text; | 5 | using System.Text; |
6 | 6 | ||
7 | using OpenSim.Framework.Configuration.Interfaces; | 7 | using OpenSim.Framework.Configuration.Interfaces; |
8 | 8 | ||
9 | namespace OpenSim.Framework.Configuration.HTTP | 9 | namespace OpenSim.Framework.Configuration.HTTP |
10 | { | 10 | { |
11 | public class HTTPConfiguration : IGenericConfig | 11 | public class HTTPConfiguration : IGenericConfig |
12 | { | 12 | { |
13 | RemoteConfigSettings remoteConfigSettings; | 13 | RemoteConfigSettings remoteConfigSettings; |
14 | 14 | ||
15 | XmlConfiguration xmlConfig; | 15 | XmlConfiguration xmlConfig; |
16 | 16 | ||
17 | private string configFileName = ""; | 17 | private string configFileName = ""; |
18 | 18 | ||
19 | public HTTPConfiguration() | 19 | public HTTPConfiguration() |
20 | { | 20 | { |
21 | remoteConfigSettings = new RemoteConfigSettings("remoteconfig.xml"); | 21 | remoteConfigSettings = new RemoteConfigSettings("remoteconfig.xml"); |
22 | xmlConfig = new XmlConfiguration(); | 22 | xmlConfig = new XmlConfiguration(); |
23 | } | 23 | } |
24 | 24 | ||
25 | public void SetFileName(string fileName) | 25 | public void SetFileName(string fileName) |
26 | { | 26 | { |
27 | configFileName = fileName; | 27 | configFileName = fileName; |
28 | } | 28 | } |
29 | 29 | ||
30 | public void LoadData() | 30 | public void LoadData() |
31 | { | 31 | { |
32 | try | 32 | try |
33 | { | 33 | { |
34 | StringBuilder sb = new StringBuilder(); | 34 | StringBuilder sb = new StringBuilder(); |
35 | 35 | ||
36 | byte[] buf = new byte[8192]; | 36 | byte[] buf = new byte[8192]; |
37 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.remoteConfigSettings.baseConfigURL + this.configFileName); | 37 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.remoteConfigSettings.baseConfigURL + this.configFileName); |
38 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | 38 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); |
39 | 39 | ||
40 | Stream resStream = response.GetResponseStream(); | 40 | Stream resStream = response.GetResponseStream(); |
41 | 41 | ||
42 | string tempString = null; | 42 | string tempString = null; |
43 | int count = 0; | 43 | int count = 0; |
44 | 44 | ||
45 | do | 45 | do |
46 | { | 46 | { |
47 | count = resStream.Read(buf, 0, buf.Length); | 47 | count = resStream.Read(buf, 0, buf.Length); |
48 | if (count != 0) | 48 | if (count != 0) |
49 | { | 49 | { |
50 | tempString = Encoding.ASCII.GetString(buf, 0, count); | 50 | tempString = Encoding.ASCII.GetString(buf, 0, count); |
51 | sb.Append(tempString); | 51 | sb.Append(tempString); |
52 | } | 52 | } |
53 | } | 53 | } |
54 | while (count > 0); | 54 | while (count > 0); |
55 | LoadDataFromString(sb.ToString()); | 55 | LoadDataFromString(sb.ToString()); |
56 | } | 56 | } |
57 | catch (WebException) | 57 | catch (WebException) |
58 | { | 58 | { |
59 | Console.MainLog.Instance.Warn("Unable to connect to remote configuration file (" + remoteConfigSettings.baseConfigURL + configFileName + "). Creating local file instead."); | 59 | Console.MainLog.Instance.Warn("Unable to connect to remote configuration file (" + remoteConfigSettings.baseConfigURL + configFileName + "). Creating local file instead."); |
60 | xmlConfig.SetFileName(configFileName); | 60 | xmlConfig.SetFileName(configFileName); |
61 | xmlConfig.LoadData(); | 61 | xmlConfig.LoadData(); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | public void LoadDataFromString(string data) | 65 | public void LoadDataFromString(string data) |
66 | { | 66 | { |
67 | xmlConfig.LoadDataFromString(data); | 67 | xmlConfig.LoadDataFromString(data); |
68 | 68 | ||
69 | } | 69 | } |
70 | 70 | ||
71 | public string GetAttribute(string attributeName) | 71 | public string GetAttribute(string attributeName) |
72 | { | 72 | { |
73 | return xmlConfig.GetAttribute(attributeName); | 73 | return xmlConfig.GetAttribute(attributeName); |
74 | } | 74 | } |
75 | 75 | ||
76 | public bool SetAttribute(string attributeName, string attributeValue) | 76 | public bool SetAttribute(string attributeName, string attributeValue) |
77 | { | 77 | { |
78 | return true; | 78 | return true; |
79 | } | 79 | } |
80 | 80 | ||
81 | public void Commit() | 81 | public void Commit() |
82 | { | 82 | { |
83 | } | 83 | } |
84 | 84 | ||
85 | public void Close() | 85 | public void Close() |
86 | { | 86 | { |
87 | } | 87 | } |
88 | } | 88 | } |
89 | } | 89 | } |