Beispiel #1
0
        /// <summary>
        ///     Disconnect and reset for starting or connnecting to a new game.
        ///     NOTE: Pass "null" to disconnect without error - otherwise the passed reason is considered an error (TODO: This is
        ///     ugly and should get fixed!).
        /// </summary>
        public void Disconnect(string localisedReason)
        {
            if (localisedReason == null)
            {
                Log("Disconnecting from network.");
            }
            else
            {
                Log("Disconnecting from network because: " + localisedReason);
            }
            LocalisedDisconnectReason = localisedReason;


            if (peerManager != null)
            {
                peerManager.HandleLocalDisconnection();
            }
            peerManager = null;

            if (NetworkApplication != null)
            {
                NetworkApplication.Shutdown();
            }

            LocalPeerInfo      = null;
            GameInfo           = null;
            NetworkApplication = null;

            ClearApplicationConnections();


            unconnectedProtocolErrorCount = 0;
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;

            Console.WriteLine("BNU CO453 Applications Programming 2020-2021!");
            Console.WriteLine();
            Console.Beep();
            //BMI bmi = new BMI();
            // bmi.Choice();
            //StudentGrade student = new StudentGrade();
            //student.MainMenu();

            NetworkApplication network = new NetworkApplication();

            network.DisplayMenu();


            //DistanceConverter convert = new DistanceConverter();
            //convert.PrintResults();
        }