private static void server_OnDataReceived(object sender, NetConnection connection, byte[] e)
        {
            if (e.Length > 0)
            {
                NetworkData ReceivedData = (NetworkData)Convertor.ByteArrayToObject(e);
                switch (ReceivedData.ComReason)
                {
                case Reason.Login:
                    GoogleTOTP tf = new GoogleTOTP();
                    LoginData  LoginCredentials = (LoginData)ReceivedData.Data;

                    if (UserDB.ContainsKey(LoginCredentials.User))
                    {
                        User client = UserDB[LoginCredentials.User];
                        if (client.passwd == LoginCredentials.Password)     //  && tf.GeneratePin(client.code) == LoginCredentials.Code
                        {
                            LogData(connection.RemoteEndPoint + " login as " + LoginCredentials.User);
                            connection.Send(Tools.Convertor.ObjectToByteArray(new Tools.NetworkData()
                            {
                                ComReason = Tools.Reason.Response,
                                Data      = "lgins"
                            }));
                        }
                        else
                        {
                            LogData(connection.RemoteEndPoint + " failed to login as " + LoginCredentials.User);
                            connection.Send(Tools.Convertor.ObjectToByteArray(new Tools.NetworkData()
                            {
                                ComReason = Tools.Reason.Response,
                                Data      = "lginf"
                            }));
                        }
                    }
                    else
                    {
                        LogData(connection.RemoteEndPoint + " user not found " + LoginCredentials.User);
                        connection.Send(Tools.Convertor.ObjectToByteArray(new Tools.NetworkData()
                        {
                            ComReason = Tools.Reason.Response,
                            Data      = "lginnf"
                        }));
                    }
                    break;

                case Reason.Com:
                    break;

                default:
                    break;
                }
            }
        }
        private static void Program_OnCommand(string command)
        {
            switch (command)
            {
            case "show user":

                User cl = new User();
GetName:
                {
                    WriteOnColor("Enter User Name : ", ConsoleColor.Blue, false);
                    string userName = Console.ReadLine();

                    if (userName == ">exit")
                    {
                        break;
                    }
                    else if (userName != "")
                    {
                        if (UserDB.ContainsKey(userName))
                        {
                            cl = UserDB[userName];
                            goto ShowUser;
                        }
                        else
                        {
                            WriteOnColor("  User not found!", ConsoleColor.Red, true);
                            goto GetName;
                        }
                    }
                    else if (userName == "")
                    {
                        WriteOnColor("  User name cannot be empty!", ConsoleColor.Red, true);
                        goto GetName;
                    }
                }
ShowUser:
                {
                    WriteOnColor("  ::: User Details :::", ConsoleColor.Yellow, true);
                    Console.WriteLine("      User : "******"  Password : "******"     Email : " + cl.email + Environment.NewLine +
                                      "Privat Key : " + CreativeCommons.Transcoder.Base32Encode(cl.code));
                }

                break;

            case "list users":
                foreach (var user in UserDB.Values)
                {
                    WriteOnColor("--------------------------------", ConsoleColor.Blue, true);
                    Console.WriteLine("    User : "******"   Email : " + user.email + Environment.NewLine);
                }
                break;

            case "add user":
                var newAccount = new User();     // New user to be added
                goto Start;

Start:
                {
                    Console.Clear();
                    WriteOnColor("::: Creating Client :::", ConsoleColor.Green, true);
                    goto Account;
                }
Account:
                {
                    Console.Write("User Name : ");
                    string Account = Console.ReadLine();
                    if (UserDB.ContainsKey(Account))
                    {
                        WriteOnColor("    User Already Exists!", ConsoleColor.Red, true);
                        goto Account;
                    }
                    else
                    {
                        if (Account != "")
                        {
                            newAccount.account = Account;
                            goto Password;
                        }
                        else
                        {
                            WriteOnColor("    User Name cannot be empty!", ConsoleColor.Red, true);
                            goto Account;
                        }
                    }
                }
Password:
                {
                    Console.Write(" Password : "******"")
                    {
                        newAccount.passwd = Password;
                        goto Email;
                    }
                    else
                    {
                        WriteOnColor("    Password cannot be empty!", ConsoleColor.Red, true);
                        goto Password;
                    }
                }
Email:
                {
                    Console.Write("    Email : ");
                    string Email = Console.ReadLine();
                    if (Email != "")
                    {
                        GoogleTOTP tf = new GoogleTOTP();
                        newAccount.email = Email;
                        newAccount.code  = tf.getPrivateKey();
                        UserDB.Add(newAccount.account, newAccount);
                        WriteOnColor("Client " + newAccount.account + " was created successfully!", ConsoleColor.Yellow, true);
                        break;
                    }
                    else
                    {
                        WriteOnColor("    Email cannot be empty!", ConsoleColor.Red, true);
                        goto Email;
                    }
                }

            case "help":

                WriteOnColor("================== Help ==================", ConsoleColor.Green, true);
                Console.Write("show user            "); WriteOnColor("Show user's details", ConsoleColor.Magenta, true);
                Console.Write("list users           "); WriteOnColor("List users from database", ConsoleColor.Magenta, true);
                Console.Write("add user             "); WriteOnColor("Create a new client", ConsoleColor.Magenta, true);
                Console.Write("show logs            "); WriteOnColor("List the logs", ConsoleColor.Magenta, true);
                Console.Write("Exit                 "); WriteOnColor("Exit the application", ConsoleColor.Magenta, true);
                WriteOnColor("==========================================", ConsoleColor.Green, true);
                break;

            case "show logs":
                WannaReadLogs = true;
                break;

            default:

                break;
            }

            if (command == "Exit" || command == "exit")
            {
                SaveAndExit = true; // Save and exit
            }
        }