예제 #1
0
        void SendCommand(string targetnick, XmlCommands.Command command)
        {
            string message = XmlCommands.GetInstance().Encode(command);

            LogFile.WriteLine(message);
            chat.SendPrivateMessage(targetnick, message);
        }
예제 #2
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);
         }
     }
 }
예제 #3
0
        public RemoteServerInfoDialog( string servername, XmlCommands.ServerInfo serverinfo )
        {
            Glade.XML app = new Glade.XML( EnvironmentHelper.GetExeDirectory() + "/metaverse.client.glade", "remoteserverinfodialog", "" );
            app.Autoconnect( this );

            btnclose.Clicked += new EventHandler( btnclose_Clicked );

            nameentry.Text = servername;
            ipaddressentry.Text = new IPAddress( serverinfo.IPAddress ).ToString();
            portentry.Text = serverinfo.port.ToString();
        }
예제 #4
0
 void imimplementation_IMReceived(object source, IMReceivedArgs e)
 {
     Console.WriteLine("queryserver, im received " + e.Sender + " " + e.MessageText);
     if (e.Sender == targetserver)
     {
         try
         {
             XmlCommands.Command command = XmlCommands.GetInstance().Decode(e.MessageText);
             if (command.GetType() == typeof(XmlCommands.ServerInfo))
             {
                 XmlCommands.ServerInfo serverinfo = command as XmlCommands.ServerInfo;
                 Console.WriteLine("IRCQueryServer Got server response " + serverinfo);
                 callback(targetserver, serverinfo);
                 chat.IMReceived -= handler;
             }
         }
         catch (Exception ex)
         {
             LogFile.WriteLine(ex);
         }
     }
 }
예제 #5
0
 void GotServerInfo_nowconnect( string servername, XmlCommands.ServerInfo serverinfo )
 {
     LogFile.WriteLine( "showserversdialog.GotServerInfo_nowconnect, got serverinfo: " + serverinfo );
     MetaverseClient.GetInstance().network.NewConnection += new Level2NewConnectionHandler( network_NewConnection );
     this.servername = servername;
     MetaverseClient.GetInstance().ConnectToServer(
         new IPAddress( serverinfo.IPAddress ).ToString(), serverinfo.port );
 }
예제 #6
0
 void GotServerInfo( string servername, XmlCommands.ServerInfo serverinfo )
 {
     LogFile.WriteLine( "showserversdialog, got serverinfo: " + serverinfo );
     new RemoteServerInfoDialog( servername, serverinfo );
 }
예제 #7
0
 void SendCommand( string targetnick, XmlCommands.Command command )
 {
     string message = XmlCommands.GetInstance().Encode( command );
     LogFile.WriteLine( message );
     chat.SendPrivateMessage( targetnick, message );
 }
예제 #8
0
 void STUNResponseForOwnInterface( IPAddress ipaddress, int port )
 {
     LogFile.WriteLine( "showserverdialog.STUNResponseForOwnInterface( " + ipaddress + " " + port + " )" );
     MetaverseClient.GetInstance().imimplementation.SendPrivateMessage( servername,
         XmlCommands.GetInstance().Encode( new XmlCommands.PingMe( ipaddress, port ) ) );
 }