Exemplo n.º 1
0
        public static void HandleAssigning(ZoneConnection lc, InterPacket packet)
        {
            string ip;

            if (!packet.TryReadString(out ip))
            {
                return;
            }

            lc.IP = ip;

            // make idlist
            InterHandler.SendZoneStarted(lc.ID, lc.IP, lc.Port, lc.Maps);
            InterHandler.SendZoneList(lc);
            Log.WriteLine(LogLevel.Info, "Zone {0} listens @ {1}:{2}", lc.ID, lc.IP, lc.Port);
        }
Exemplo n.º 2
0
 public LoginConnector(string ip, int port)
 {
     try
     {
         Connect(ip, port);
         Log.WriteLine(LogLevel.Info, "Connected to server @ {0}:{1}", ip, port);
         this.client.OnPacket     += new EventHandler <InterPacketReceivedEventArgs>(client_OnPacket);
         this.client.OnDisconnect += new EventHandler <SessionCloseEventArgs>(client_OnDisconnect);
         this.client.SendInterPass(Settings.Instance.InterPassword);
         InterHandler.TryAssiging(this);
     }
     catch
     {
         Log.WriteLine(LogLevel.Error, "Couldn't connect to server @ {0}:{1}", ip, port);
         Console.ReadLine();
         Environment.Exit(7);
     }
 }
Exemplo n.º 3
0
        void WorldConnection_OnDisconnect(object sender, InterLib.Networking.SessionCloseEventArgs e)
        {
            if (IsAZone)
            {
                this.OnPacket     -= new EventHandler <InterPacketReceivedEventArgs>(WorldConnection_OnPacket);
                this.OnDisconnect -= new EventHandler <InterLib.Networking.SessionCloseEventArgs>(WorldConnection_OnDisconnect);

                ZoneConnection derp;
                if (Program.Zones.TryRemove(ID, out derp))
                {
                    Log.WriteLine(LogLevel.Info, "Zone {0} disconnected.", ID);
                    InterHandler.SendZoneStopped(ID);
                }
                else
                {
                    Log.WriteLine(LogLevel.Info, "Could not remove zone {0}!?", ID);
                }
            }
        }