public void ParseLines ( string[] lines ) { int pageCount = int.Parse(lines[0]); for (int i = 0; i < pageCount; i++) { IrbisPage page = new IrbisPage(lines[i + 1]); Pages.Add(page); } int skip = 1 + pageCount * 2; for (int index = 0; index < pageCount; index++) { IrbisPage page = Pages[index]; int lineCount = int.Parse(lines[1 + pageCount + index]); for (int j = 0; j < lineCount; j++) { IrbisLine item = new IrbisLine(); string[] portion = lines.Skip(skip).Take(10).ToArray(); item.ParseLines(portion); page.Lines.Add(item); skip += 10; } } }
public void ParseLines ( string[] lines ) { int pageCount = int.Parse(lines[0]); for (int i = 0; i < pageCount; i++) { IrbisPage page = new IrbisPage(lines[i + 1]); Pages.Add(page); } int skip = 1 + pageCount * 2; int pageIndex = 0; for (int index = 0; index < pageCount; index++) { IrbisPage page = Pages[index]; int lineCount = int.Parse(lines[1 + pageCount + index]); for (int j = 0; j < lineCount; j++) { IrbisLine item = new IrbisLine(); string[] portion = lines.Skip(skip).Take(10).ToArray(); item.ParseLines(portion); page.Lines.Add(item); skip += 10; } if (Pages[pageIndex].Name.StartsWith("@")) { IrbisWorkSheet ws = new IrbisWorkSheet(Pages[pageIndex].Name.Substring(1) + ".ws", client); ws.ParseText(client.ReadTextFile(IrbisPath.MasterFile, ws.Name)); Pages.RemoveAt(pageIndex); Pages.InsertRange(pageIndex, ws.Pages); pageIndex += ws.Pages.Count; } else { pageIndex++; } } }