コード例 #1
0
ファイル: Program.cs プロジェクト: ShadowCat7/Tranzap
        static string getServerInfo(Server server)
        {
            string tempString =
                "LAN IP Address: " + server.getLanAddress() + "\n" +
                "External IP Address: " + server.getExtAddress() + "\n" +
                "Domain: " + server.getDomainName() + "\n" +
                "Current User Count: " + server.getUserCount();

            return tempString;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ShadowCat7/Tranzap
        static void getServerInfo(Server server)
        {
            Console.Clear();

            Console.WriteLine("LAN IP Address: " + server.getLanAddress());
            Console.WriteLine("External IP Address: " + server.getExtAddress());
            Console.WriteLine("Domain: " + server.getDomainName());
            Console.WriteLine("Current User Count: " + server.getUserCount());

            Console.CursorTop = Console.WindowHeight;
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: ShadowCat7/Tranzap
        static void Main(string[] args)
        {
            Server server = new Server();
            Console.Title = "TranzapServer";

            getServerInfo(server);

            int count = 0;
            string command = "";
            while (command != "quit")
            {
                //TODO
                if (count == 10)
                { getServerInfo(server); }
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: ShadowCat7/Tranzap
        static void Main(string[] args)
        {
            Server server = new Server();
            Console.Title = "TranzapServer";
            FileManager.checkAllFiles();

            string consoleText = getServerInfo(server);

            int count = 0;
            string command = "";
            string tempCommand = "";
            string qualifyingText = "";
            ConsoleKeyInfo keys = new ConsoleKeyInfo();
            while (command != "quit")
            {
                if (command != "")
                {
                    if (checkCommand("quit", command, ref tempCommand))
                    {
                        if (tempCommand == "")
                        { qualifyingText = "Goodbye."; }
                        else if (tempCommand == "help")
                        { qualifyingText = "Usage: quit | Closes the console."; }
                        else
                        { qualifyingText = "Not a valid command. Type help for more information."; }
                    }
                    else if (checkCommand("help", command, ref tempCommand))
                    {
                        if (tempCommand == "")
                        { qualifyingText = "Usage: -command- help | Commands: QUIT, HELP, UPLOAD"; }
                        else if (tempCommand == "help")
                        { qualifyingText = "You must think you're pretty funny."; }
                        else
                        { qualifyingText = "Not a valid command. Type help for more information.";}
                    }
                    else if (checkCommand("upload", command, ref tempCommand))
                    {
                        if (tempCommand == "help")
                        { qualifyingText = "Usage: upload -file path- | Uploads the designated file."; }
                        else
                        {
                            if (FileManager.fileExists(tempCommand))
                            {
                                FileManager.uploadFile(tempCommand);
                                qualifyingText = "File uploaded.";
                            }
                            else
                            { qualifyingText = "That file does not exist there."; }
                        }
                    }
                    else
                    { qualifyingText = "Not a valid command. Type help for more information."; }

                    tempCommand = "";
                    command = "";
                }

                writeServerInfo(server, qualifyingText, tempCommand);

                //Let's get server info while we wait for a key.
                while (Console.KeyAvailable == false)
                {
                    string tempString = getServerInfo(server);
                    if (consoleText != tempString)
                    { writeServerInfo(server, qualifyingText, tempCommand); }
                }
                keys = Console.ReadKey(true);

                //Special keys.
                if (keys.Key == ConsoleKey.Enter)
                {
                    command = tempCommand;
                    tempCommand = "";
                }
                else if (keys.Key == ConsoleKey.Backspace && tempCommand.Length > 0)
                {
                    string temp = "";
                    for (int i = 0; i < tempCommand.Length - 1; i++)
                    { temp += tempCommand[i]; }
                    tempCommand = temp;
                }
                else if (keys.Key == ConsoleKey.Delete)
                { }
                else
                { tempCommand += keys.KeyChar.ToString(); }
            }
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: ShadowCat7/Tranzap
 static void writeServerInfo(Server server, string qualifyingText, string userCommand)
 {
     string consoleText = getServerInfo(server);
     Console.Clear();
     Console.WriteLine(consoleText);
     Console.CursorTop = Console.WindowHeight - 2;
     Console.WriteLine(qualifyingText);
     Console.Write(userCommand);
 }