Exemple #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);
        }