Ejemplo n.º 1
0
        public override string ToString()
        {
            string command = "";

            switch (Type)
            {
            case CommandType.LOGIN:
                command += "1»ses" + Session + "»" + DisplayName + "»" + Helper.Base64Encode(Password) + "»" + IsDoctor;
                break;

            case CommandType.DATA:
                command += "2»ses" + Session + "»" + Meting.ToCommand();
                break;

            case CommandType.CHAT:
                command += "3»ses" + Session + "»" + ChatMessage + "»" + IsDoctor;
                break;

            case CommandType.LOGOUT:
                command += "4»ses" + Session + "»logout";
                break;

            case CommandType.SESSION:
                command += "5»ses" + Session;
                break;

            case CommandType.RESPONSE:
                command += "6»ses" + Session + "»" + Response.ToString().ToLower();
                break;

            case CommandType.VALUESET:
                command += "7»ses" + Session + "»" + Value.ToString().ToLower() + "»" + SetValue;
                break;

            case CommandType.USER:
                command += "8»ses" + Session + "»" + DisplayName + "»" + Helper.Base64Encode(Password);
                break;

            case CommandType.REQUEST:
                command += "9»ses" + Session + "»" + Request.ToString().ToLower();
                break;

            case CommandType.LENGTH:
                command += "10»ses" + Session + "»" + Length.ToString().ToLower() + "»" + LengthValue;
                break;

            case CommandType.SESSIONDATA:
                command += "11»ses" + Session + "»" + DisplayName + "»" + Timestamp;
                break;

            case CommandType.BROADCAST:
                command += "12»ses" + Session + "»" + ChatMessage;
                break;

            case CommandType.UITLEG:
                command += "13»ses" + Session + "»" + UitlegText.Replace('\n', '«');
                break;

            case CommandType.PERSONDATA:
                command += "14»ses" + Session + "»" + Gewicht + "»" + Lengte + "»" + Leeftijd + "»" + Geslacht;
                Console.WriteLine(command);
                break;

            case CommandType.TESTRESULT:
                command += "15»ses" + Session + "»" + VO2Max + "»" + MET + "»" + PopulationAvg + "»" + ZScore + "»" + Rating;
                break;

            case CommandType.OLDSESSIONDATA:
                command += "16»ses" + Session + "»" + DisplayName + "»" + Timestamp;
                break;

            case CommandType.ERROR:
                command += "ERROR IN NETCOMMAND";
                break;

            default:
                throw new FormatException("Error in NetCommand: Cannot find type of command");
            }


            return(command);
        }
        public override string ToString()
        {
            string command = "";

            switch (Type)
            {
            case CommandType.LOGIN:
                command += "1»ses" + Session + "»" + DisplayName + "»" + Helper.Base64Encode(Password) + "»" + IsDoctor;
                break;

            case CommandType.DATA:
                command += "2»ses" + Session + "»" + Meting.ToCommand();
                break;

            case CommandType.CHAT:
                command += "3»ses" + Session + "»" + ChatMessage + "»" + IsDoctor;
                break;

            case CommandType.LOGOUT:
                command += "4»ses" + Session + "»logout";
                break;

            case CommandType.SESSION:
                command += "5»ses" + Session;
                break;

            case CommandType.RESPONSE:
                command += "6»ses" + Session + "»" + Response.ToString().ToLower();
                break;

            case CommandType.VALUESET:
                command += "7»ses" + Session + "»" + Value.ToString().ToLower() + "»" + SetValue;
                break;

            case CommandType.USER:
                command += "8»ses" + Session + "»" + DisplayName + "»" + Helper.Base64Encode(Password);
                break;

            case CommandType.REQUEST:
                command += "9»ses" + Session + "»" + Request.ToString().ToLower();
                break;

            case CommandType.LENGTH:
                command += "10»ses" + Session + "»" + Length.ToString().ToLower() + "»" + LengthValue;
                break;

            case CommandType.SESSIONDATA:
                command += "11»ses" + Session + "»" + DisplayName + "»" + Timestamp;
                break;

            case CommandType.BROADCAST:
                command += "12»ses" + Session + "»" + ChatMessage;
                break;

            case CommandType.ERROR:
                command += "ERROR IN NETCOMMAND";
                break;

            default:
                throw new FormatException("Error in NetCommand: Cannot find type of command");
            }

            return(command);
        }