Ejemplo n.º 1
0
        private OPTPage parseLine(string line)
        {
            string[] currentLine = line.Split(this.delimiter).ToArray();
            if (this.quote.HasValue)
            {
                currentLine = currentLine.Select(col => col.TrimStart(this.quote.Value).TrimEnd(this.quote.Value)).ToArray();
            }
            if (currentLine.Length != 7)
            {
                throw new InvalidDataException(String.Format("Column count for block {0} is not 7", currentLine[0]));
            }

            OPTPage page = new OPTPage {
                ID     = currentLine[0],
                Volume = currentLine[1],
                Path   = currentLine[2],
                First  = currentLine[3] == "Y"
            };

            if (this.root != null)
            {
                string fullPath = Path.Combine(root, currentLine[2].TrimStart('\\').TrimStart('/'));
                if (!File.Exists(fullPath))
                {
                    throw new FileNotFoundException(String.Format("Could not find TIFF at {0}", fullPath));
                }
                else
                {
                    page.FullPath = fullPath;
                }
            }
            return(page);
        }
Ejemplo n.º 2
0
        public OPTDocument ReadLine(string line)
        {
            OPTPage     page   = parseLine(line);
            OPTDocument output = null;

            if (page.First && this.currentDocument.PageCount != 0)
            {
                output = this.currentDocument;
                this.currentDocument = new OPTDocument();
                this.currentDocument.AddPage(page);
            }
            else
            {
                this.currentDocument.AddPage(page);
            }
            return(output);
        }
Ejemplo n.º 3
0
 public void AddPage(OPTPage page)
 {
     this.Pages.Add(page);
 }