public List <Extras> Parse(string[] randuriFisier) { List <Extras> listaExtrase = new List <Extras>(); _lastProcessedLineIndex = 0; do { Extras extras = InternalParse(randuriFisier, _lastProcessedLineIndex); if (extras != null) { listaExtrase.Add(extras); } } while (_lastProcessedLineIndex < randuriFisier.Length); return(listaExtrase); }
public Extras InternalParse(string[] randuriFisier, int inderRandPrimit) { _extras = new Extras(); string randNetichetat = ""; bool isExtrasValid = false; for (; inderRandPrimit < randuriFisier.Length; inderRandPrimit += 1) { if (!String.IsNullOrEmpty(randuriFisier[inderRandPrimit])) { break; } } for (int indexRandCurent = inderRandPrimit; indexRandCurent < randuriFisier.Length; indexRandCurent += 1) { if (randuriFisier[indexRandCurent].StartsWith(":20:")) { isExtrasValid = true; ParseLineWithTag20(randuriFisier[indexRandCurent].Substring(4)); } if (randuriFisier[indexRandCurent].StartsWith(":25:")) { ParseLineWithTag25(randuriFisier[indexRandCurent].Substring(4)); } if (randuriFisier[indexRandCurent].StartsWith(":28C:")) { ParseLineWithTag28(randuriFisier[indexRandCurent].Substring(5)); } if (randuriFisier[indexRandCurent].StartsWith(":60F:")) { randNetichetat = ConcatenareRanduriDetalii(randuriFisier, indexRandCurent); randuriFisier[indexRandCurent] = randuriFisier[indexRandCurent] + randNetichetat; ParseLineWithTag60(randuriFisier[indexRandCurent].Substring(5)); } if (randuriFisier[indexRandCurent].StartsWith(":61:")) { randNetichetat = ConcatenareRanduriDetalii(randuriFisier, indexRandCurent); randuriFisier[indexRandCurent] = randuriFisier[indexRandCurent] + randNetichetat; _extras.Tranzactii.Add(ParseLineWithTag61(randuriFisier[indexRandCurent].Substring(4))); } if (randuriFisier[indexRandCurent].StartsWith(":62F:")) { randNetichetat = ConcatenareRanduriDetalii(randuriFisier, indexRandCurent); randuriFisier[indexRandCurent] = randuriFisier[indexRandCurent] + randNetichetat; ParseLineWithTag62(randuriFisier[indexRandCurent].Substring(5)); } if (randuriFisier[indexRandCurent].Contains(":64:")) { randNetichetat = ConcatenareRanduriDetalii(randuriFisier, indexRandCurent); randuriFisier[indexRandCurent] = randuriFisier[indexRandCurent] + randNetichetat; ParseLineWithTag64(randuriFisier[indexRandCurent].Substring(4)); } if (randuriFisier[indexRandCurent].Contains(":65:")) { randNetichetat = ConcatenareRanduriDetalii(randuriFisier, indexRandCurent); randuriFisier[indexRandCurent] = randuriFisier[indexRandCurent] + randNetichetat; ParseLineWithTag65(randuriFisier[indexRandCurent].Substring(4)); } if (randuriFisier[indexRandCurent].StartsWith("-}") || randuriFisier[indexRandCurent].Equals("")) { _lastProcessedLineIndex = indexRandCurent + 1; break; } } if (isExtrasValid) { _extrasId += 1; _extras.ExtrasId = _extrasId; return(_extras); } else { return(null); } }