コード例 #1
0
ファイル: Form1.cs プロジェクト: pepster98/Project-Dollhouse
        public Form1()
        {
            InitializeComponent();

            bool FoundConfig = LoadCityConfig();

            Logger.Initialize("Log.txt");
            Logger.WarnEnabled = true;
            Logger.DebugEnabled = true;

            if (!FoundConfig)
            {
                Logger.LogWarning("Couldn't find a ServerConfig.ini file!");
                //TODO: This doesn't work...
                Application.Exit();
            }

            m_Listener = new CityListener();
            m_Listener.OnReceiveEvent += new OnReceiveDelegate(m_Listener_OnReceiveEvent);

            //CharacterCreate, variable length...
            CityClient.RegisterCityPacketID(0x00, 0);
            //KeyFetch, variable length...
            CityClient.RegisterCityPacketID(0x01, 0);

            m_LoginClient = new LoginClient("127.0.0.1", 2348);
            m_LoginClient.OnNetworkError += new NetworkErrorDelegate(m_LoginClient_OnNetworkError);
            m_LoginClient.Connect();

            m_Listener.Initialize(2107);
        }
コード例 #2
0
        //: base(ClientSocket, (Listener)Server)
        public CityClient(Socket ClientSocket, CityListener Server)
        {
            m_Socket = ClientSocket;
            m_Listener = Server;

            m_Socket.BeginReceive(m_RecvBuffer, 0, m_RecvBuffer.Length, SocketFlags.None,
                new AsyncCallback(OnReceivedData), m_Socket);
        }
コード例 #3
0
        public CityClient(Socket ClientSocket, CityListener Server)
        //: base(ClientSocket, (Listener)Server)
        {
            m_Socket   = ClientSocket;
            m_Listener = Server;

            m_Socket.BeginReceive(m_RecvBuffer, 0, m_RecvBuffer.Length, SocketFlags.None,
                                  new AsyncCallback(OnReceivedData), m_Socket);
        }
コード例 #4
0
        public Form1()
        {
            InitializeComponent();

            bool FoundConfig = LoadCityConfig();

            Logger.Initialize("Log.txt");
            Logger.WarnEnabled = true;
            Logger.DebugEnabled = true;

            if (!FoundConfig)
            {
                Logger.LogWarning("Couldn't find a ServerConfig.ini file!");
                //TODO: This doesn't work...
                Application.Exit();
            }

            m_Listener = new CityListener();
            m_Listener.OnReceiveEvent += new OnReceiveDelegate(m_Listener_OnReceiveEvent);

            //CharacterCreate, variable length...
            CityClient.RegisterCityPacketID(0x00, 0);
            //KeyFetch, variable length...
            CityClient.RegisterCityPacketID(0x01, 0);

            m_LoginClient = new LoginClient("127.0.0.1", 2348);
            m_LoginClient.OnNetworkError += new NetworkErrorDelegate(m_LoginClient_OnNetworkError);
            m_LoginClient.Connect();

            //Send a pulse to the LoginServer every second.
            m_PulseTimer = new System.Timers.Timer(1000);
            m_PulseTimer.AutoReset = true;
            m_PulseTimer.Elapsed += new ElapsedEventHandler(m_PulseTimer_Elapsed);
            m_PulseTimer.Start();

            m_Listener.Initialize(2107);
        }