Пример #1
0
        public bool Initialize(Config birdieConfig)
        {
            // Don't allow re-use
            if (hasTerminated)
            {
                return(false);
            }

            // Set privileges
            Privileges.SetPrivileges();

            // Validate the config first
            bool isConfigValid = birdieConfig.Validate();

            if (!isConfigValid)
            {
                return(false);
            }

            Config = birdieConfig;

            // Create the network handler
            networkMain = new NetworkMain(this);

            // Register callbacks
            networkMain.OnClientConnect        = ClientConnect;
            networkMain.OnClientDisconnect     = ClientDisconnect;
            networkMain.OnCompleteDataReceived = DataReceived;

            bool isNetworkInitialized = networkMain.Start();

            if (!isNetworkInitialized)
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            NetworkMain nm = new NetworkMain();

            nm.Start();
        }