Ported Gareth's Server Console, so is nearly ready for a remerge back into trunk.

ConvertToPlugins
MW 2007-03-06 20:13:03 +00:00
parent 6938500aef
commit 087965ba1b
20 changed files with 561 additions and 152 deletions

View File

@ -36,17 +36,15 @@ namespace Db40SimConfig
{
public SimConfig GetConfigObject()
{
Console.WriteLine("Loading Config dll");
ServerConsole.MainConsole.Instance.WriteLine("Loading Db40Config dll");
return ( new DbSimConfig());
}
}
public class DbSimConfig :SimConfig
{
private IObjectContainer db;
public void LoadDefaults() {
this.RegionName = "OpenSim test\0";
this.RegionLocX = 997;
@ -65,7 +63,7 @@ namespace Db40SimConfig
db = Db4oFactory.OpenFile("opensim.yap");
IObjectSet result = db.Get(typeof(DbSimConfig));
if(result.Count==1) {
Console.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading");
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading");
foreach (DbSimConfig cfg in result) {
this.RegionName = cfg.RegionName;
this.RegionLocX = cfg.RegionLocX;
@ -79,27 +77,27 @@ namespace Db40SimConfig
this.GridSendKey = cfg.GridSendKey;
}
} else {
Console.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
LoadDefaults();
Console.WriteLine("Writing out default settings to local database");
ServerConsole.MainConsole.Instance.WriteLine("Writing out default settings to local database");
db.Set(this);
}
} catch(Exception e) {
db.Close();
Console.WriteLine("Config.cs:InitConfig() - Exception occured");
Console.WriteLine(e.ToString());
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Exception occured");
ServerConsole.MainConsole.Instance.WriteLine(e.ToString());
}
}
public override World LoadWorld() {
IObjectSet world_result = db.Get(typeof(OpenSim.world.World));
if(world_result.Count==1) {
Console.WriteLine("Config.cs:LoadWorld() - Found an OpenSim.world.World object in local database, loading");
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found an OpenSim.world.World object in local database, loading");
return (World)world_result.Next();
} else {
Console.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one");
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one");
World blank = new World();
Console.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk");
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk");
db.Set(blank);
db.Commit();
return blank;
@ -107,7 +105,7 @@ namespace Db40SimConfig
}
public override void LoadFromGrid() {
Console.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
// TODO: Make this crap work
/* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login");
WebResponse GridResponse = GridLogin.GetResponse();

View File

@ -31,7 +31,7 @@
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Db4objects.Db4o">
<HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
<HintPath>..\..\..\..\..\Program Files\Db4objects\db4o-6.1\bin\net-2.0\Db4objects.Db4o.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup>
@ -39,5 +39,11 @@
<Compile Include="Db4SimConfig.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj">
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
<Name>ServerConsole</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

View File

@ -70,7 +70,7 @@ namespace LocalGridServers
public LocalAssetServer()
{
this._assetRequests = new BlockingQueue<ARequest>();
Console.WriteLine("Local Asset Server class created");
ServerConsole.MainConsole.Instance.WriteLine("Local Asset Server class created");
}
public void SetReceiver(IAssetReceiver receiver)
@ -117,7 +117,7 @@ namespace LocalGridServers
public LocalGridServer()
{
Sessions = new List<Login>();
Console.WriteLine("Local Grid Server class created");
ServerConsole.MainConsole.Instance.WriteLine("Local Grid Server class created");
}
public bool RequestConnection()

View File

@ -26,10 +26,6 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="GridInterfaces">
<HintPath>..\..\..\GridInterfaces\GridInterfaces\bin\Debug\GridInterfaces.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="libsecondlife">
<HintPath>..\..\..\Libsecond-dailys\libsl-03-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
@ -39,5 +35,15 @@
<Compile Include="LocalGrid.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj">
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
<Name>ServerConsole</Name>
</ProjectReference>
<ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj">
<Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
<Name>GridInterfaces</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

View File

@ -42,6 +42,7 @@ using libsecondlife.Packets;
using OpenSim.world;
using OpenSim.GridServers;
using OpenSim.Assets;
using ServerConsole;
using PhysicsSystem;
namespace OpenSim
@ -76,6 +77,8 @@ namespace OpenSim
{
//Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
Console.WriteLine("Starting...\n");
ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0);
sim = new OpenSim_Main();
bool sandbox = false;
@ -98,17 +101,15 @@ namespace OpenSim
OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll";
OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll";
OpenSim_Main.gridServers.LoadPlugins();
Console.WriteLine("Starting in Sandbox mode");
ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode");
}
else
{
OpenSim_Main.gridServers.AssetDll = "RemoteGridServers.dll";
OpenSim_Main.gridServers.GridDll = "RemoteGridServers.dll";
OpenSim_Main.gridServers.LoadPlugins();
Console.WriteLine("Starting in Grid mode");
ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode");
}
OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey);
OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey);
if(loginserver && sandbox)
{
@ -118,10 +119,10 @@ namespace OpenSim
assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer);
sim.Startup();
//while(true) {
Console.ReadLine();
Thread.Sleep(1000);
//}
while(true) {
ServerConsole.MainConsole.Instance.MainConsolePrompt();
}
}
private OpenSim_Main() {
@ -133,20 +134,22 @@ namespace OpenSim
timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick );
// We check our local database first, then the grid for config options
Console.WriteLine("Main.cs:Startup() - Loading configuration");
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
cfg = this.LoadConfigDll();
cfg.InitConfig();
Console.WriteLine("Main.cs:Startup() - Contacting gridserver");
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver");
cfg.LoadFromGrid();
Console.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString());
Console.WriteLine("Initialising world");
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString());
ServerConsole.MainConsole.Instance.WriteLine("Initialising world");
local_world = cfg.LoadWorld();
this.physManager = new PhysicsSystem.PhysicsManager();
this.physManager.LoadPlugins();
Console.WriteLine("Main.cs:Startup() - Starting up messaging system");
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
local_world.PhysScene = this.physManager.GetPhysicsScene("PhysX"); //should be reading from the config file what physics engine to use
OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey);
OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey);
MainServerListener();
@ -202,24 +205,34 @@ namespace OpenSim
}
private void MainServerListener() {
Console.WriteLine("Main.cs:MainServerListener() - New thread started");
Console.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort);
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started");
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort);
ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort);
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
Server.Bind(ServerIncoming);
Console.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen");
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen");
ipeSender = new IPEndPoint(IPAddress.Any, 0);
epSender = (EndPoint) ipeSender;
ReceivedData = new AsyncCallback(this.OnReceivedData);
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
Console.WriteLine("Main.cs:MainServerListener() - Listening...");
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening...");
}
public static void Shutdown() {
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads");
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing listener thread");
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients");
// IMPLEMENT THIS
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
ServerConsole.MainConsole.Instance.Close();
Environment.Exit(0);
}
void Timer1Tick( object sender, System.EventArgs e )
{
local_world.Update();
@ -239,7 +252,7 @@ namespace OpenSim
public void LoadPlugins()
{
this.AssetServer =(IAssetServer) this.LoadAssetDll();//assets not implemented yet
this.AssetServer =(IAssetServer) this.LoadAssetDll();
this.GridServer =(IGridServer) this.LoadGridDll();
}

View File

@ -130,8 +130,8 @@ namespace OpenSim
{
if (now - packet.TickCount > RESEND_TIMEOUT)
{
Console.WriteLine("Resending " + packet.Type.ToString() + " packet, " +
(now - packet.TickCount) + "ms have passed", Helpers.LogLevel.Info);
ServerConsole.MainConsole.Instance.WriteLine("Resending " + packet.Type.ToString() + " packet, " +
(now - packet.TickCount) + "ms have passed");
packet.Header.Resent = true;
OutPacket(packet);
@ -149,11 +149,11 @@ namespace OpenSim
if (PendingAcks.Count > 250)
{
// FIXME: Handle the odd case where we have too many pending ACKs queued up
Console.WriteLine("Too many ACKs queued up!", Helpers.LogLevel.Error);
ServerConsole.MainConsole.Instance.WriteLine("Too many ACKs queued up!");
return;
}
Console.WriteLine("Sending PacketAck");
ServerConsole.MainConsole.Instance.WriteLine("Sending PacketAck");
int i = 0;
@ -242,7 +242,7 @@ namespace OpenSim
}
}
Console.WriteLine("OUT: \n" + Pack.ToString());
ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString());
byte[] ZeroOutBuffer = new byte[4096];
byte[] sendbuffer;
@ -256,7 +256,7 @@ namespace OpenSim
OpenSim_Main.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None,userEP);
}
} catch (Exception) {
Console.WriteLine("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread");
ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread");
ClientThread.Abort();
}
@ -312,7 +312,7 @@ namespace OpenSim
}
public OpenSimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack) {
Console.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
cirpack = initialcirpack;
userEP = remoteEP;
PacketQueue = new BlockingQueue<QueItem>();
@ -326,7 +326,7 @@ namespace OpenSim
}
private void ClientLoop() {
Console.WriteLine("OpenSimClient.cs:ClientLoop() - Entered loop");
ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ClientLoop() - Entered loop");
while(true) {
QueItem nextPacket = PacketQueue.Dequeue();
if(nextPacket.Incoming)
@ -343,7 +343,7 @@ namespace OpenSim
}
private void InitNewClient() {
Console.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
OpenSim_Main.local_world.AddViewerAgent(this);
world.Entity tempent=OpenSim_Main.local_world.Entities[this.AgentID];
this.ClientAvatar=(world.Avatar)tempent;
@ -355,12 +355,12 @@ namespace OpenSim
if(!sessionInfo.Authorised)
{
//session/circuit not authorised
Console.WriteLine("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString());
ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString());
ClientThread.Abort();
}
else
{
Console.WriteLine("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString());
ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString());
//session is authorised
this.AgentID=cirpack.CircuitCode.ID;
this.SessionID=cirpack.CircuitCode.SessionID;

194
src/OpenSimConsole.cs Normal file
View File

@ -0,0 +1,194 @@
/*
* 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 <organization> 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 <copyright holder> ``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 <copyright holder> 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 ServerConsole;
namespace OpenSim
{
/// <summary>
/// Description of ServerConsole.
/// </summary>
public class MServerConsole : 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 MServerConsole(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();
}
// You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here
public override void WriteLine(string Line) {
Log.WriteLine(Line);
Console.WriteLine(Line);
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;
}
public override void Write(string Line) {
Console.Write(Line);
Log.Write(Line);
return;
}
// 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");
break;
case "show":
ShowCommands(cmdparams[0]);
break;
case "shutdown":
OpenSim_Main.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 " + OpenSim_Main.startuptime.ToString());
// this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.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 OpenSim_Main.local_world.Entities.Keys) {
TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.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-" + OpenSim_Main.cfg.RegionHandle.ToString() + " # ");
tempstrarray = tempstr.Split(' ');
string cmd=tempstrarray[0];
Array.Reverse(tempstrarray);
Array.Resize<string>(ref tempstrarray,tempstrarray.Length-1);
Array.Reverse(tempstrarray);
string[] cmdparams=(string[])tempstrarray;
RunCmd(cmd,cmdparams);
}
}
}

View File

@ -72,7 +72,7 @@ namespace RemoteGridServers
public RemoteGridServer()
{
Console.WriteLine("Remote Grid Server class created");
ServerConsole.MainConsole.Instance.WriteLine("Remote Grid Server class created");
}
public bool RequestConnection()
@ -147,7 +147,7 @@ namespace RemoteGridServers
this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests));
this._remoteAssetServerThread.IsBackground = true;
this._remoteAssetServerThread.Start();
Console.WriteLine("Remote Asset Server class created");
ServerConsole.MainConsole.Instance.WriteLine("Remote Asset Server class created");
}
public void SetReceiver(IAssetReceiver receiver)
@ -186,7 +186,7 @@ namespace RemoteGridServers
//we need to add support for the asset server not knowing about a requested asset
ARequest req = this._assetRequests.Dequeue();
LLUUID assetID = req.AssetID;
Console.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it");
ServerConsole.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it");
WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data");
WebResponse AssetResponse = AssetLoad.GetResponse();
byte[] idata = new byte[(int)AssetResponse.ContentLength];

View File

@ -30,14 +30,20 @@
<HintPath>..\..\..\Libsecond-dailys\libsl-03-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="GridInterfaces">
<HintPath>..\..\..\GridInterfaces\GridInterfaces\bin\Debug\GridInterfaces.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="RemoteGrid.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj">
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
<Name>ServerConsole</Name>
</ProjectReference>
<ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj">
<Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
<Name>GridInterfaces</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

View File

@ -39,10 +39,6 @@
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="PhysicsManager">
<HintPath>..\physics\PhysicsManager\bin\Release\PhysicsManager.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="log4net">
<HintPath>..\Version0_2_myserver\OpenSim\bin\Debug\log4net.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
@ -55,16 +51,11 @@
<HintPath>..\Version0_2_myserver\OpenSim\bin\Debug\libsecondlife.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="GridInterfaces">
<HintPath>..\GridInterfaces\GridInterfaces\bin\Debug\GridInterfaces.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="Main.cs" />
<Compile Include="OpenSimClient.cs" />
<Compile Include="types\BitPack.cs" />
<Compile Include="types\Mesh.cs" />
<Compile Include="types\Triangle.cs" />
<Compile Include="Util.cs" />
@ -78,10 +69,23 @@
<Compile Include="world\World.cs" />
<Compile Include="GridServers\LoginServer.cs" />
<Compile Include="Assets\AssetCache.cs" />
<Compile Include="OpenSimConsole.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="GridServers" />
<Folder Include="Assets" />
<ProjectReference Include="GridInterfaces\GridInterfaces.csproj">
<Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
<Name>GridInterfaces</Name>
</ProjectReference>
<ProjectReference Include="physics\PhysicsManager.csproj">
<Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project>
<Name>PhysicsManager</Name>
</ProjectReference>
<ProjectReference Include="ServerConsole\ServerConsole\ServerConsole.csproj">
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
<Name>ServerConsole</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

View File

@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysicsManager", "physics\P
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysXplugin", "physics\plugins\PhysXplugin.csproj", "{ADB751AA-8426-4668-B1FA-43762126CEB3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole\ServerConsole.csproj", "{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET 1.1 = Debug|.NET 1.1
@ -79,6 +81,14 @@ Global
{ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1
{ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.Build.0 = Release|Any CPU
{ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|.NET 1.1.Build.0 = Release|.NET 1.1
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.Build.0 = Release|Any CPU
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,31 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("ServerConsole")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ServerConsole")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.*")]

View File

@ -0,0 +1,91 @@
/*
* 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 <organization> 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 <copyright holder> ``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 <copyright holder> 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;
namespace ServerConsole
{
public class MainConsole {
private static ConsoleBase instance;
public static ConsoleBase Instance
{
get
{
return instance;
}
set
{
instance = value;
}
}
public MainConsole()
{
}
}
public abstract class ConsoleBase
{
public enum ConsoleType {
Local, // Use stdio
TCP, // Use TCP/telnet
SimChat // Use in-world chat (for gods)
}
public abstract void Close();
// You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here
public abstract void WriteLine(string Line) ;
public abstract string ReadLine();
public abstract int Read() ;
public abstract void Write(string Line) ;
// Displays a command prompt and waits for the user to enter a string, then returns that string
public abstract string CmdPrompt(string prompt) ;
// Displays a command prompt and returns a default value if the user simply presses enter
public abstract string CmdPrompt(string prompt, string defaultresponse);
// Displays a command prompt and returns a default value, user may only enter 1 of 2 options
public abstract string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) ;
// Runs a command with a number of parameters
public abstract Object RunCmd(string Cmd, string[] cmdparams) ;
// Shows data about something
public abstract void ShowCommands(string ShowWhat) ;
// Displays a prompt to the user and then runs the command they entered
public abstract void MainConsolePrompt() ;
}
}

View File

@ -0,0 +1,35 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>ServerConsole</RootNamespace>
<AssemblyName>ServerConsole</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ServerConsole.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

View File

@ -0,0 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.1.0.2017
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole.csproj", "{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}"
EndProject
Global
EndGlobal

View File

@ -48,12 +48,12 @@ namespace PhysicsSystem
{
if(_plugins.ContainsKey(engineName))
{
Console.WriteLine("creating "+engineName);
ServerConsole.MainConsole.Instance.WriteLine("creating "+engineName);
return _plugins[engineName].GetScene();
}
else
{
Console.WriteLine("couldn't find physicsEngine: "+ engineName);
ServerConsole.MainConsole.Instance.WriteLine("couldn't find physicsEngine: "+ engineName);
return null;
}
}

View File

@ -31,5 +31,11 @@
<Compile Include="PhysicsManager.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ServerConsole\ServerConsole\ServerConsole.csproj">
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
<Name>ServerConsole</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

View File

@ -26,14 +26,16 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="PhysicsManager">
<HintPath>..\..\PhysicsManager\bin\Release\PhysicsManager.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="PhysXplugin.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PhysicsManager.csproj">
<Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project>
<Name>PhysicsManager</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

View File

@ -21,7 +21,7 @@ namespace OpenSim.world
private List<NewForce> forcesList = new List<NewForce>();
public Avatar(OpenSimClient TheClient) {
Console.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
ControllingClient=TheClient;
SetupTemplate("avatar-template.dat");
position = new LLVector3(100.0f,100.0f,30.0f);
@ -100,7 +100,7 @@ namespace OpenSim.world
}
public void CompleteMovement(World RegionInfo) {
Console.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
mov.AgentData.SessionID = this.ControllingClient.SessionID;
mov.AgentData.AgentID = this.ControllingClient.AgentID;
@ -110,7 +110,7 @@ namespace OpenSim.world
mov.Data.Position = new LLVector3(100f, 100f, 23f);
mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
Console.WriteLine("Sending AgentMovementComplete packet");
ServerConsole.MainConsole.Instance.WriteLine("Sending AgentMovementComplete packet");
ControllingClient.OutPacket(mov);
}
@ -199,11 +199,11 @@ namespace OpenSim.world
//should be moved somewhere else
public void SendRegionHandshake(World RegionInfo) {
Console.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet");
ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet");
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
RegionHandshakePacket handshake = new RegionHandshakePacket();
Console.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details");
ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details");
handshake.RegionInfo.BillableFactor = 0;
handshake.RegionInfo.IsEstateManager = false;
handshake.RegionInfo.TerrainHeightRange00 = 60;
@ -229,7 +229,7 @@ namespace OpenSim.world
handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37");
Console.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet");
ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet");
this.ControllingClient.OutPacket(handshake);
}

View File

@ -21,17 +21,17 @@ namespace OpenSim.world
public World()
{
Console.WriteLine("World.cs - creating new entitities instance");
ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance");
Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
Console.WriteLine("World.cs - creating LandMap");
ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
terrainengine = new TerrainDecode();
LandMap = new float[65536];
for(int i =0; i < 65536; i++) {
LandMap[i] = 21.4989f;
}
Console.WriteLine("World.cs - Creating script engine instance");
ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance");
// Initialise this only after the world has loaded
Scripts = new ScriptEngine(this);
}
@ -73,11 +73,11 @@ namespace OpenSim.world
}
public void AddViewerAgent(OpenSimClient AgentClient) {
Console.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
Avatar NewAvatar = new Avatar(AgentClient);
Console.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
this.Entities.Add(AgentClient.AgentID, NewAvatar);
Console.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
NewAvatar.SendRegionHandshake(this);
NewAvatar.PhysActor = this.phyScene.AddAvatar(new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z));