public PageInformationSegment FindPageSegement(int page) { foreach (Segment segment in segments) { SegmentHeader segmentHeader = segment.GetSegmentHeader(); if (segmentHeader.GetSegmentType() == Segment.PAGE_INFORMATION && segmentHeader.GetPageAssociation() == page) { return((PageInformationSegment)segment); } } return(null); }
private void ReadSegmentHeader(SegmentHeader segmentHeader) { HandleSegmentNumber(segmentHeader); HandleSegmentHeaderFlags(segmentHeader); HandleSegmentReferredToCountAndRententionFlags(segmentHeader); HandleReferedToSegmentNumbers(segmentHeader); HandlePageAssociation(segmentHeader); if (segmentHeader.GetSegmentType() != Segment.END_OF_FILE) { HandleSegmentDataLength(segmentHeader); } }
private void ReadSegments() { bool finished = false; while (!reader.IsFinished() && !finished) { SegmentHeader segmentHeader = new SegmentHeader(); ReadSegmentHeader(segmentHeader); // read the Segment data Segment segment = null; int segmentType = segmentHeader.GetSegmentType(); int[] referredToSegments = segmentHeader.GetReferredToSegments(); int noOfReferredToSegments = segmentHeader.GetReferredToSegmentCount(); switch (segmentType) { case Segment.SYMBOL_DICTIONARY: segment = new SymbolDictionarySegment(this); segment.SetSegmentHeader(segmentHeader); break; case Segment.INTERMEDIATE_TEXT_REGION: segment = new TextRegionSegment(this, false); segment.SetSegmentHeader(segmentHeader); break; case Segment.IMMEDIATE_TEXT_REGION: segment = new TextRegionSegment(this, true); segment.SetSegmentHeader(segmentHeader); break; case Segment.IMMEDIATE_LOSSLESS_TEXT_REGION: segment = new TextRegionSegment(this, true); segment.SetSegmentHeader(segmentHeader); break; case Segment.PATTERN_DICTIONARY: segment = new PatternDictionarySegment(this); segment.SetSegmentHeader(segmentHeader); break; case Segment.INTERMEDIATE_HALFTONE_REGION: segment = new HalftoneRegionSegment(this, false); segment.SetSegmentHeader(segmentHeader); break; case Segment.IMMEDIATE_HALFTONE_REGION: segment = new HalftoneRegionSegment(this, true); segment.SetSegmentHeader(segmentHeader); break; case Segment.IMMEDIATE_LOSSLESS_HALFTONE_REGION: segment = new HalftoneRegionSegment(this, true); segment.SetSegmentHeader(segmentHeader); break; case Segment.INTERMEDIATE_GENERIC_REGION: segment = new GenericRegionSegment(this, false); segment.SetSegmentHeader(segmentHeader); break; case Segment.IMMEDIATE_GENERIC_REGION: segment = new GenericRegionSegment(this, true); segment.SetSegmentHeader(segmentHeader); break; case Segment.IMMEDIATE_LOSSLESS_GENERIC_REGION: segment = new GenericRegionSegment(this, true); segment.SetSegmentHeader(segmentHeader); break; case Segment.INTERMEDIATE_GENERIC_REFINEMENT_REGION: segment = new RefinementRegionSegment(this, false, referredToSegments, noOfReferredToSegments); segment.SetSegmentHeader(segmentHeader); break; case Segment.IMMEDIATE_GENERIC_REFINEMENT_REGION: segment = new RefinementRegionSegment(this, true, referredToSegments, noOfReferredToSegments); segment.SetSegmentHeader(segmentHeader); break; case Segment.IMMEDIATE_LOSSLESS_GENERIC_REFINEMENT_REGION: segment = new RefinementRegionSegment(this, true, referredToSegments, noOfReferredToSegments); segment.SetSegmentHeader(segmentHeader); break; case Segment.PAGE_INFORMATION: segment = new PageInformationSegment(this); segment.SetSegmentHeader(segmentHeader); break; case Segment.END_OF_PAGE: continue; case Segment.END_OF_STRIPE: segment = new EndOfStripeSegment(this); segment.SetSegmentHeader(segmentHeader); break; case Segment.END_OF_FILE: finished = true; continue; case Segment.PROFILES: break; case Segment.TABLES: break; case Segment.EXTENSION: segment = new ExtensionSegment(this); segment.SetSegmentHeader(segmentHeader); break; default: break; } if (!randomAccessOrganisation) { segment.ReadSegment(); } segments.Add(segment); } if (randomAccessOrganisation) { foreach (Segment segment in segments) { segment.ReadSegment(); } } }