Ejemplo n.º 1
0
 public void OnServerRegistration(string nickname, string message)
 {
     LogFile.WriteLine("serverregistration. received from " + nickname + ": " + message);
     if (message.StartsWith("QUERY"))
     {
         SendCommand(nickname, new XmlCommands.ServerInfo(
                         externaladdress, externalport));
     }
     else
     {
         try
         {
             XmlCommands.Command command = XmlCommands.GetInstance().Decode(message);
             if (command.GetType() == typeof(XmlCommands.PingMe))
             {
                 XmlCommands.PingMe pingmecommand = command as XmlCommands.PingMe;
                 LogFile.WriteLine("serverregistration received pingme command: " + new IPAddress(pingmecommand.MyIPAddress) +
                                   " " + pingmecommand.Myport);
                 IPEndPoint endpoint = new IPEndPoint(new IPAddress(pingmecommand.MyIPAddress), pingmecommand.Myport);
                 MetaverseServer.GetInstance().network.networkimplementation.Send(endpoint, new byte[] { 0 });
             }
         }
         catch (Exception ex)
         {
             LogFile.WriteLine(ex);
         }
     }
 }
Ejemplo n.º 2
0
 ServerInfo()
 {
     if (MetaverseServer.GetInstance().Running)
     {
         ContextMenuController.GetInstance().RegisterPersistentContextMenu(new string[] { "Network", "&Server Info..." }, new ContextMenuHandler(ServerInfoDialog));
         //ContextMenuController.GetInstance().RegisterPersistentContextMenu( new string[] { "Network", "&Private server Info..." }, new ContextMenuHandler( PrivateServerInfoDialog ) );
         MetaverseClient.GetInstance().Tick += new MetaverseClient.TickHandler(ServerInfo_Tick);
     }
 }
Ejemplo n.º 3
0
        void ServernameCallback(string servername)
        {
            if (servername == "")
            {
                return;
            }

            ircname = "srv_" + servername;

            LogFile.WriteLine(this.GetType() + " ircname will be: " + ircname + " calling STUN...");
            STUN stun = new STUN(MetaverseServer.GetInstance().network.networkimplementation, new STUN.GotExternalAddress(GotExternalAddress));
        }
Ejemplo n.º 4
0
        ServerRegistration() // protected to enforce singleton
        {
            coordinationconfig = Config.GetInstance().coordination;

            chat = ChatImplementationFactory.CreateInstance();
            MetaverseServer.GetInstance().Tick += new MetaverseServer.TickHandler(chat.Tick);


            chat.IMReceived += new IMReceivedHandler(this.OnRecieveMessage);

            new InputBox("Please enter a worldname to publish your server to " + coordinationconfig.ircserver +
                         " irc " + coordinationconfig.ircchannel, new InputBox.Callback(ServernameCallback));
        }
 public void MarkAllDirty()
 {
     LogFile.WriteLine("MarkAllDirty() client " + connection);
     // note to self: this is a hack
     foreach (IHasReference entity in MetaverseServer.GetInstance().World.entities)
     {
         if (!DirtyAttributesByEntity.ContainsKey(entity))
         {
             LogFile.WriteLine("Marking dirty " + entity.GetType().ToString() + " " + entity.Reference);
             DirtyAttributesByEntity.Add(entity, new List <Type>());
         }
         if (!DirtyAttributesByEntity[entity].Contains(typeof(Replicate)))
         {
             DirtyAttributesByEntity[entity].Add(typeof(Replicate));
         }
     }
 }
Ejemplo n.º 6
0
        void SendPing()
        {
            if (friendipaddressentry.Text == "")
            {
                return;
            }
            int friendport = 1234;

            try
            {
                friendport = Convert.ToInt32(friendportentry.Text);
            }
            catch
            {
            }
            MetaverseServer.GetInstance().PingClient(friendipaddressentry.Text, friendport);
        }
Ejemplo n.º 7
0
        void ServerInfoDialog(object source, ContextMenuArgs e)
        {
            if (serverinfowindow != null)
            {
                serverinfowindow.Destroy();
            }
            Glade.XML app = new Glade.XML(EnvironmentHelper.GetExeDirectory() + "/metaverse.client.glade", "serverinfowindow", "");
            app.Autoconnect(this);

            btnsendping.Clicked += new EventHandler(btnsendping_Clicked);
            //btnholdopen.Pressed += new EventHandler( btnholdopen_Pressed );
            //btnholdopen.Released += new EventHandler( btnholdopen_Released );
            btnclose.Clicked += new EventHandler(btnclose_Clicked);

            localipaddressentry.Text = MetaverseServer.GetInstance().network.networkimplementation.LocalIPAddress.ToString();
            localportentry.Text      = MetaverseServer.GetInstance().ServerPort.ToString();
            STUN stun = new STUN(MetaverseServer.GetInstance().network.networkimplementation, new STUN.GotExternalAddress(STUNResponse));
        }
Ejemplo n.º 8
0
 public void ResendWorld(IPEndPoint connection)
 {
     MetaverseServer.GetInstance().netreplicationcontroller.dirtyobjectcontroller.ReplicateAll(connection);
 }
Ejemplo n.º 9
0
 public void RequestResendWorld()
 {
     MetaverseServer.GetInstance().worldreplication.ResendWorld(connection);
 }
 public void ObjectDeleted(int reference, string typename)
 {
     MetaverseServer.GetInstance().netreplicationcontroller.ObjectDeletedRpc(connection,
                                                                             reference, typename);
 }
 public void ObjectModified(int reference, string typename, int attributebitmap, byte[] entity)
 {
     MetaverseServer.GetInstance().netreplicationcontroller.ObjectModifiedRpc(connection,
                                                                              reference, typename, attributebitmap, entity);
 }
 public void ObjectCreated(int remoteclientreference, string typename, int attributebitmap, byte[] entitydata)
 {
     MetaverseServer.GetInstance().netreplicationcontroller.ObjectCreatedRpcClientToServer(connection,
                                                                                           remoteclientreference, typename, attributebitmap, entitydata);
 }