Beispiel #1
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();

            m_Listener.Initialize(2107);
        }
        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);
        }