public void ConwertingRead(List <TagRulsStruct> tags, string content, SuccsesReadTag succsesFunc, ErrorReadTag errorFunc, ref int rowIndex) { ConwertingRead(tags, StrToRows(content), succsesFunc, errorFunc, ref rowIndex); }
public void ConwertingRead(List <TagRulsStruct> tagsa, string[] rows, SuccsesReadTag succsesFunc, ErrorReadTag errorFunc, ref int rowIndex) { if (tagsa == null) { return; } List <TagRulsStruct> tags = tagsa.CloneAll(); string rowContent = null; int indexLastTrue = -1; while (rowIndex < rows.Length) { bool findTag = false; foreach (TagRulsStruct tag in tags) { if (CheckTag(rows[rowIndex], tag.TagName, out rowContent)) { findTag = true; indexLastTrue = rowIndex; rowIndex++; //Должен проверить, всех детей succsesFunc(tag, rows[indexLastTrue], rowContent); if (tag.Type == TagRuls.Один_Обязательный || tag.Type == TagRuls.Один_Необязательный) { tags.Remove(tag); } if (tag.Type == TagRuls.Закрывашка) { tags.Remove(tag); goto End_Check; } ConwertingRead(tag.Children, rows, succsesFunc, errorFunc, ref rowIndex); break; } } if (tags.Count == 0) { return; } if (!findTag) { rowIndex++; } } End_Check: //Проверка оставшихся тегов foreach (TagRulsStruct tag in tags) { if (tag.Type == TagRuls.Один_Обязательный || tag.Type == TagRuls.Закрывашка) { if (indexLastTrue != -1) { errorFunc(tag, rows[indexLastTrue], rowContent, "Обязательный тег небыл реализован", indexLastTrue); } else { errorFunc(tag, null, rowContent, "Тег не найден вовсем!", 0); } return; //throw new Exception("Обязательный тег небыл реализован"); } } }