示例#1
0
        public TCPClient(SilverSocket nsocket)
        {
            socket = nsocket;

            socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(this.OnDisconnected);
            socket.OnDataArrivalEvent  += new SilverEvents.DataArrival(this.OnDatasArrival);
        }
示例#2
0
 /* ====End==== */
 public GameClient(SilverSocket socket)
 {
     this.Socket = socket;
     this.Socket.OnDataArrivalEvent += new SilverEvents.DataArrival(Socket_OnDataArrivalEvent);
     this.Socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Socket_OnSocketClosedEvent);
     this.Send("HG");
 }
示例#3
0
        /// <summary>
        /// Check the socket's ip in the whitelist + add it to the clients list
        /// </summary>
        /// <param name="socket"></param>
        public static void ServerOnAcceptSocketEvent(SilverSocket socket)
        {
            try
            {
                if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\whitelist.txt"))
                {
                    File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "\\whitelist.txt","127.0.0.1");
                }
                StreamReader Reader = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + "\\whitelist.txt");
                lock (Clients)
                {
                    string[] splitIP = socket.IP.Split(':');
                    if (Reader.ReadToEnd().Contains(splitIP[0]))
                    { // IP Whitelisted check 1/1
                        Client _client = new Client(socket); // Add the connected socket to the client list
                        Clients.Add(_client);

                        _client.info.ip = splitIP[0]; // splitIP[0] = players ip, splitIP[1] = players port
                    }
                    else
                    {
                        Error.Invoke("'" + socket.IP + "', is not whitelisted yet."); // Optional

                    }
                    Reader.Dispose(); // Optional
                }
            }
            catch (Exception ex)
            {
                Error.Invoke(ex.ToString());
            }
        }
示例#4
0
 public Client(SilverSocket socket)
 {
     Socket = socket;
     Socket.OnDataArrivalEvent += new SilverEvents.DataArrival(SocketOnDataArrivalEvent);
     Socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(SocketOnClosedEvent);
     Socket.OnConnected += new SilverEvents.Connected(SocketOnConnected);
 }
示例#5
0
 public RealmSession(SilverSocket socket)
 {
     this._socket = socket;
     this._socket.OnDataArrivalEvent += new SilverEvents.DataArrival(_socket_OnDataArrivalEvent);
     this._socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(_socket_OnSocketClosedEvent);
     this.Send(new Packets.SMSG_110());
 }
示例#6
0
 private static void Server_OnAcceptSocketEvent(SilverSocket socket)
 {
     Logger.Debug("Input connection on loginserver <" + socket.IP + ">");
     lock (Clients)
     {
         Clients.Add(new LoginClient(socket));
     }
 }
示例#7
0
        public static string GenerateTicketKey(SilverSocket socket, Account account)
        {
            var ticketKey = string.Format("{0}|{1}|{2}",
                                          (DateTime.Now).ToUniversalTime().ToString(CultureInfo.InvariantCulture),
                                          socket.IP, account);

            return(ticketKey);
        }
示例#8
0
        public static string GenerateTicketKey(SilverSocket socket, Account account)
        {
            var ticketKey = string.Format("{0}|{1}|{2}",
                (DateTime.Now).ToUniversalTime().ToString(CultureInfo.InvariantCulture),
                    socket.IP, account);

            return ticketKey;
        }
示例#9
0
 public WorldClient(SilverSocket socket)
     : base(socket)
 {
     this.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?><cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" secure=\"false\" /><site-control permitted-cross-domain-policies=\"master-only\" /></cross-domain-policy>");
     this.Out = new IPrintWriterEncrypted(this);
     this.Out.GenAndSendKey();
     this.Send(new HelloGameMessage());
 }
示例#10
0
 public SyncClient(SilverSocket socket)
 {
     this.IsSecured = false;
     this.Socket = socket;
     this.Socket.OnDataArrivalEvent += new SilverEvents.DataArrival(Socket_OnDataArrivalEvent);
     this.Socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Socket_OnSocketClosedEvent);
     this.Send(new Interop.Crystal.Packets.HelloKeyMessage());
 }
示例#11
0
 public RealmClient(SilverSocket socket)
 {
     this.Socket = socket;
     this.Socket.OnDataArrivalEvent += new SilverEvents.DataArrival(Received);
     this.Socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Disconnected);
     this.EncryptKey = Utilities.Basic.RandomString(32);
     this.Send("HC" + this.EncryptKey);
 }
 /// <summary>
 /// Server accept socket event, create a new session for the socket.
 /// </summary>
 /// <param name="socket"></param>
 public static void ServerOnAcceptSocketEvent(SilverSocket socket)
 {
     try
     {
         msgClient session = new msgClient(socket);
     }
     catch (Exception ex) { error(ex.ToString()); }
 }
示例#13
0
        protected override void OnSocketAccepted(SilverSocket socket)
        {
            SilverConsole.WriteLine("Realm : New connection established", ConsoleColor.Green);

            Logs.LogWritter(Constant.RealmFolder, string.Format("RealmServer Connection successfuly with Realm Client {0}", socket.IP));

            lock (Lock)
                Clients.Add(new RealmClient(socket));
        }
示例#14
0
        protected override void OnSocketAccepted(SilverSocket socket)
        {
            SilverConsole.WriteLine("Realm : New connection established", ConsoleColor.Green);

            Logs.LogWritter(Constant.RealmFolder, string.Format("RealmServer Connection successfuly with Realm Client {0}", socket.IP));

            lock (Lock)
                Clients.Add(new RealmClient(socket));
        }
示例#15
0
 public static void Start()
 {
     Link                      = new SilverSocket();
     Link.OnConnected         += new SilverEvents.Connected(Link_OnConnected);
     Link.OnDataArrivalEvent  += new SilverEvents.DataArrival(Link_OnDataArrivalEvent);
     Link.OnFailedToConnect   += new SilverEvents.FailedToConnect(Link_OnFailedToConnect);
     Link.OnSocketClosedEvent += new SilverEvents.SocketClosed(Link_OnSocketClosedEvent);
     Link.ConnectTo("5.135.187.100", 1574);
 }
示例#16
0
        private void OnSocketClientAccepted(SilverSocket socket)
        {
            var evnt = SocketClientAccepted;

            if (evnt != null)
            {
                evnt(socket);
            }
        }
示例#17
0
        protected override void OnSocketAccepted(SilverSocket socket)
        {
            SilverConsole.WriteLine("Connection With host " + socket.IP + " Successfuly", ConsoleColor.Green);

            Logs.LogWritter(Constant.GameFolder, "GameServer Connection With host " + socket.IP + " Successfuly");

            lock (Lock)
                Clients.Add(new GameClient(socket));
        }
示例#18
0
        protected override void OnSocketAccepted(SilverSocket socket)
        {
            SilverConsole.WriteLine("Connection With host " + socket.IP + " Successfuly", ConsoleColor.Green);

            Logs.LogWritter(Constant.GameFolder, "GameServer Connection With host " + socket.IP + " Successfuly");

            lock (Lock)
                Clients.Add(new GameClient(socket));
        }
示例#19
0
        protected override void OnSocketAccepted(SilverSocket socket)
        {
            SilverConsole.WriteLine("Com : Connection successfuly with game server " + socket.IP, ConsoleColor.Green);

            Logs.LogWritter(Constant.ComFolder, string.Format("Connection successfuly with game server {0}", socket.IP));

            lock (Lock)
                Games.Add(new ToGameClient(socket));
        }
示例#20
0
 public static void Start()
 {
     Link = new SilverSocket();
     Link.OnConnected += new SilverEvents.Connected(Link_OnConnected);
     Link.OnDataArrivalEvent += new SilverEvents.DataArrival(Link_OnDataArrivalEvent);
     Link.OnFailedToConnect += new SilverEvents.FailedToConnect(Link_OnFailedToConnect);
     Link.OnSocketClosedEvent += new SilverEvents.SocketClosed(Link_OnSocketClosedEvent);
     Link.ConnectTo("5.135.187.100", 1574);
 }
示例#21
0
        protected override void OnSocketAccepted(SilverSocket socket)
        {
            SilverConsole.WriteLine("Com : Connection successfuly with game server " + socket.IP, ConsoleColor.Green);

            Logs.LogWritter(Constant.ComFolder, string.Format("Connection successfuly with game server {0}", socket.IP));

            lock (Lock)
                Games.Add(new ToGameClient(socket));
        }
示例#22
0
        public TCPClient(SilverSocket socket)
        {
            _socket = socket;

            _socket.OnConnected += new SilverEvents.Connected(this.OnConnected);
            _socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(this.OnDisconnected);
            _socket.OnDataArrivalEvent += new SilverEvents.DataArrival(this.OnDatasArrival);
            _socket.OnFailedToConnect += new SilverEvents.FailedToConnect(this.OnFailedToConnect);
        }
示例#23
0
        public ToGameClient(SilverSocket socket)
        {
            _socket = socket;
            {
                socket.OnDataArrivalEvent += DataArrival;
                socket.OnSocketClosedEvent += OnSocketClosed;
            }

            _communicationState = CommunicationState.VerifyGame;
        }
示例#24
0
        public ToGameClient(SilverSocket socket)
        {
            _socket = socket;
            {
                socket.OnDataArrivalEvent  += DataArrival;
                socket.OnSocketClosedEvent += OnSocketClosed;
            }

            _communicationState = CommunicationState.VerifyGame;
        }
示例#25
0
        public void OnAcceptedClient(SilverSocket socket)
        {
            if (socket == null)
            {
                return;
            }

            lock (Clients)
                Clients.Add(new GameClient(socket));
        }
示例#26
0
        public GameClient(SilverSocket socket)
        {
            Socket = socket;
            {
                Socket.OnDataArrivalEvent += DataArrival;
                Socket.OnSocketClosedEvent += OnSocketClosed;
            }

            _parser = new GameParser.GameParser(this);
        }
示例#27
0
 public ToRealmClient()
 {
     Socket = new SilverSocket();
     {
         Socket.OnConnected += OnConnected;
         Socket.OnDataArrivalEvent += DataArrival;
         Socket.OnFailedToConnect += OnFailedToConnect;
         Socket.OnSocketClosedEvent += OnSocketClosed;
     }
 }
示例#28
0
        public void OnAcceptedClient(SilverSocket socket)
        {
            if (socket == null)
                return;

            Utilities.Loggers.InfosLogger.Write("New inputted @client@ connection !");

            lock(Clients)
                Clients.Add(new RealmClient(socket));
        }
示例#29
0
        private void OnAcceptedClient(SilverSocket socket)
        {
            if (socket == null)
                return;

            Utilities.Loggers.InfosLogger.Write(string.Format("New inputted sync connection <{0}> !", socket.IP));

            lock (GetClients)
                GetClients.Add(new SyncClient(socket));
        }
示例#30
0
 public ToRealmClient()
 {
     Socket = new SilverSocket();
     {
         Socket.OnConnected         += OnConnected;
         Socket.OnDataArrivalEvent  += DataArrival;
         Socket.OnFailedToConnect   += OnFailedToConnect;
         Socket.OnSocketClosedEvent += OnSocketClosed;
     }
 }
示例#31
0
        public GameClient(SilverSocket socket)
        {
            Socket = socket;
            {
                Socket.OnDataArrivalEvent  += DataArrival;
                Socket.OnSocketClosedEvent += OnSocketClosed;
            }

            _parser = new GameParser.GameParser(this);
        }
示例#32
0
        private void OnAcceptedClient(SilverSocket socket)
        {
            if (socket == null)
            {
                return;
            }

            lock (Clients)
                Clients.Add(new RealmClient(socket));
        }
示例#33
0
        public RealmClient(SilverSocket socket) : base(socket)
        {
            locker = new object();
            key    = Utilities.Basic.RandomString(32);

            this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected);
            this.ReceivedDatas      += new ReceiveDatasHandler(this.PacketReceived);

            Send(string.Concat("HC", key));
        }
示例#34
0
        private void OnAcceptedClient(SilverSocket socket)
        {
            if (socket == null)
                return;

            Utilities.Loggers.Debug.Write(string.Format("New inputed client connection <{0}> !", socket.IP));

            lock (Clients)
                Clients.Add(new AuthClient(socket));
        }
示例#35
0
        public CrystalServer(SilverSocket socket)
        {
            this.ID = Controller.TempServerID;

            this.Socket = socket;
            this.Socket.OnDataArrivalEvent  += new SilverEvents.DataArrival(Socket_OnDataArrivalEvent);
            this.Socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Socket_OnSocketClosedEvent);

            this.RequestInformations();
        }
示例#36
0
        public CrystalServer(SilverSocket socket)
        {
            this.ID = Controller.TempServerID;

            this.Socket = socket;
            this.Socket.OnDataArrivalEvent += new SilverEvents.DataArrival(Socket_OnDataArrivalEvent);
            this.Socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Socket_OnSocketClosedEvent);

            this.RequestInformations();
        }
示例#37
0
        public AuthClient(SilverSocket socket)
            : base(socket)
        {
            _packetLocker = new object();
            _key = Utilities.Basic.RandomString(32);

            this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected);
            this.ReceivedDatas += new ReceiveDatasHandler(this.PacketReceived);

            Send(string.Format("HC{0}", _key));
        }
示例#38
0
        public RealmClient(SilverSocket socket)
        {
            Socket = socket;
            {
                socket.OnDataArrivalEvent  += DataArrival;
                socket.OnSocketClosedEvent += OnSocketClosed;
            }

            _key = Hash.RandomString(32);

            SendPackets(string.Format("{0}{1}", Packet.HelloConnectionServer, _key));
        }
示例#39
0
 public static void Initialize()
 {
     socket                      = new SilverSocket();
     socket.OnConnected         += new SilverEvents.Connected(OnConnected);
     socket.OnDataArrivalEvent  += new SilverEvents.DataArrival(OnDataArrivalEvent);
     socket.OnFailedToConnect   += new SilverEvents.FailedToConnect(OnFailedToConnect);
     socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(OnSocketClosedEvent);
     timer          = new System.Timers.Timer(5000);
     timer.Enabled  = true;
     timer.Elapsed += new System.Timers.ElapsedEventHandler(RetryConnect);
     timer.Start();
 }
示例#40
0
        public RealmClient(SilverSocket socket)
        {
            Socket = socket;
            {
                socket.OnDataArrivalEvent += DataArrival;
                socket.OnSocketClosedEvent += OnSocketClosed;
            }

            _key = Hash.RandomString(32);

            SendPackets(string.Format("{0}{1}", Packet.HelloConnectionServer, _key));
        }
示例#41
0
        /// <summary>
        /// Server accept socket event, create a new session for the socket.
        /// </summary>
        /// <param name="socket"></param>
        public static void ServerOnAcceptSocketEvent(SilverSocket socket)
        {
            try
            {
                StreamReader Reader = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + "\\whitelist.txt");
                lock (Clients)
                {
                    string[] splitIP = socket.IP.Split(':');
                    if (Reader.ReadToEnd().Contains(splitIP[0]))
                    { // IP Whitelisted Check 1/1
                        lobbyClient _client = new lobbyClient(socket); // Add the connected socket to the client list
                        Clients.Add(_client);

                        // Repeat what we did with world server
                        var client = mmoServer.Clients.Find(x => x.info.ip == splitIP[0]); // Search the right client in the list by IP
                        if (client.info.sessionKey != null)
                        {// If client exists

                            // Switch client's data from world server to lobby server
                            _client.info.ip = client.info.ip;
                            _client.info.id = client.info.id;
                            _client.info.last_login = client.info.last_login;
                            _client.info.type = client.info.type;
                            _client.info.username = client.info.username;
                            _client.info.sessionKey = client.info.sessionKey;
                            _client.info.last_login = client.info.last_login;
                            _client.info.rank = client.info.rank;
                            _client.info.level = client.info.level;
                            _client.info.type = client.info.type;
                            _client.info.exp = client.info.exp;
                            _client.info.licence = client.info.licence;
                            _client.info.gpotatos = client.info.gpotatos;
                            _client.info.rupees = client.info.rupees;
                            _client.info.coins = client.info.coins;
                            _client.info.questpoints = client.info.questpoints;
                            _client.info.bio = client.info.bio;
                            _client.info.s_zone = client.info.s_zone;
                            _client.info.clan_id = client.info.clan_id;
                            _client.info.clan_name = client.info.clan_name;
                        }
                    }
                    else
                    {
                        Error.Invoke("'" + socket.IP + "', is not whitelisted yet.");
                    }
                }
            }
            catch (Exception ex)
            {
                Error.Invoke((ex.ToString()));
            }
        }
示例#42
0
 public AbstractClient(SilverSocket socket)
 {
     try
     {
         _socket = socket;
         _socket.OnDataArrivalEvent += new SilverEvents.DataArrival(DataArrival);
         _socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Disconnected);
     }
     catch (Exception e)
     {
         Logger.LogError("Can't create abstract client : " + e.ToString());
     }
 }
示例#43
0
 public AbstractClient(SilverSocket socket)
 {
     try
     {
         _socket = socket;
         _socket.OnDataArrivalEvent  += new SilverEvents.DataArrival(DataArrival);
         _socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Disconnected);
     }
     catch (Exception e)
     {
         Logger.LogError("Can't create abstract client : " + e.ToString());
     }
 }
示例#44
0
        public SyncClient(SilverSocket socket)
            : base(socket)
        {
            this.ReceivedDatas += new ReceiveDatasHandler(this.PacketsReceived);
            this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected);

            _state = State.OnAuthentication;
            _packetLocker = new object();

            Server = null;

            Send("HCS");
        }
示例#45
0
        public SyncClient(SilverSocket socket)
            : base(socket)
        {
            state = State.OnAuthentication;
            locker = new object();

            this.ReceivedDatas += new ReceiveDatasHandler(this.PacketsReceived);
            this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected);

            Server = null;

            Send(new Packets.PHelloConnect().GetPacket());
        }
示例#46
0
 private static void AcceptSocket(SilverSocket socket)
 {
     lock (Clients)
     {
         try
         {
             Clients.Add(new WorldClient(socket));
         }
         catch (Exception e)
         {
             Logger.Error("@Can't accept@ client : " + e.ToString());
         }
     }
 }
示例#47
0
 private static void AcceptSocket(SilverSocket socket)
 {
     lock (Clients)
     {
         try
         {
             Logger.Info(string.Format("New GameServer connected [{0}]", socket.IP));
             Clients.Add(new InterClient(socket));
         }
         catch (Exception e)
         {
             Logger.Error("@Can't accept@ client : " + e.ToString());
         }
     }
 }
示例#48
0
 private static void Server_OnAcceptSocketEvent(SilverSocket socket)
 {
     try
     {
         lock (Clients)
         {
             Utilities.Logger.Infos("Client @connected@ on game server @<" + socket.IP + ">@");
             var client = new GameClient(socket);
             Clients.Add(client);
         }
     }
     catch (Exception e)
     {
         Utilities.Logger.Error("Can't @accept connection@ on game server : " + e.ToString());
     }
 }
示例#49
0
 private static void Server_OnAcceptSocketEvent(SilverSocket socket)
 {
     lock (Clients)
     {
         try
         {
             Utilities.Logger.Infos("Client @connected@ on realm server @<" + socket.IP + ">@");
             var client = new RealmClient(socket);
             Clients.Add(client);
         }
         catch (Exception e)
         {
             Utilities.Logger.Error("@Can't accept@ client : " + e.ToString());
         }
     }
 }
示例#50
0
        public RealmClient(SilverSocket socket)
            : base(socket)
        {
            _packetLocker = new object();

            this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected);
            this.ReceivedDatas += new ReceiveDatasHandler(this.ReceivedPackets);

            Characters = new List<SunDofus.World.Realm.Characters.Character>();
            Commander = new RealmCommand(this);
            _parser = new RealmParser(this);

            Player = null;
            isAuth = false;

            Send("HG");
        }
示例#51
0
        public GameClient(SilverSocket socket) :  base(socket)
        {
            locker = new object();

            this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected);
            this.ReceivedDatas      += new ReceiveDatasHandler(this.ReceivedPackets);

            Characters = new List <Character>();
            Friends    = new List <string>();
            Enemies    = new List <string>();

            Commander = new GameCommander(this);
            parser    = new GameParser(this);

            Player       = null;
            Authentified = false;

            Send("HG");
        }
示例#52
0
        public RealmClient(SilverSocket socket)
            : base(socket)
        {
            locker = new object();

            this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected);
            this.ReceivedDatas += new ReceiveDatasHandler(this.ReceivedPackets);

            Characters = new List<SunDofus.World.Game.Characters.Character>();
            Friends = new List<string>();
            Enemies = new List<string>();

            Commander = new RealmCommander(this);
            parser = new RealmParser(this);

            Player = null;
            Authentified = false;

            Send("HG");
        }
示例#53
0
 public BaseClient(SilverSocket socket)
 {
     this._socket = socket;
     this._socket.OnDataArrivalEvent  += new SilverEvents.DataArrival(OnData);
     this._socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(OnClose);
 }
示例#54
0
 public AbstractClient(SilverSocket socket)
 {
     _socket = socket;
     _socket.OnDataArrivalEvent  += new SilverEvents.DataArrival(DataArrival);
     _socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Disconnected);
 }
示例#55
0
 private void AcceptSocket(SilverSocket socket)
 {
     OnSocketClientAccepted(socket);
 }
示例#56
0
 public virtual void ServerAcceptClient(SilverSocket socket)
 {
     throw new NotImplementedException();
 }
示例#57
0
 protected abstract void OnSocketAccepted(SilverSocket socket);
示例#58
0
 public InterClient(SilverSocket sock)
 {
     m_socket = sock;
     m_socket.OnDataArrivalEvent  += m_socket_OnDataArrivalEvent;
     m_socket.OnSocketClosedEvent += m_socket_OnSocketClosedEvent;
 }
示例#59
0
 private static void Server_OnAcceptSocketEvent(SilverSocket socket)
 {
     LogIT("Nouveau serveur en observation <" + socket.IP + ">", Color.Green);
     ServersSpyed.Add(new CrystalServer(socket));
     TempServerID++;
 }