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/Region/Application/OpenSimController.cs | |
parent | * Deleted .user file (diff) | |
download | opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2 opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz |
* Optimized usings
* Shortened type references
* Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Region/Application/OpenSimController.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSimController.cs | 68 |
1 files changed, 28 insertions, 40 deletions
diff --git a/OpenSim/Region/Application/OpenSimController.cs b/OpenSim/Region/Application/OpenSimController.cs index da93b54..1fa4b04 100644 --- a/OpenSim/Region/Application/OpenSimController.cs +++ b/OpenSim/Region/Application/OpenSimController.cs | |||
@@ -1,28 +1,15 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | ||
3 | using System.Collections; | 2 | using System.Collections; |
4 | using System.IO; | 3 | using System.Net; |
5 | using System.Text; | 4 | using System.Timers; |
6 | using Nini.Config; | 5 | using Nwc.XmlRpc; |
7 | using OpenSim.Framework.Communications.Cache; | 6 | using OpenSim.Framework; |
8 | using OpenSim.Framework.Console; | 7 | using OpenSim.Framework.Console; |
9 | using OpenSim.Framework.Interfaces; | ||
10 | using OpenSim.Framework.Servers; | 8 | using OpenSim.Framework.Servers; |
11 | using OpenSim.Framework; | ||
12 | using OpenSim.Framework; | ||
13 | using OpenSim.Region.ClientStack; | ||
14 | using OpenSim.Region.Communications.Local; | ||
15 | using OpenSim.Region.Communications.OGS1; | ||
16 | using OpenSim.Region.Environment; | ||
17 | using OpenSim.Region.Environment.Scenes; | ||
18 | using OpenSim.Region.Physics.Manager; | ||
19 | using System.Globalization; | ||
20 | using Nwc.XmlRpc; | ||
21 | using RegionInfo = OpenSim.Framework.RegionInfo; | ||
22 | 9 | ||
23 | namespace OpenSim | 10 | namespace OpenSim |
24 | { | 11 | { |
25 | class OpenSimController | 12 | internal class OpenSimController |
26 | { | 13 | { |
27 | private OpenSimMain m_app; | 14 | private OpenSimMain m_app; |
28 | private BaseHttpServer m_httpServer; | 15 | private BaseHttpServer m_httpServer; |
@@ -44,22 +31,23 @@ namespace OpenSim | |||
44 | { | 31 | { |
45 | MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request"); | 32 | MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request"); |
46 | XmlRpcResponse response = new XmlRpcResponse(); | 33 | XmlRpcResponse response = new XmlRpcResponse(); |
47 | Hashtable requestData = (Hashtable)request.Params[0]; | 34 | Hashtable requestData = (Hashtable) request.Params[0]; |
48 | 35 | ||
49 | if ((string)requestData["shutdown"] == "delayed") | 36 | if ((string) requestData["shutdown"] == "delayed") |
50 | { | 37 | { |
51 | int timeout = Convert.ToInt32((string)requestData["milliseconds"]); | 38 | int timeout = Convert.ToInt32((string) requestData["milliseconds"]); |
52 | 39 | ||
53 | Hashtable responseData = new Hashtable(); | 40 | Hashtable responseData = new Hashtable(); |
54 | responseData["accepted"] = "true"; | 41 | responseData["accepted"] = "true"; |
55 | response.Value = responseData; | 42 | response.Value = responseData; |
56 | 43 | ||
57 | m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() + " second(s). Please save what you are doing and log out."); | 44 | m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() + |
45 | " second(s). Please save what you are doing and log out."); | ||
58 | 46 | ||
59 | // Perform shutdown | 47 | // Perform shutdown |
60 | System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing | 48 | Timer shutdownTimer = new Timer(timeout); // Wait before firing |
61 | shutdownTimer.AutoReset = false; | 49 | shutdownTimer.AutoReset = false; |
62 | shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed); | 50 | shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); |
63 | 51 | ||
64 | return response; | 52 | return response; |
65 | } | 53 | } |
@@ -72,15 +60,15 @@ namespace OpenSim | |||
72 | m_app.SceneManager.SendGeneralMessage("Region is going down now."); | 60 | m_app.SceneManager.SendGeneralMessage("Region is going down now."); |
73 | 61 | ||
74 | // Perform shutdown | 62 | // Perform shutdown |
75 | System.Timers.Timer shutdownTimer = new System.Timers.Timer(2000); // Wait 2 seconds before firing | 63 | Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing |
76 | shutdownTimer.AutoReset = false; | 64 | shutdownTimer.AutoReset = false; |
77 | shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed); | 65 | shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); |
78 | 66 | ||
79 | return response; | 67 | return response; |
80 | } | 68 | } |
81 | } | 69 | } |
82 | 70 | ||
83 | void shutdownTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) | 71 | private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e) |
84 | { | 72 | { |
85 | m_app.Shutdown(); | 73 | m_app.Shutdown(); |
86 | } | 74 | } |
@@ -89,28 +77,28 @@ namespace OpenSim | |||
89 | { | 77 | { |
90 | MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request"); | 78 | MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request"); |
91 | XmlRpcResponse response = new XmlRpcResponse(); | 79 | XmlRpcResponse response = new XmlRpcResponse(); |
92 | Hashtable requestData = (Hashtable)request.Params[0]; | 80 | Hashtable requestData = (Hashtable) request.Params[0]; |
93 | 81 | ||
94 | RegionInfo newRegionData = new RegionInfo(); | 82 | RegionInfo newRegionData = new RegionInfo(); |
95 | 83 | ||
96 | try | 84 | try |
97 | { | 85 | { |
98 | newRegionData.RegionID = (string)requestData["region_id"]; | 86 | newRegionData.RegionID = (string) requestData["region_id"]; |
99 | newRegionData.RegionName = (string)requestData["region_name"]; | 87 | newRegionData.RegionName = (string) requestData["region_name"]; |
100 | newRegionData.RegionLocX = Convert.ToUInt32((string)requestData["region_x"]); | 88 | newRegionData.RegionLocX = Convert.ToUInt32((string) requestData["region_x"]); |
101 | newRegionData.RegionLocY = Convert.ToUInt32((string)requestData["region_y"]); | 89 | newRegionData.RegionLocY = Convert.ToUInt32((string) requestData["region_y"]); |
102 | 90 | ||
103 | // Security risk | 91 | // Security risk |
104 | newRegionData.DataStore = (string)requestData["datastore"]; | 92 | newRegionData.DataStore = (string) requestData["datastore"]; |
105 | 93 | ||
106 | newRegionData.InternalEndPoint = new System.Net.IPEndPoint( | 94 | newRegionData.InternalEndPoint = new IPEndPoint( |
107 | System.Net.IPAddress.Parse((string)requestData["listen_ip"]), 0); | 95 | IPAddress.Parse((string) requestData["listen_ip"]), 0); |
108 | 96 | ||
109 | newRegionData.InternalEndPoint.Port = Convert.ToInt32((string)requestData["listen_port"]); | 97 | newRegionData.InternalEndPoint.Port = Convert.ToInt32((string) requestData["listen_port"]); |
110 | newRegionData.ExternalHostName = (string)requestData["external_address"]; | 98 | newRegionData.ExternalHostName = (string) requestData["external_address"]; |
111 | 99 | ||
112 | newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"]; | 100 | newRegionData.MasterAvatarFirstName = (string) requestData["region_master_first"]; |
113 | newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"]; | 101 | newRegionData.MasterAvatarLastName = (string) requestData["region_master_last"]; |
114 | 102 | ||
115 | m_app.CreateRegion(newRegionData); | 103 | m_app.CreateRegion(newRegionData); |
116 | 104 | ||
@@ -129,4 +117,4 @@ namespace OpenSim | |||
129 | return response; | 117 | return response; |
130 | } | 118 | } |
131 | } | 119 | } |
132 | } | 120 | } \ No newline at end of file |