From a4fc6b5fbba7fd9a7b147b11a0d1c3ded1834d54 Mon Sep 17 00:00:00 2001
From: lbsa71
Date: Tue, 27 Mar 2007 08:10:15 +0000
Subject: * Now there's one Console class, and instead the apps responds to
cmd's and show's * Removed Golden Future TCP/SimChat options * Moved
Ode.NET.dll to bin and changed prebuild accordingly (due to Prebuild
limitations) * Normalized some namespaces * Added FxCop project * Added (temp
disabled) Servers project (for great justice)
---
OpenSim.RegionServer/ConsoleCmds.cs | 0
OpenSim.RegionServer/OpenSim.RegionServer.csproj | 11 +-
.../OpenSim.RegionServer.dll.build | 139 +++++++-------
OpenSim.RegionServer/OpenSimMain.cs | 53 +++++-
OpenSim.RegionServer/SimClient.cs | 2 +-
OpenSim.RegionServer/SimConsole.cs | 211 ---------------------
OpenSim.RegionServer/world/World.cs | 2 +-
7 files changed, 131 insertions(+), 287 deletions(-)
create mode 100644 OpenSim.RegionServer/ConsoleCmds.cs
(limited to 'OpenSim.RegionServer')
diff --git a/OpenSim.RegionServer/ConsoleCmds.cs b/OpenSim.RegionServer/ConsoleCmds.cs
new file mode 100644
index 0000000..e69de29
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index 2b19e20..2455f79 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -3,7 +3,7 @@
Local
8.0.50727
2.0
- {A88526E3-397A-479D-93E1-8865F3336A87}
+ {4171D545-81F5-4C64-AD29-6D7414C38181}
Debug
AnyCPU
@@ -82,19 +82,19 @@
OpenSim.Framework.Console
- {F5AD51E9-CF59-4C70-A586-CBD161EBB85F}
+ {7AED7536-7D6B-4E28-8016-B5A554C663B4}
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
False
OpenSim.Physics.Manager
- {12F74CC6-E820-4716-8A34-A7B67B9EB3CC}
+ {0AAA0EEB-1F2C-4B4B-9BFA-7C3E45BCD348}
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
False
OpenSim.Framework
- {26E437F6-BA50-44CD-BB44-E911E25CA88C}
+ {90D4F7AF-D75E-4DE8-A0E1-70CC242B31A1}
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
False
@@ -103,6 +103,9 @@
Code
+
+ Code
+
Code
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
index dced3ae..37e4c3a 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
@@ -1,69 +1,70 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index cb184e8..e26f200 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -48,7 +48,7 @@ using OpenSim.Physics.Manager;
namespace OpenSim
{
- public class OpenSimMain : OpenSimApplication
+ public class OpenSimMain : OpenSimApplication, conscmd_callback
{
private Dictionary clientCircuits = new Dictionary();
private PhysicsManager physManager;
@@ -67,8 +67,12 @@ namespace OpenSim
public bool sandbox = false;
public bool loginserver = false;
+ protected ConsoleBase m_console;
+
public OpenSimMain()
{
+ m_console = new ConsoleBase("region-console.log", "Region", this);
+ OpenSim.Framework.Console.MainConsole.Instance = m_console;
}
public override void StartUp()
@@ -246,6 +250,53 @@ namespace OpenSim
{
OpenSimRoot.Instance.LocalWorld.Update();
}
+
+ public void RunCmd(string command, string[] cmdparams)
+ {
+ switch (command)
+ {
+ case "help":
+ m_console.WriteLine("show users - show info about connected users");
+ m_console.WriteLine("shutdown - disconnect all clients and shutdown");
+ m_console.WriteLine("regenerate - regenerate the sim's terrain");
+ break;
+
+ case "show":
+ Show(cmdparams[0]);
+ break;
+
+ case "regenerate":
+ OpenSimRoot.Instance.LocalWorld.RegenerateTerrain();
+ break;
+
+ case "shutdown":
+ OpenSimRoot.Instance.Shutdown();
+ break;
+ }
+ }
+
+ public void Show(string ShowWhat)
+ {
+ switch (ShowWhat)
+ {
+ case "uptime":
+ m_console.WriteLine("OpenSim has been running since " + OpenSimRoot.Instance.startuptime.ToString());
+ m_console.WriteLine("That is " + (DateTime.Now - OpenSimRoot.Instance.startuptime).ToString());
+ break;
+ case "users":
+ OpenSim.world.Avatar TempAv;
+ m_console.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP"));
+ foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys)
+ {
+ if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
+ {
+ TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID];
+ m_console.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()));
+ }
+ }
+ break;
+ }
+ }
}
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index c6a9407..d463c75 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -490,7 +490,7 @@ namespace OpenSim
}
}
- //ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString());
+ //MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString());
byte[] ZeroOutBuffer = new byte[4096];
byte[] sendbuffer;
diff --git a/OpenSim.RegionServer/SimConsole.cs b/OpenSim.RegionServer/SimConsole.cs
index d6d5e44..e69de29 100644
--- a/OpenSim.RegionServer/SimConsole.cs
+++ b/OpenSim.RegionServer/SimConsole.cs
@@ -1,211 +0,0 @@
-/*
-* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.IO;
-using System.Net;
-using libsecondlife;
-using libsecondlife.Packets;
-using OpenSim.Framework.Console;
-
-namespace OpenSim
-{
- ///
- /// Description of ServerConsole.
- ///
- public class SimConsole : ConsoleBase
- {
-
- private ConsoleType ConsType;
- StreamWriter Log;
-
-
- // STUPID HACK ALERT!!!! STUPID HACK ALERT!!!!!
- // constype - the type of console to use (see enum ConsoleType)
- // sparam - depending on the console type:
- // TCP - the IP to bind to (127.0.0.1 if blank)
- // Local - param ignored
- // SimChat - the AgentID of this sim's admin
- // and for the iparam:
- // TCP - the port to bind to
- // Local - param ignored
- // SimChat - the chat channel to accept commands from
- public SimConsole(ConsoleType constype, string sparam, int iparam) {
- ConsType = constype;
- switch(constype) {
- case ConsoleType.Local:
-
- Console.WriteLine("ServerConsole.cs - creating new local console");
- Console.WriteLine("Logs will be saved to current directory in opensim-console.log");
- Log=File.AppendText("opensim-console.log");
- Log.WriteLine("========================================================================");
- //Log.WriteLine("OpenSim " + VersionInfo.Version + " Started at " + DateTime.Now.ToString());
- break;
- case ConsoleType.TCP:
- break;
- case ConsoleType.SimChat:
- break;
-
- default:
- Console.WriteLine("ServerConsole.cs - what are you smoking? that isn't a valid console type!");
- break;
- }
- }
-
- public override void Close() {
- Log.WriteLine("OpenSim shutdown at " + DateTime.Now.ToString());
- Log.Close();
- }
-
- public override void Write(string format, params object[] args)
- {
- Log.Write(format, args);
- Console.Write(format, args);
- return;
- }
-
- public override void WriteLine(string format, params object[] args)
- {
- Log.WriteLine(format, args);
- Console.WriteLine(format, args);
- return;
- }
-
- public override string ReadLine()
- {
- string TempStr=Console.ReadLine();
- Log.WriteLine(TempStr);
- return TempStr;
- }
-
- public override int Read() {
- int TempInt= Console.Read();
- Log.Write((char)TempInt);
- return TempInt;
- }
-
- // Displays a command prompt and waits for the user to enter a string, then returns that string
- public override string CmdPrompt(string prompt) {
- this.Write(prompt);
- return this.ReadLine();
- }
-
- // Displays a command prompt and returns a default value if the user simply presses enter
- public override string CmdPrompt(string prompt, string defaultresponse) {
- string temp=CmdPrompt(prompt);
- if(temp=="") {
- return defaultresponse;
- } else {
- return temp;
- }
- }
-
- // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
- public override string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) {
- bool itisdone=false;
- string temp=CmdPrompt(prompt,defaultresponse);
- while(itisdone==false) {
- if((temp==OptionA) || (temp==OptionB)) {
- itisdone=true;
- } else {
- this.WriteLine("Valid options are " + OptionA + " or " + OptionB);
- temp=CmdPrompt(prompt,defaultresponse);
- }
- }
- return temp;
- }
-
- // Runs a command with a number of parameters
- public override Object RunCmd(string Cmd, string[] cmdparams) {
- switch(Cmd) {
- case "help":
- this.WriteLine("show users - show info about connected users");
- this.WriteLine("shutdown - disconnect all clients and shutdown");
- this.WriteLine("regenerate - regenerate the sim's terrain");
- break;
-
- case "show":
- ShowCommands(cmdparams[0]);
- break;
-
- case "regenerate":
- OpenSimRoot.Instance.LocalWorld.RegenerateTerrain();
- break;
-
- case "shutdown":
- OpenSimRoot.Instance.Shutdown();
- break;
- }
- return null;
- }
-
- // Shows data about something
- public override void ShowCommands(string ShowWhat) {
- switch(ShowWhat) {
- case "uptime":
- this.WriteLine("OpenSim has been running since " + OpenSimRoot.Instance.startuptime.ToString());
- this.WriteLine("That is " + (DateTime.Now-OpenSimRoot.Instance.startuptime).ToString());
- break;
- case "users":
- OpenSim.world.Avatar TempAv;
- this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP"));
- foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) {
- if(OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString()== "OpenSim.world.Avatar")
- {
- TempAv=(OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID];
- this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}",TempAv.firstname, TempAv.lastname,UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()));
- }
- }
- break;
- }
- }
-
- // Displays a prompt to the user and then runs the command they entered
- public override void MainConsolePrompt() {
- string[] tempstrarray;
- string tempstr = this.CmdPrompt("OpenSim-" + OpenSimRoot.Instance.Cfg.RegionHandle.ToString() + " # ");
- tempstrarray = tempstr.Split(' ');
- string cmd=tempstrarray[0];
- Array.Reverse(tempstrarray);
- Array.Resize(ref tempstrarray,tempstrarray.Length-1);
- Array.Reverse(tempstrarray);
- string[] cmdparams=(string[])tempstrarray;
- RunCmd(cmd,cmdparams);
- }
-
-
- public override void SetStatus(string status)
- {
- Console.Write( status + "\r" );
- }
- }
-}
-
-
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs
index 06a673a..e6d8921 100644
--- a/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim.RegionServer/world/World.cs
@@ -34,7 +34,7 @@ namespace OpenSim.world
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
TerrainManager = new TerrainManager(new SecondLife());
Avatar.SetupTemplate("avatar-template.dat");
- // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance");
+ // MainConsole.Instance.WriteLine("World.cs - Creating script engine instance");
// Initialise this only after the world has loaded
// Scripts = new ScriptEngine(this);
Avatar.LoadAnims();
--
cgit v1.1