コード例 #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);
        }
コード例 #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>(ClientOnPacket);
         this.client.OnDisconnect += new EventHandler <SessionCloseEventArgs>(ClientOnDisconnect);
         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);
     }
 }
コード例 #3
0
        void WorldConnection_OnDisconnect(object sender, SessionCloseEventArgs e)
        {
            if (IsAZone)
            {
                OnPacket     -= WorldConnection_OnPacket;
                OnDisconnect -= 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);
                }
            }
        }
コード例 #4
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);
                }
            }
        }