示例#1
0
        public bool Creat_Personal_characteristic(string FileName)
        {
            using (StreamReader sr = new StreamReader(Setting.characteristics_path + "\\" + FileName + ".txt", Encoding.GetEncoding(1251)))
            {
                string line = sr.ReadToEnd();
                string keyword;
                for (int i = 0; i < line.Length; i++)
                {
                    if (line[i] == '_') // выделение ключевого слова
                    {
                        keyword = "";
                        for (; i < line.Length && line[i] != ' '; i++)
                        {
                            keyword += line[i];
                        }
                        Enum.TryParse(keyword, out Descriptors Descriptor);
                        switch (Descriptor) // заполнение класса
                        {
                        case Descriptors._GROUP:
                        {
                            Descriptors_implementation._GROUP(Groups, ref i, ref line);
                            break;
                        }

                        case Descriptors._LINK:
                        {
                            Descriptors_implementation._LINK(Groups, ref i, ref line);
                            break;
                        }

                        default:
                            break;
                        }
                    }
                }
                if (!Stored_Exceptions.Empty)
                {
                    Stored_Exceptions.Show();
                    MessageBox.Show("The file could not be read:");
                    return(false);
                }
            }
            return(true);
        }
示例#2
0
        bool Upload_data_from_file(string FileName)
        {
            using (StreamReader sr = new StreamReader(FileName))
            {
                string line = sr.ReadToEnd();
                string keyword;
                for (int i = 0; i < line.Length; i++)
                {
                    if (line[i] == '_') // выделение ключевого слова
                    {
                        keyword = "";
                        for (; i < line.Length && line[i] != ' '; i++)
                        {
                            keyword += line[i];
                        }
                        Enum.TryParse(keyword, out Descriptors Descriptor);
                        switch (Descriptor) // заполнение класса Test
                        {
                        case Descriptors._HEADER:
                        {
                            Descriptors_implementation._GET_RESULT(ref i, line, out _HEADER);
                            break;
                        }

                        case Descriptors._TEST_RESULT:
                        {
                            Descriptors_implementation._GET_RESULT(ref i, line, out _TEST_RESULT);
                            break;
                        }

                        case Descriptors._AUTOMATIC_RESUME:
                        {
                            Descriptors_implementation._GET_RESULT(ref i, line, out _AUTOMATIC_RESUME);
                            break;
                        }

                        case Descriptors._LEVELS_OF_EXPRESSION:
                        {
                            Descriptors_implementation._GET_RESULT(ref i, line, out _LEVELS_OF_EXPRESSION);
                            break;
                        }

                        case Descriptors._ANSWERS_TO_TESTS:
                        {
                            Descriptors_implementation._GET_RESULT(ref i, line, out _ANSWERS_TO_TESTS);
                            break;
                        }

                        case Descriptors._TEST_SCALES:
                        {
                            Descriptors_implementation._GET_RESULT(ref i, line, out _TEST_SCALES);
                            break;
                        }

                        default:
                            break;
                        }
                    }
                }
                if (!Stored_Exceptions.Empty)
                {
                    Stored_Exceptions.Show();
                    MessageBox.Show("The file could not be read:");
                    return(false);
                }
            }
            return(true);
        }
示例#3
0
        public bool Creat_test(string FileName) // создание теста
        {
            using (StreamReader sr = new StreamReader($"{Setting.tests_path}\\{FileName}", Encoding.GetEncoding(1251)))
            {
                string line = sr.ReadToEnd();
                string keyword;
                for (int i = 0; i < line.Length; i++)
                {
                    if (line[i] == '_') // выделение ключевого слова
                    {
                        keyword = "";
                        for (; i < line.Length && line[i] != ' '; i++)
                        {
                            keyword += line[i];
                        }
                        Enum.TryParse(keyword, out Descriptors Descriptor);
                        switch (Descriptor) // заполнение класса Test
                        {
                        case Descriptors._ANSWER:
                        {
                            Descriptors_implementation._ANSWER(_Questions, ref i, ref line);
                            break;
                        }

                        case Descriptors._QUESTION:
                        {
                            Descriptors_implementation._QUESTION(_Questions, ref i, ref line);
                            break;
                        }

                        case Descriptors._SCALE:
                        {
                            Descriptors_implementation._SCALE(_Scales, ref i, ref line);
                            break;
                        }

                        case Descriptors._KEY:
                        {
                            Descriptors_implementation._KEY(_Keys, ref i, ref line);
                            break;
                        }

                        case Descriptors._FUZZY_SETS:
                        {
                            Descriptors_implementation._FUZZY_SETS(_Fuzzy_sets, ref i, ref line);
                            break;
                        }

                        case Descriptors._NAME:
                        {
                            Descriptors_implementation._NAME(_Header, ref i, ref line);
                            break;
                        }

                        case Descriptors._DESCRIPTION:
                        {
                            Descriptors_implementation._DESCRIPTION(_Header, ref i, ref line);
                            break;
                        }

                        case Descriptors._VERIFIER:
                        {
                            Descriptors_implementation._VERIFIER(_Header, ref i, ref line);
                            break;
                        }

                        default:
                            break;
                        }
                    }
                }
                if (!Stored_Exceptions.Empty)
                {
                    Stored_Exceptions.Show();
                    MessageBox.Show("The file could not be read:");
                    return(false);
                }
            }
            return(true);
        }