diff options
Diffstat (limited to 'OpenSim/Server/Base')
-rw-r--r-- | OpenSim/Server/Base/Properties/AssemblyInfo.cs | 33 | ||||
-rw-r--r-- | OpenSim/Server/Base/ServicesServerBase.cs | 41 |
2 files changed, 74 insertions, 0 deletions
diff --git a/OpenSim/Server/Base/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4bbe358 --- /dev/null +++ b/OpenSim/Server/Base/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenSim.Server.Base")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("http://opensimulator.org")] | ||
12 | [assembly: AssemblyProduct("OpenSim")] | ||
13 | [assembly: AssemblyCopyright("OpenSimulator developers")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("8fbd5035-0dbc-4b9a-ad1a-a7567f254ea9")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | [assembly: AssemblyVersion("0.7.5.*")] | ||
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index b137c05..0cff6ed 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.IO; | 30 | using System.IO; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Threading; | 32 | using System.Threading; |
@@ -71,10 +72,17 @@ namespace OpenSim.Server.Base | |||
71 | // | 72 | // |
72 | private string m_pidFile = String.Empty; | 73 | private string m_pidFile = String.Empty; |
73 | 74 | ||
75 | /// <summary> | ||
76 | /// Time at which this server was started | ||
77 | /// </summary> | ||
78 | protected DateTime m_startuptime; | ||
79 | |||
74 | // Handle all the automagical stuff | 80 | // Handle all the automagical stuff |
75 | // | 81 | // |
76 | public ServicesServerBase(string prompt, string[] args) | 82 | public ServicesServerBase(string prompt, string[] args) |
77 | { | 83 | { |
84 | m_startuptime = DateTime.Now; | ||
85 | |||
78 | // Save raw arguments | 86 | // Save raw arguments |
79 | // | 87 | // |
80 | m_Arguments = args; | 88 | m_Arguments = args; |
@@ -250,6 +258,10 @@ namespace OpenSim.Server.Base | |||
250 | "command-script <script>", | 258 | "command-script <script>", |
251 | "Run a command script from file", HandleScript); | 259 | "Run a command script from file", HandleScript); |
252 | 260 | ||
261 | MainConsole.Instance.Commands.AddCommand("General", false, "show uptime", | ||
262 | "show uptime", | ||
263 | "Show server uptime", HandleShow); | ||
264 | |||
253 | 265 | ||
254 | // Allow derived classes to perform initialization that | 266 | // Allow derived classes to perform initialization that |
255 | // needs to be done after the console has opened | 267 | // needs to be done after the console has opened |
@@ -345,5 +357,34 @@ namespace OpenSim.Server.Base | |||
345 | { | 357 | { |
346 | } | 358 | } |
347 | } | 359 | } |
360 | |||
361 | public virtual void HandleShow(string module, string[] cmd) | ||
362 | { | ||
363 | List<string> args = new List<string>(cmd); | ||
364 | |||
365 | args.RemoveAt(0); | ||
366 | |||
367 | string[] showParams = args.ToArray(); | ||
368 | |||
369 | switch (showParams[0]) | ||
370 | { | ||
371 | case "uptime": | ||
372 | MainConsole.Instance.Output(GetUptimeReport()); | ||
373 | break; | ||
374 | } | ||
375 | } | ||
376 | |||
377 | /// <summary> | ||
378 | /// Return a report about the uptime of this server | ||
379 | /// </summary> | ||
380 | /// <returns></returns> | ||
381 | protected string GetUptimeReport() | ||
382 | { | ||
383 | StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now)); | ||
384 | sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime)); | ||
385 | sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime)); | ||
386 | |||
387 | return sb.ToString(); | ||
388 | } | ||
348 | } | 389 | } |
349 | } | 390 | } |