From 89d242d246cbe8023af9b428257053e92572a8c8 Mon Sep 17 00:00:00 2001
From: cw
Date: Thu, 1 Feb 2007 00:15:47 +0000
Subject: Cleanup

---
 Agent_Manager.cs       |   2 +-
 Asset_manager.cs       |   2 +-
 Class1.cs              |  23 -----
 Controller.cs          | 229 +++++++++++++++++++++++++++++++++++++++++
 Main-sever.Designer.cs |  80 ---------------
 Main-sever.cs          | 270 -------------------------------------------------
 Main-sever.resx        | 123 ----------------------
 Prim_manager.cs        |   2 +-
 Second-server.csproj   |  34 +++----
 Second-server.sln      |  23 ++++-
 Server.cs              |   2 +-
 Texture_manager.cs     |   2 +-
 lib/Axiom.MathLib.dll  | Bin 0 -> 69632 bytes
 lib/log4net.dll        | Bin 0 -> 270336 bytes
 14 files changed, 269 insertions(+), 523 deletions(-)
 delete mode 100644 Class1.cs
 create mode 100644 Controller.cs
 delete mode 100644 Main-sever.Designer.cs
 delete mode 100644 Main-sever.cs
 delete mode 100644 Main-sever.resx
 create mode 100644 lib/Axiom.MathLib.dll
 create mode 100644 lib/log4net.dll

diff --git a/Agent_Manager.cs b/Agent_Manager.cs
index 934fb57..3b05480 100644
--- a/Agent_Manager.cs
+++ b/Agent_Manager.cs
@@ -192,7 +192,7 @@ namespace Second_server
 		{
 			
 			//shouldn't really have to read all this in from disk for every new client?
-				 string data_path=System.Windows.Forms.Application.StartupPath + @"\layer_data\";
+				 string data_path=System.AppDomain.CurrentDomain.BaseDirectory + @"\layer_data\";
 			
 				//send layerdata
 				LayerDataPacket layerpack=new LayerDataPacket();
diff --git a/Asset_manager.cs b/Asset_manager.cs
index 194d28f..3723e1d 100644
--- a/Asset_manager.cs
+++ b/Asset_manager.cs
@@ -118,7 +118,7 @@ namespace Second_server
 		}
 		private void load_asset(Asset_info info)
 		{
-			 string data_path=System.Windows.Forms.Application.StartupPath + @"\assets\";
+            string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\assets\";
 			string filename=data_path+@info.filename;
 			FileInfo fInfo = new FileInfo(filename);
 
diff --git a/Class1.cs b/Class1.cs
deleted file mode 100644
index 761a7eb..0000000
--- a/Class1.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Created by SharpDevelop.
- * User: Ma
- * Date: 29/01/2007
- * Time: 18:02
- * 
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
-
-using System;
-
-namespace Second_server
-{
-	/// <summary>
-	/// Description of Class1.
-	/// </summary>
-	public class Class1
-	{
-		public Class1()
-		{
-		}
-	}
-}
diff --git a/Controller.cs b/Controller.cs
new file mode 100644
index 0000000..351ff65
--- /dev/null
+++ b/Controller.cs
@@ -0,0 +1,229 @@
+/*
+Copyright (c) 2007 Michael Wright
+
+* Copyright (c) <year>, <copyright holder>
+* All rights reserved.
+*
+* 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.Timers;
+using System.Collections.Generic;
+using libsecondlife;
+using libsecondlife.Packets;
+using System.Collections;
+using System.Text;
+using System.IO;
+using Axiom.MathLib;
+using log4net;
+
+namespace Second_server {
+    /// <summary>
+    /// Description of MainForm.
+    /// </summary>
+    public partial class Controller : Server_callback {
+
+
+
+        [STAThread]
+        public static void Main( string[] args ) {
+            Controller c = new Controller();
+            while( true ) // fuckin' a
+                System.Threading.Thread.Sleep( 1000 );
+
+        }
+        public Server server;
+
+        private Agent_Manager agent_man;
+        private Prim_manager prim_man;
+        private Texture_manager texture_man;
+        private Asset_manager asset_man;
+        private Login_manager login_man;  //built in login server
+        private ulong time;  //ticks 
+        private Timer timer1 = new Timer();
+        
+
+        public Controller() {
+            server = new Server( this );
+            agent_man = new Agent_Manager( this.server );
+            prim_man = new Prim_manager( this.server );
+            texture_man = new Texture_manager( this.server );
+            asset_man = new Asset_manager( this.server );
+            prim_man.agent_man = agent_man;
+            agent_man.prim_man = prim_man;
+            login_man = new Login_manager();  // startup 
+            login_man.startup();  			// login server
+            timer1.Enabled = true;
+            timer1.Interval = 200;
+            timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick );
+             
+
+        }
+        public void main_callback( Packet pack, User_Agent_info User_info ) {
+            if( ( pack.Type != PacketType.StartPingCheck ) && ( pack.Type != PacketType.AgentUpdate ) ) {
+                System.Console.WriteLine(pack.Type);
+                //this.richTextBox1.Text=this.richTextBox1.Text+"\n  "+pack.Type;
+            }
+            if( pack.Type == PacketType.AgentSetAppearance ) {
+                System.Console.WriteLine(pack);
+                //this.richTextBox1.Text=this.richTextBox1.Text+"\n  "+pack.Type;
+
+            }
+            if( pack.Type == PacketType.TransferRequest ) {
+                TransferRequestPacket tran = (TransferRequestPacket)pack;
+                LLUUID id = new LLUUID( tran.TransferInfo.Params, 0 );
+
+                if( ( id == new LLUUID( "66c41e39-38f9-f75a-024e-585989bfab73" ) ) || ( id == new LLUUID( "e0ee49b5a4184df8d3c9a65361fe7f49" ) ) ) {
+                    //System.Console.WriteLine(pack);
+                    //System.Console.WriteLine(tran.TransferInfo.TransferID);
+                    asset_man.add_request( User_info, id, tran );
+                    //this.richTextBox1.Text=this.richTextBox1.Text+"\n  "+pack.Type;
+                }
+
+            }
+            if( ( pack.Type == PacketType.StartPingCheck ) ) {
+                //reply to pingcheck
+                libsecondlife.Packets.StartPingCheckPacket startp = (libsecondlife.Packets.StartPingCheckPacket)pack;
+                libsecondlife.Packets.CompletePingCheckPacket endping = new CompletePingCheckPacket();
+                endping.PingID.PingID = startp.PingID.PingID;
+                server.SendPacket( endping, true, User_info );
+            }
+            if( pack.Type == PacketType.CompleteAgentMovement ) {
+                // new client	
+                agent_man.Agent_join( User_info );
+            }
+            if( pack.Type == PacketType.RequestImage ) {
+                RequestImagePacket image_req = (RequestImagePacket)pack;
+                for( int i = 0; i < image_req.RequestImage.Length; i++ ) {
+                    this.texture_man.add_request( User_info, image_req.RequestImage[ i ].Image );
+
+                }
+            }
+            if( pack.Type == PacketType.RegionHandshakeReply ) {
+                //recieved regionhandshake so can now start sending info
+                agent_man.send_intial_data( User_info );
+                //this.setuptemplates("objectupate164.dat",User_info,false);
+            }
+            if( pack.Type == PacketType.ObjectAdd ) {
+                ObjectAddPacket ad = (ObjectAddPacket)pack;
+                prim_man.create_prim( User_info, ad.ObjectData.RayEnd, ad );
+                //this.send_prim(User_info,ad.ObjectData.RayEnd, ad);
+            }
+            if( pack.Type == PacketType.ObjectPosition ) {
+                //System.Console.WriteLine(pack.ToString());
+            }
+            if( pack.Type == PacketType.MultipleObjectUpdate ) {
+                //System.Console.WriteLine(pack.ToString());
+                MultipleObjectUpdatePacket mupd = (MultipleObjectUpdatePacket)pack;
+
+                for( int i = 0; i < mupd.ObjectData.Length; i++ ) {
+                    if( mupd.ObjectData[ i ].Type == 9 ) //change position
+					{
+                        libsecondlife.LLVector3 pos = new LLVector3( mupd.ObjectData[ i ].Data, 0 );
+
+                        prim_man.update_prim_position( User_info, pos.X, pos.Y, pos.Z, mupd.ObjectData[ i ].ObjectLocalID );
+                        //should update stored position of the prim
+                    }
+                }
+            }
+            if( pack.Type == PacketType.AgentWearablesRequest ) {
+                agent_man.send_intial_avatar_apper( User_info );
+            }
+
+            if( pack.Type == PacketType.AgentUpdate ) {
+                AgentUpdatePacket ag = (AgentUpdatePacket)pack;
+                uint mask = ag.AgentData.ControlFlags & ( 1 );
+                Avatar_data m_av = agent_man.Get_Agent( User_info.AgentID );
+                if( m_av != null ) {
+                    if( m_av.started ) {
+                        if( mask == ( 1 ) ) {
+                            if( !m_av.walk ) {
+                                //start walking
+                                agent_man.send_move_command( User_info, false, m_av.pos.X, m_av.pos.Y, m_av.pos.Z, 0, ag.AgentData.BodyRotation );
+                                Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3( 1, 0, 0 );
+                                Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion( ag.AgentData.BodyRotation.W, ag.AgentData.BodyRotation.X, ag.AgentData.BodyRotation.Y, ag.AgentData.BodyRotation.Z );
+                                Axiom.MathLib.Vector3 direc = q * v3;
+                                direc.Normalize();
+                                direc = direc * ( ( 0.03f ) * 128f );
+
+                                m_av.vel.X = direc.x;
+                                m_av.vel.Y = direc.y;
+                                m_av.vel.Z = direc.z;
+                                m_av.walk = true;
+                            }
+                        }
+                        else {
+                            if( m_av.walk ) {
+                                //walking but key not pressed so need to stop
+                                agent_man.send_move_command( User_info, true, m_av.pos.X, m_av.pos.Y, m_av.pos.Z, 0, ag.AgentData.BodyRotation );
+                                m_av.walk = false;
+                                m_av.vel.X = 0;
+                                m_av.vel.Y = 0;
+                                m_av.vel.Z = 0;
+                            }
+                        }
+                    }
+                }
+            }
+
+            if( pack.Type == PacketType.ChatFromViewer ) {
+                ChatFromViewerPacket chat = (ChatFromViewerPacket)pack;
+                System.Text.Encoding enc = System.Text.Encoding.ASCII;
+
+                string myString = enc.GetString( chat.ChatData.Message );
+                if( myString != "" ) {
+                    string[] comp = new string[ 10 ];
+                    string delimStr = " ,	";
+                    char[] delimiter = delimStr.ToCharArray();
+                    string line;
+
+                    line = myString;
+                    comp = line.Split( delimiter );
+                    if( comp[ 0 ] == "pos" ) {
+                    }
+                    else if( comp[ 0 ] == "veloc" ) {
+                    }
+                    else {
+                        agent_man.send_chat_message( User_info, line );
+
+                    }
+                }
+            }
+        }
+        public void new_user( User_Agent_info User_info ) {
+            Console.WriteLine( "new user - {0} - has joined [session {1}]", User_info.AgentID.ToString(), User_info.SessionID.ToString() );
+            agent_man.New_Agent( User_info );
+        }
+
+        public void error( string text ) {
+            Console.WriteLine( "error report: {0}", text );
+        }
+
+        void Timer1Tick( object sender, System.EventArgs e ) {
+            this.time++;
+            agent_man.tick();
+            texture_man.Do_work( time );
+        }
+    }
+}
\ No newline at end of file
diff --git a/Main-sever.Designer.cs b/Main-sever.Designer.cs
deleted file mode 100644
index af8cfe8..0000000
--- a/Main-sever.Designer.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-Copyright (c) 2007 Michael Wright
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*/
-namespace Second_server
-{
-	partial class Main_server : System.Windows.Forms.Form
-	{
-		/// <summary>
-		/// Designer variable used to keep track of non-visual components.
-		/// </summary>
-		private System.ComponentModel.IContainer components = null;
-		
-		/// <summary>
-		/// Disposes resources used by the form.
-		/// </summary>
-		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
-		protected override void Dispose(bool disposing)
-		{
-			if (disposing) {
-				if (components != null) {
-					components.Dispose();
-				}
-			}
-			base.Dispose(disposing);
-		}
-		
-		/// <summary>
-		/// This method is required for Windows Forms designer support.
-		/// Do not change the method contents inside the source code editor. The Forms designer might
-		/// not be able to load this method if it was changed manually.
-		/// </summary>
-		private void InitializeComponent()
-		{
-			this.components = new System.ComponentModel.Container();
-			this.richTextBox1 = new System.Windows.Forms.RichTextBox();
-			this.timer1 = new System.Windows.Forms.Timer(this.components);
-			this.SuspendLayout();
-			// 
-			// richTextBox1
-			// 
-			this.richTextBox1.Location = new System.Drawing.Point(11, 12);
-			this.richTextBox1.Name = "richTextBox1";
-			this.richTextBox1.Size = new System.Drawing.Size(346, 402);
-			this.richTextBox1.TabIndex = 0;
-			this.richTextBox1.Text = "";
-			// 
-			// timer1
-			// 
-			this.timer1.Enabled = true;
-			this.timer1.Interval = 200;
-			this.timer1.Tick += new System.EventHandler(this.Timer1Tick);
-			// 
-			// Main_server
-			// 
-			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
-			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-			this.ClientSize = new System.Drawing.Size(596, 426);
-			this.Controls.Add(this.richTextBox1);
-			this.Name = "Main_server";
-			this.Text = "Main_sever";
-			this.ResumeLayout(false);
-		}
-		private System.Windows.Forms.Timer timer1;
-		private System.Windows.Forms.RichTextBox richTextBox1;
-	}
-}
diff --git a/Main-sever.cs b/Main-sever.cs
deleted file mode 100644
index 911d9d7..0000000
--- a/Main-sever.cs
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
-Copyright (c) 2007 Michael Wright
-
-* Copyright (c) <year>, <copyright holder>
-* All rights reserved.
-*
-* 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.Generic;
-using System.Drawing;
-using System.Windows.Forms;
-using libsecondlife;
-using libsecondlife.Packets;
-using System.Collections;
-using System.Text;
-using System.IO;
-using Axiom.MathLib;
-
-namespace Second_server
-{
-	/// <summary>
-	/// Description of MainForm.
-	/// </summary>
-	public partial class Main_server:Server_callback
-	{
-		
-		[STAThread]
-		public static void Main(string[] args)
-		{
-			Application.EnableVisualStyles();
-			Application.SetCompatibleTextRenderingDefault(false);
-			Application.Run(new Main_server());
-		}
-		public Server server;
-		
-		//public bool intin=false;
-		//private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock avatar_template;
-		//private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock object_template;
-
-		private Agent_Manager agent_man;
-		private Prim_manager prim_man;
-		private Texture_manager texture_man;
-		private Asset_manager asset_man;
-		private Login_manager login_man;  //built in login server
-		private ulong time;  //ticks 
-		
-		public Main_server()
-		{
-			//
-			// The InitializeComponent() call is required for Windows Forms designer support.
-			//
-			InitializeComponent();
-			
-			//
-			// TODO: Add constructor code after the InitializeComponent() call.
-			//
-			
-			server=new Server(this);
-			agent_man=new Agent_Manager(this.server);
-			prim_man=new Prim_manager(this.server);
-			texture_man=new Texture_manager(this.server);
-			asset_man=new Asset_manager(this.server);
-			prim_man.agent_man=agent_man;
-			agent_man.prim_man=prim_man;
-			login_man=new Login_manager();  // startup 
-			login_man.startup();  			// login server
-			
-		}
-		public  void main_callback(Packet pack, User_Agent_info User_info)
-		{
-			if((pack.Type!= PacketType.StartPingCheck) && (pack.Type!= PacketType.AgentUpdate))
-			{
-				//System.Console.WriteLine(pack.Type);
-				//this.richTextBox1.Text=this.richTextBox1.Text+"\n  "+pack.Type;
-			}
-			if(pack.Type== PacketType.AgentSetAppearance)
-			{
-				//System.Console.WriteLine(pack);
-				//this.richTextBox1.Text=this.richTextBox1.Text+"\n  "+pack.Type;
-			
-			}
-			if(pack.Type== PacketType.TransferRequest)
-			{
-				TransferRequestPacket tran=(TransferRequestPacket)pack;
-				LLUUID id=new LLUUID(tran.TransferInfo.Params,0);
-		
-				if((id==new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73")) ||(id==new LLUUID("e0ee49b5a4184df8d3c9a65361fe7f49")))
-				{
-				//System.Console.WriteLine(pack);
-				//System.Console.WriteLine(tran.TransferInfo.TransferID);
-				asset_man.add_request(User_info,id,tran);
-				//this.richTextBox1.Text=this.richTextBox1.Text+"\n  "+pack.Type;
-				}
-				
-			}
-			if((pack.Type== PacketType.StartPingCheck) )
-			{	
-				//reply to pingcheck
-				libsecondlife.Packets.StartPingCheckPacket startp=(libsecondlife.Packets.StartPingCheckPacket)pack;
-				libsecondlife.Packets.CompletePingCheckPacket endping=new CompletePingCheckPacket();
-				endping.PingID.PingID=startp.PingID.PingID;
-				server.SendPacket(endping,true,User_info);
-			}
-			if(pack.Type==PacketType.CompleteAgentMovement)
-			{
-				// new client	
-				agent_man.Agent_join(User_info);
-			}
-			if (pack.Type==PacketType.RequestImage)
-			{	
-				RequestImagePacket image_req=(RequestImagePacket)pack;
-				for(int i=0; i<image_req.RequestImage.Length ;i++)
-				{
-					this.texture_man.add_request(User_info,image_req.RequestImage[i].Image);
-			
-				}
-			}
-			if (pack.Type==PacketType.RegionHandshakeReply)
-			{	
-				//recieved regionhandshake so can now start sending info
-				agent_man.send_intial_data(User_info);
-				//this.setuptemplates("objectupate164.dat",User_info,false);
-			}
-			if(pack.Type== PacketType.ObjectAdd)
-			{
-				ObjectAddPacket ad=(ObjectAddPacket)pack;
-				prim_man.create_prim(User_info,ad.ObjectData.RayEnd, ad);
-				//this.send_prim(User_info,ad.ObjectData.RayEnd, ad);
-			}
-			if(pack.Type== PacketType.ObjectPosition)
-			{
-				//System.Console.WriteLine(pack.ToString());
-			}
-			if(pack.Type== PacketType.MultipleObjectUpdate)
-			{
-				//System.Console.WriteLine(pack.ToString());
-				MultipleObjectUpdatePacket mupd=(MultipleObjectUpdatePacket)pack;
-				
-				for(int i=0; i<mupd.ObjectData.Length; i++)
-				{
-					if(mupd.ObjectData[i].Type==9) //change position
-					{
-						libsecondlife.LLVector3 pos=new LLVector3(mupd.ObjectData[i].Data, 0);
-					
-						prim_man.update_prim_position(User_info, pos.X,pos.Y,pos.Z,mupd.ObjectData[i].ObjectLocalID);
-						//should update stored position of the prim
-					}
-				}
-			}
-			if(pack.Type== PacketType.AgentWearablesRequest)
-			{
-				agent_man.send_intial_avatar_apper(User_info);
-			}
-					
-			if(pack.Type==PacketType.AgentUpdate)
-			{
-				AgentUpdatePacket ag=(AgentUpdatePacket)pack;
-				uint mask=ag.AgentData.ControlFlags&(1);
-				Avatar_data m_av=agent_man.Get_Agent(User_info.AgentID);
-				if(m_av!=null)
-				{
-				if(m_av.started)
-				{
-				if(mask==(1))
-				{
-					if(!m_av.walk)
-					{
-						//start walking
-						agent_man.send_move_command(User_info,false,m_av.pos.X,m_av.pos.Y,m_av.pos.Z,0,ag.AgentData.BodyRotation);
-						Axiom.MathLib.Vector3 v3=new Axiom.MathLib.Vector3(1,0,0);
-						Axiom.MathLib.Quaternion q=new Axiom.MathLib.Quaternion(ag.AgentData.BodyRotation.W,ag.AgentData.BodyRotation.X,ag.AgentData.BodyRotation.Y,ag.AgentData.BodyRotation.Z);
-						Axiom.MathLib.Vector3 direc=q*v3;
-						direc.Normalize();
-						direc=direc*((0.03f)*128f);
-						
-						m_av.vel.X=direc.x;
-						m_av.vel.Y=direc.y;
-						m_av.vel.Z=direc.z;
-						m_av.walk=true;
-					}
-				}
-				else{
-					if(m_av.walk)
-					{
-						//walking but key not pressed so need to stop
-						agent_man.send_move_command(User_info,true,m_av.pos.X,m_av.pos.Y,m_av.pos.Z,0,ag.AgentData.BodyRotation);
-						m_av.walk=false; 
-						m_av.vel.X=0;
-						m_av.vel.Y=0;
-						m_av.vel.Z=0;
-					}
-				}
-				}}
-			}
-			
-			if(pack.Type==PacketType.ChatFromViewer)
-			{
-				ChatFromViewerPacket chat=(ChatFromViewerPacket)pack;
-				System.Text.Encoding enc = System.Text.Encoding.ASCII;
-				
-				string myString = enc.GetString(chat.ChatData.Message );
-				if(myString!="")
-				{
-					string [] comp= new string[10];
-					string delimStr = " ,	";		
-            		char [] delimiter = delimStr.ToCharArray();
-            		string line;
-            
-           		    line=myString;
-              		comp=line.Split(delimiter);  
-              		if(comp[0]=="pos")
-              		{             		
-              		}
-              		else if(comp[0]=="veloc")
-              		{             		
-              		}
-              		else
-              		{
-              			agent_man.send_chat_message(User_info,line);
-              		
-              		}
-				}
-			}
-		}
-		public void new_user(User_Agent_info User_info)
-		{
-			this.richTextBox1.Text=this.richTextBox1.Text+"\n  "+"new user - "+User_info.AgentID.ToString()+" - has joined";
-			this.richTextBox1.Text=this.richTextBox1.Text+"\n  "+"session id := "+User_info.SessionID.ToString();
-			agent_man.New_Agent(User_info);
-			
-		}
-		
-		public void error(string text)
-		{
-			this.richTextBox1.Text=this.richTextBox1.Text+"\n  error report: "+text;
-		}
-		
-		void Timer1Tick(object sender, System.EventArgs e)
-		{
-			this.time++;
-			agent_man.tick();
-			texture_man.Do_work(time);
-		}
-		
-		
-	}
-	
-}
diff --git a/Main-sever.resx b/Main-sever.resx
deleted file mode 100644
index 6999fbf..0000000
--- a/Main-sever.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
-  <!-- 
-    Microsoft ResX Schema 
-    
-    Version 2.0
-    
-    The primary goals of this format is to allow a simple XML format 
-    that is mostly human readable. The generation and parsing of the 
-    various data types are done through the TypeConverter classes 
-    associated with the data types.
-    
-    Example:
-    
-    ... ado.net/XML headers & schema ...
-    <resheader name="resmimetype">text/microsoft-resx</resheader>
-    <resheader name="version">2.0</resheader>
-    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
-    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
-    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
-    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
-    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
-        <value>[base64 mime encoded serialized .NET Framework object]</value>
-    </data>
-    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
-        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
-        <comment>This is a comment</comment>
-    </data>
-                
-    There are any number of "resheader" rows that contain simple 
-    name/value pairs.
-    
-    Each data row contains a name, and value. The row also contains a 
-    type or mimetype. Type corresponds to a .NET class that support 
-    text/value conversion through the TypeConverter architecture. 
-    Classes that don't support this are serialized and stored with the 
-    mimetype set.
-    
-    The mimetype is used for serialized objects, and tells the 
-    ResXResourceReader how to depersist the object. This is currently not 
-    extensible. For a given mimetype the value must be set accordingly:
-    
-    Note - application/x-microsoft.net.object.binary.base64 is the format 
-    that the ResXResourceWriter will generate, however the reader can 
-    read any of the formats listed below.
-    
-    mimetype: application/x-microsoft.net.object.binary.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
-            : and then encoded with base64 encoding.
-    
-    mimetype: application/x-microsoft.net.object.soap.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
-            : and then encoded with base64 encoding.
-
-    mimetype: application/x-microsoft.net.object.bytearray.base64
-    value   : The object must be serialized into a byte array 
-            : using a System.ComponentModel.TypeConverter
-            : and then encoded with base64 encoding.
-    -->
-  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
-    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
-    <xsd:element name="root" msdata:IsDataSet="true">
-      <xsd:complexType>
-        <xsd:choice maxOccurs="unbounded">
-          <xsd:element name="metadata">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" />
-              </xsd:sequence>
-              <xsd:attribute name="name" use="required" type="xsd:string" />
-              <xsd:attribute name="type" type="xsd:string" />
-              <xsd:attribute name="mimetype" type="xsd:string" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="assembly">
-            <xsd:complexType>
-              <xsd:attribute name="alias" type="xsd:string" />
-              <xsd:attribute name="name" type="xsd:string" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="data">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
-              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
-              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="resheader">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" />
-            </xsd:complexType>
-          </xsd:element>
-        </xsd:choice>
-      </xsd:complexType>
-    </xsd:element>
-  </xsd:schema>
-  <resheader name="resmimetype">
-    <value>text/microsoft-resx</value>
-  </resheader>
-  <resheader name="version">
-    <value>2.0</value>
-  </resheader>
-  <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
-  </metadata>
-</root>
\ No newline at end of file
diff --git a/Prim_manager.cs b/Prim_manager.cs
index dff2d24..da1d626 100644
--- a/Prim_manager.cs
+++ b/Prim_manager.cs
@@ -258,7 +258,7 @@ namespace Second_server
 				objupdate.ObjectData=new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[num];
 				
 			 //	int count=0;
-			 string data_path=System.Windows.Forms.Application.StartupPath + @"\data\";
+                string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\data\";
 			 for(int cc=0; cc<num; cc++)
 			 {
 			 	string filenam=data_path+@"prim_updates"+start+".dat";
diff --git a/Second-server.csproj b/Second-server.csproj
index 4823611..79db97f 100644
--- a/Second-server.csproj
+++ b/Second-server.csproj
@@ -1,7 +1,7 @@
 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <RootNamespace>Second_server</RootNamespace>
+    <RootNamespace>Controller</RootNamespace>
     <AssemblyName>Second-server</AssemblyName>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -24,32 +24,22 @@
     <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Drawing" />
-    <Reference Include="System.Windows.Forms" />
-    <Reference Include="System.Xml" />
-    <Reference Include="Axiom.MathLib">
-      <HintPath>bin\Release\Axiom.MathLib.dll</HintPath>
+    <Reference Include="Axiom.MathLib, Version=0.7.0.25497, Culture=neutral">
       <SpecificVersion>False</SpecificVersion>
+      <HintPath>lib\Axiom.MathLib.dll</HintPath>
     </Reference>
-    <Reference Include="libsecondlife">
-      <HintPath>bin\Release\libsecondlife.dll</HintPath>
+    <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
+      <HintPath>lib\log4net.dll</HintPath>
     </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="AssemblyInfo.cs" />
-    <Compile Include="Main-sever.Designer.cs">
-      <DependentUpon>Main-sever.cs</DependentUpon>
-    </Compile>
-    <Compile Include="Main-sever.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <EmbeddedResource Include="Main-sever.resx">
-      <DependentUpon>Main-sever.cs</DependentUpon>
-    </EmbeddedResource>
     <Compile Include="Agent_Manager.cs" />
+    <Compile Include="Controller.cs" />
     <Compile Include="Prim_manager.cs" />
     <Compile Include="Texture_manager.cs" />
     <Compile Include="Login_manager.cs" />
@@ -58,5 +48,11 @@
     <Compile Include="Script_manager.cs" />
     <Compile Include="Server.cs" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\libsecondlife\libsecondlife-cs\libsecondlife.csproj">
+      <Project>{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}</Project>
+      <Name>libsecondlife</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
 </Project>
\ No newline at end of file
diff --git a/Second-server.sln b/Second-server.sln
index 0106f61..9cdd672 100644
--- a/Second-server.sln
+++ b/Second-server.sln
@@ -1,17 +1,34 @@
 
 Microsoft Visual Studio Solution File, Format Version 9.00
-# SharpDevelop 2.1.0.2017
+# Visual Studio 2005
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libsecondlife", "..\..\libsecondlife\libsecondlife-cs\libsecondlife.csproj", "{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|.NET 1.1 = Debug|.NET 1.1
 		Debug|Any CPU = Debug|Any CPU
+		Release|.NET 1.1 = Release|.NET 1.1
 		Release|Any CPU = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|.NET 1.1.ActiveCfg = Debug|Any CPU
 		{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|.NET 1.1.ActiveCfg = Release|Any CPU
 		{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1
+		{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1
+		{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1
+		{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}.Release|.NET 1.1.Build.0 = Release|.NET 1.1
+		{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
 	EndGlobalSection
 EndGlobal
diff --git a/Server.cs b/Server.cs
index 1917922..7bc4050 100644
--- a/Server.cs
+++ b/Server.cs
@@ -1,5 +1,5 @@
 /*
- * * Copyright (c) <year>, <copyright holder>
+ * Copyright (c) OpenSim project, http://sim.opensecondlife.org/
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
diff --git a/Texture_manager.cs b/Texture_manager.cs
index 990557e..1321358 100644
--- a/Texture_manager.cs
+++ b/Texture_manager.cs
@@ -169,7 +169,7 @@ namespace Second_server
 		}
 		private void load_image(Texture_image im)
 		{
-			 string data_path=System.Windows.Forms.Application.StartupPath + @"\textures\";
+			 string data_path=System.AppDomain.CurrentDomain.BaseDirectory + @"\textures\";
 			string filename=data_path+@im.filename;
 			FileInfo fInfo = new FileInfo(filename);
 
diff --git a/lib/Axiom.MathLib.dll b/lib/Axiom.MathLib.dll
new file mode 100644
index 0000000..21ce3a8
Binary files /dev/null and b/lib/Axiom.MathLib.dll differ
diff --git a/lib/log4net.dll b/lib/log4net.dll
new file mode 100644
index 0000000..ffc57e1
Binary files /dev/null and b/lib/log4net.dll differ
-- 
cgit v1.1