/* Copyright (c) 2007 Michael Wright * Copyright (c) , * 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 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.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 { /// /// Description of MainForm. /// 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