static public string SERIALIZE_multichoiceAnswers(MultiChoiceAnswercs multiChoicesAns)
        {
            if (multiChoicesAns == null)
            {
                return(" ");
            }
            string Result = "";

            Result += SERIALIZE_answer(multiChoicesAns.chossenanswer_prperties)
                      + multiChoicesAns.date_Property + "~"
                      + multiChoicesAns.user_Property.UserName_Property + "~"
                      + multiChoicesAns.user_Property.Email_Property + "~"
                      + multiChoicesAns.user_Property.Password_property + "~"
                      + multiChoicesAns.user_Property.Age_property.ToString() + "~"
                      + multiChoicesAns.user_Property.Country_propety;
            return(Result);
        }
        static public KeyValuePair <MultiChoiceAnswercs, int> DESERIALIZE_multichoiceAnswer(string Content, int iter)
        {
            string date = "", UserName = "", Email = "", Password = "", Age = "", Country = "";

            KeyValuePair <string[], int> pair = DESERILIZE_answer(Content, iter);

            if (pair.Key == null)
            {
                return(new KeyValuePair <MultiChoiceAnswercs, int>(null, pair.Value));
            }
            string[] answers = pair.Key;
            iter = pair.Value;
            char i = Content[iter];

            iter++;
            i = Content[iter];
            while (i != '~')
            {
                date += i.ToString();
                iter++;
                i = Content[iter];
            }
            iter++;
            i = Content[iter];
            while (i != '~')
            {
                UserName += i.ToString();
                iter++;
                i = Content[iter];
            }
            iter++;
            i = Content[iter];
            while (i != '~')
            {
                Email += i.ToString();
                iter++;
                i = Content[iter];
            }
            iter++;
            i = Content[iter];
            while (i != '~')
            {
                Password += i.ToString();
                iter++;
                i = Content[iter];
            }
            iter++;
            i = Content[iter];
            while (i != '~')
            {
                Age += i.ToString();
                iter++;
                i = Content[iter];
            }
            iter++;
            i = Content[iter];
            while (i != '~')
            {
                Country += i.ToString();
                iter++;
                i = Content[iter];
            }
            MultiChoiceAnswercs multiable_answer = new MultiChoiceAnswercs(answers.Length);
            User user = new User(UserName, Password, Email, Int32.Parse(Age), Country, date);

            multiable_answer.user_Property           = user;
            multiable_answer.date_Property           = date;
            multiable_answer.chossenanswer_prperties = answers;
            return(new KeyValuePair <MultiChoiceAnswercs, int>(multiable_answer, iter));
        }
Esempio n. 3
0
 public void Answer_question(string[] answer, string date, User user)
 {
     multiChoiceAnswercs = new MultiChoiceAnswercs(bound);
     multiChoiceAnswercs.Answer_question(answer, date, user);
 }