diff options
Whitespace cleanup.
Diffstat (limited to 'OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs')
-rw-r--r-- | OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs index 2521e99..255c5e3 100644 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs | |||
@@ -37,98 +37,98 @@ using libsecondlife; | |||
37 | 37 | ||
38 | namespace OpenGridServices.Manager | 38 | namespace OpenGridServices.Manager |
39 | { | 39 | { |
40 | public class GridServerConnectionManager | 40 | public class GridServerConnectionManager |
41 | { | 41 | { |
42 | private string ServerURL; | 42 | private string ServerURL; |
43 | public LLUUID SessionID; | 43 | public LLUUID SessionID; |
44 | public bool connected=false; | 44 | public bool connected=false; |
45 | 45 | ||
46 | public RegionBlock[][] WorldMap; | 46 | public RegionBlock[][] WorldMap; |
47 | 47 | ||
48 | public bool Connect(string GridServerURL, string username, string password) | 48 | public bool Connect(string GridServerURL, string username, string password) |
49 | { | 49 | { |
50 | try { | 50 | try { |
51 | this.ServerURL=GridServerURL; | 51 | this.ServerURL=GridServerURL; |
52 | Hashtable LoginParamsHT = new Hashtable(); | 52 | Hashtable LoginParamsHT = new Hashtable(); |
53 | LoginParamsHT["username"]=username; | 53 | LoginParamsHT["username"]=username; |
54 | LoginParamsHT["password"]=password; | 54 | LoginParamsHT["password"]=password; |
55 | ArrayList LoginParams = new ArrayList(); | 55 | ArrayList LoginParams = new ArrayList(); |
56 | LoginParams.Add(LoginParamsHT); | 56 | LoginParams.Add(LoginParamsHT); |
57 | XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams); | 57 | XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams); |
58 | XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000); | 58 | XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000); |
59 | if(GridResp.IsFault) { | 59 | if(GridResp.IsFault) { |
60 | connected=false; | 60 | connected=false; |
61 | return false; | 61 | return false; |
62 | } else { | 62 | } else { |
63 | Hashtable gridrespData = (Hashtable)GridResp.Value; | 63 | Hashtable gridrespData = (Hashtable)GridResp.Value; |
64 | this.SessionID = new LLUUID((string)gridrespData["session_id"]); | 64 | this.SessionID = new LLUUID((string)gridrespData["session_id"]); |
65 | connected=true; | 65 | connected=true; |
66 | return true; | 66 | return true; |
67 | } | 67 | } |
68 | } catch(Exception e) { | 68 | } catch(Exception e) { |
69 | Console.WriteLine(e.ToString()); | 69 | Console.WriteLine(e.ToString()); |
70 | connected=false; | 70 | connected=false; |
71 | return false; | 71 | return false; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | public void DownloadMap() | 75 | public void DownloadMap() |
76 | { | 76 | { |
77 | System.Net.WebClient mapdownloader = new WebClient(); | 77 | System.Net.WebClient mapdownloader = new WebClient(); |
78 | Stream regionliststream = mapdownloader.OpenRead(ServerURL + "/regionlist"); | 78 | Stream regionliststream = mapdownloader.OpenRead(ServerURL + "/regionlist"); |
79 | 79 | ||
80 | RegionBlock TempRegionData; | 80 | RegionBlock TempRegionData; |
81 | 81 | ||
82 | XmlDocument doc = new XmlDocument(); | 82 | XmlDocument doc = new XmlDocument(); |
83 | doc.Load(regionliststream); | 83 | doc.Load(regionliststream); |
84 | regionliststream.Close(); | 84 | regionliststream.Close(); |
85 | XmlNode rootnode = doc.FirstChild; | 85 | XmlNode rootnode = doc.FirstChild; |
86 | if (rootnode.Name != "regions") | 86 | if (rootnode.Name != "regions") |
87 | { | 87 | { |
88 | // TODO - ERROR! | 88 | // TODO - ERROR! |
89 | } | 89 | } |
90 | 90 | ||
91 | for(int i=0; i<=rootnode.ChildNodes.Count; i++) | 91 | for(int i=0; i<=rootnode.ChildNodes.Count; i++) |
92 | { | 92 | { |
93 | if(rootnode.ChildNodes.Item(i).Name != "region") { | 93 | if(rootnode.ChildNodes.Item(i).Name != "region") { |
94 | // TODO - ERROR! | 94 | // TODO - ERROR! |
95 | } else { | 95 | } else { |
96 | TempRegionData = new RegionBlock(); | 96 | TempRegionData = new RegionBlock(); |
97 | 97 | ||
98 | 98 | ||
99 | } | 99 | } |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | public bool RestartServer() | 103 | public bool RestartServer() |
104 | { | 104 | { |
105 | return true; | 105 | return true; |
106 | } | 106 | } |
107 | 107 | ||
108 | public bool ShutdownServer() | 108 | public bool ShutdownServer() |
109 | { | 109 | { |
110 | try { | 110 | try { |
111 | Hashtable ShutdownParamsHT = new Hashtable(); | 111 | Hashtable ShutdownParamsHT = new Hashtable(); |
112 | ArrayList ShutdownParams = new ArrayList(); | 112 | ArrayList ShutdownParams = new ArrayList(); |
113 | ShutdownParamsHT["session_id"]=this.SessionID.ToString(); | 113 | ShutdownParamsHT["session_id"]=this.SessionID.ToString(); |
114 | ShutdownParams.Add(ShutdownParamsHT); | 114 | ShutdownParams.Add(ShutdownParamsHT); |
115 | XmlRpcRequest GridShutdownReq = new XmlRpcRequest("shutdown",ShutdownParams); | 115 | XmlRpcRequest GridShutdownReq = new XmlRpcRequest("shutdown",ShutdownParams); |
116 | XmlRpcResponse GridResp = GridShutdownReq.Send(this.ServerURL,3000); | 116 | XmlRpcResponse GridResp = GridShutdownReq.Send(this.ServerURL,3000); |
117 | if(GridResp.IsFault) { | 117 | if(GridResp.IsFault) { |
118 | return false; | 118 | return false; |
119 | } else { | 119 | } else { |
120 | connected=false; | 120 | connected=false; |
121 | return true; | 121 | return true; |
122 | } | 122 | } |
123 | } catch(Exception e) { | 123 | } catch(Exception e) { |
124 | Console.WriteLine(e.ToString()); | 124 | Console.WriteLine(e.ToString()); |
125 | return false; | 125 | return false; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | public void DisconnectServer() | 129 | public void DisconnectServer() |
130 | { | 130 | { |
131 | this.connected=false; | 131 | this.connected=false; |
132 | } | 132 | } |
133 | } | 133 | } |
134 | } | 134 | } |