예제 #1
0
        public IVAxisAggregate(RecordStream rs, ChartRecordAggregate container, AxisRecord axis)
            : base(RuleName_IVAXIS, container)
        {
            this.axis = axis;

            if (rs.PeekNextChartSid() == CatSerRangeRecord.sid)
            {
                catSerRange = (CatSerRangeRecord)rs.GetNext();
            }

            Debug.Assert(rs.PeekNextChartSid() == AxcExtRecord.sid);
            axcExt = (AxcExtRecord)rs.GetNext();

            if (rs.PeekNextChartSid() == CatLabRecord.sid)
            {
                catLab = (CatLabRecord)rs.GetNext();
            }

            axs = new AXSAggregate(rs, this);
            while (rs.PeekNextChartSid() == CrtMlFrtRecord.sid)
            {
                crtmlfrtList.Add(new CrtMlFrtAggregate(rs, this));
            }

            Record r = rs.GetNext();//EndRecord

            Debug.Assert(r.GetType() == typeof(EndRecord));
        }
 public override void Flush()
 {
     if (RecordStream != null)
     {
         RecordStream.Flush();
     }
 }
예제 #3
0
        public void TagsAreNotReWrittenOnOpen()
        {
            var tags = new[]
            {
                "alpha", "beta", "charlie", "delta", "echo", "foxtrot", "golf"
            };

            foreach (var tag in tags)
            {
                _cache.AddOrGet(tag);
            }
            _cache.Dispose();
            _cache = null;

            using (var opened = new TagsCache())
            {
                opened.Open(_path);
                opened.Dispose();
            }

            using (var file = new RecordStream <int>())
            {
                file.Open(_path);
                file.DeclareRecordType(0, typeof(TagStorageClass));

                Assert.That(file.ReadRecords <TagStorageClass>().Count(t => t.Tag == "charlie"), Is.EqualTo(1));
            }
        }
예제 #4
0
        public void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            if (!IsRecording)
            {
                return;
            }

            lock (RecordStream)
            {
                SkeletonFrame skeletonFrame = e.SkeletonFrame;
                int           iSkeleton     = 0;

                foreach (SkeletonData data in skeletonFrame.Skeletons)
                {
                    if (SkeletonTrackingState.Tracked == data.TrackingState)
                    {
                        //Recording for longer than a day will cause the timer to roll over.  Who would record 24+ hours of Kinect data anyways?
                        TimeSpan elapsedTime = DateTime.Now - StartTime;
                        RecordStream.Write(elapsedTime.Hours.ToString() + ":" + elapsedTime.Minutes.ToString() + ":" + elapsedTime.Seconds.ToString() + ":" + elapsedTime.Milliseconds.ToString() + ",");
                        foreach (Joint joint in data.Joints)
                        {
                            RecordStream.Write(joint.ID.ToString() + "," + (joint.Position.X * 1000).ToString() + "," + (joint.Position.Y * 1000) + "," + (joint.Position.Z * 1000) + ",");
                        }
                        RecordStream.WriteLine("");
                    }
                    iSkeleton++;
                } // for each skeleton
            }
        }
예제 #5
0
        public void TestDuplicatePSBRecord_bug47199()
        {
            // Hypothetical Setup of PSB records which should cause POI to crash
            NPOI.HSSF.Record.Record[] recs =
            {
                new HeaderRecord("&LSales Figures"),
                new HeaderRecord("&LInventory"),
            };
            RecordStream rs = new RecordStream(Arrays.AsList(recs), 0);

            try
            {
                new PageSettingsBlock(rs);
                throw new AssertionException("Identified bug 47199b - duplicate PSB records should not be allowed");
            }
            catch (RecordFormatException e)
            {
                if (e.Message.Equals("Duplicate PageSettingsBlock record (sid=0x14)"))
                {
                    // expected during successful Test
                }
                else
                {
                    throw new AssertionException("Expected RecordFormatException due to duplicate PSB record");
                }
            }
        }
예제 #6
0
        public LDAggregate(RecordStream rs, ChartRecordAggregate container)
            : base(RuleName_LD, container)
        {
            legend = (LegendRecord)rs.GetNext();
            rs.GetNext();//BeginRecord
            pos           = (PosRecord)rs.GetNext();
            attachedLabel = new AttachedLabelAggregate(rs, this);

            if (rs.PeekNextChartSid() == FrameRecord.sid)
            {
                frame = new FrameAggregate(rs, this);
            }
            if (rs.PeekNextChartSid() == CrtLayout12Record.sid)
            {
                crtLayout = (CrtLayout12Record)rs.GetNext();
            }
            if (rs.PeekNextChartSid() == TextPropsStreamRecord.sid)
            {
                textProps = new TextPropsAggregate(rs, this);
            }
            if (rs.PeekNextChartSid() == CrtMlFrtRecord.sid)
            {
                crtMlFrt = new CrtMlFrtAggregate(rs, this);
            }
            Record r = rs.GetNext();//EndRecord

            Debug.Assert(r.GetType() == typeof(EndRecord));
        }
예제 #7
0
        public AxisParentAggregate(RecordStream rs, ChartRecordAggregate container)
            : base(RuleName_AXISPARENT, container)
        {
            axisPraent = (AxisParentRecord)rs.GetNext();
            rs.GetNext();
            pos = (PosRecord)rs.GetNext();
            if (ChartFormatRecord.sid != rs.PeekNextChartSid())
            {
                try
                {
                    axes = new AxesAggregate(rs, this);
                }
                catch
                {
                    Debug.Print("not find axes rule records");
                    axes = null;
                }
            }
            Debug.Assert(ChartFormatRecord.sid == rs.PeekNextChartSid());
            while (ChartFormatRecord.sid == rs.PeekNextChartSid())
            {
                crtList.Add(new CRTAggregate(rs, this));
            }
            Record r = rs.GetNext();//EndRecord

            Debug.Assert(r.GetType() == typeof(EndRecord));
        }
        public ChartSubstreamRecordAggregate(RecordStream rs)
        {
            _bofRec = (BOFRecord)rs.GetNext();
            List <RecordBase> temp = new List <RecordBase>();

            while (rs.PeekNextClass() != typeof(EOFRecord))
            {
                Type a = rs.PeekNextClass();
                if (PageSettingsBlock.IsComponentRecord(rs.PeekNextSid()))
                {
                    if (_psBlock != null)
                    {
                        if (rs.PeekNextSid() == HeaderFooterRecord.sid)
                        {
                            // test samples: 45538_classic_Footer.xls, 45538_classic_Header.xls
                            _psBlock.AddLateHeaderFooter((HeaderFooterRecord)rs.GetNext());
                            continue;
                        }
                        throw new InvalidDataException(
                                  "Found more than one PageSettingsBlock in chart sub-stream");
                    }
                    _psBlock = new PageSettingsBlock(rs);
                    temp.Add(_psBlock);
                    continue;
                }
                temp.Add(rs.GetNext());
            }
            _recs = temp;
            Record eof = rs.GetNext(); // no need to save EOF in field

            if (!(eof is EOFRecord))
            {
                throw new InvalidOperationException("Bad chart EOF");
            }
        }
예제 #9
0
        public void TestAbnormalPivotTableRecords_bug46280()
        {
            int SXVIEW_SID = ViewDefinitionRecord.sid;

            Record[] inRecs =
            {
                new RowRecord(0),
                new NumberRecord(),
                // normally MSODRAWING(0x00EC) would come here before SXVIEW
                new UnknownRecord(SXVIEW_SID,System.Text.Encoding.UTF8.GetBytes("dummydata (SXVIEW: View DefInition)")),
                new WindowTwoRecord(),
            };
            RecordStream    rs  = new RecordStream(inRecs.ToList(), 0);
            RowBlocksReader rbr = new RowBlocksReader(rs);

            if (rs.PeekNextClass() == typeof(WindowTwoRecord))
            {
                // Should have stopped at the SXVIEW record
                throw new AssertionException("Identified bug 46280b");
            }
            RecordStream rbStream = rbr.PlainRecordStream;

            Assert.AreEqual(inRecs[0], rbStream.GetNext());
            Assert.AreEqual(inRecs[1], rbStream.GetNext());
            Assert.IsFalse(rbStream.HasNext());
            Assert.IsTrue(rs.HasNext());
            Assert.AreEqual(inRecs[2], rs.GetNext());
            Assert.AreEqual(inRecs[3], rs.GetNext());
        }
예제 #10
0
        public CustomViewSettingsRecordAggregate(RecordStream rs)
        {
            _begin = rs.GetNext();
            if (_begin.Sid != UserSViewBegin.sid)
            {
                throw new InvalidOperationException("Bad begin record");
            }
            List <RecordBase> temp = new List <RecordBase>();

            while (rs.PeekNextSid() != UserSViewEnd.sid)
            {
                if (PageSettingsBlock.IsComponentRecord(rs.PeekNextSid()))
                {
                    if (_psBlock != null)
                    {
                        throw new InvalidOperationException(
                                  "Found more than one PageSettingsBlock in custom view Settings sub-stream");
                    }
                    _psBlock = new PageSettingsBlock(rs);
                    temp.Add(_psBlock);
                    continue;
                }
                temp.Add(rs.GetNext());
            }
            _recs = temp;
            _end  = rs.GetNext(); // no need to save EOF in field
            if (_end.Sid != UserSViewEnd.sid)
            {
                throw new InvalidOperationException("Bad custom view Settings end record");
            }
        }
예제 #11
0
        public void TestUnknownContinue_bug46280()
        {
            byte[]   dummtydata    = Encoding.GetEncoding(1252).GetBytes("dummydata");
            byte[]   moredummydata = Encoding.GetEncoding(1252).GetBytes("moredummydata");
            Record[] inRecs        =
            {
                new RowRecord(0),
                new NumberRecord(),
                new UnknownRecord(0x5555,dummtydata),
                new ContinueRecord(moredummydata)
                //new UnknownRecord(0x5555, "dummydata".getBytes()),
                //new ContinueRecord("moredummydata".getBytes()),
            };
            RecordStream        rs = new RecordStream(Arrays.AsList(inRecs), 0);
            RowRecordsAggregate rra;

            try
            {
                rra = new RowRecordsAggregate(rs, SharedValueManager.CreateEmpty());
            }
            catch (RuntimeException e)
            {
                if (e.Message.StartsWith("Unexpected record type"))
                {
                    Assert.Fail("Identified bug 46280a");
                }
                throw e;
            }
            RecordInspector.RecordCollector rv = new RecordInspector.RecordCollector();
            rra.VisitContainedRecords(rv);
            Record[] outRecs = rv.Records;
            Assert.AreEqual(5, outRecs.Length);
        }
예제 #12
0
        public DVAxisAggregate(RecordStream rs, ChartRecordAggregate container, AxisRecord axis)
            : base(RuleName_DVAXIS, container)
        {
            if (axis == null)
            {
                this.axis = (AxisRecord)rs.GetNext();
                rs.GetNext();
            }
            else
            {
                this.axis = axis;
            }

            if (rs.PeekNextChartSid() == ValueRangeRecord.sid)
            {
                valueRange = (ValueRangeRecord)rs.GetNext();
            }

            if (rs.PeekNextChartSid() == YMultRecord.sid)
            {
                axm = new AXMAggregate(rs, this);
            }

            axs = new AXSAggregate(rs, this);
            if (rs.PeekNextChartSid() == CrtMlFrtRecord.sid)
            {
                crtmlfrt = new CrtMlFrtAggregate(rs, this);
            }

            Record r = rs.GetNext();//EndRecord

            Debug.Assert(r.GetType() == typeof(EndRecord));
        }
예제 #13
0
        public GelFrameAggregate(RecordStream rs, ChartRecordAggregate container)
            : base(RuleName_GELFRAME, container)
        {
            gelFrame1 = (GelFrameRecord)rs.GetNext();
            int sid = rs.PeekNextChartSid();

            if (sid == GelFrameRecord.sid)
            {
                gelFrame2 = (GelFrameRecord)rs.GetNext();
                sid       = rs.PeekNextChartSid();
            }
            if (sid == ContinueRecord.sid)
            {
                while (rs.PeekNextChartSid() == ContinueRecord.sid)
                {
                    continues.Add((ContinueRecord)rs.GetNext());
                }
            }
            if (rs.PeekNextChartSid() == BeginRecord.sid)
            {
                rs.GetNext();
                picF = (PicFRecord)rs.GetNext();
                Record r = rs.GetNext();//EndRecord
                Debug.Assert(r.GetType() == typeof(EndRecord));
            }
        }
예제 #14
0
        public void TestMissingHeaderFooter()
        {
            // Initialise PSB with some records, but not the header / footer
            NPOI.HSSF.Record.Record[] recs =
            {
                new HCenterRecord(),
                new VCenterRecord(),
            };
            RecordStream      rs  = new RecordStream(Arrays.AsList(recs), 0);
            PageSettingsBlock psb = new PageSettingsBlock(rs);

            // serialize the PSB to see what records come out
            RecordInspector.RecordCollector rc = new RecordInspector.RecordCollector();
            psb.VisitContainedRecords(rc);
            NPOI.HSSF.Record.Record[] outRecs = rc.Records;

            if (outRecs.Length == 2)
            {
                throw new AssertionException("PageSettingsBlock didn't add missing header/footer records");
            }
            Assert.AreEqual(4, outRecs.Length);
            Assert.AreEqual(typeof(HeaderRecord), outRecs[0].GetType());
            Assert.AreEqual(typeof(FooterRecord), outRecs[1].GetType());
            Assert.AreEqual(typeof(HCenterRecord), outRecs[2].GetType());
            Assert.AreEqual(typeof(VCenterRecord), outRecs[3].GetType());

            // make sure the Added header / footer records are empty
            HeaderRecord hr = (HeaderRecord)outRecs[0];

            Assert.AreEqual("", hr.Text);
            FooterRecord fr = (FooterRecord)outRecs[1];

            Assert.AreEqual("", fr.Text);
        }
예제 #15
0
        private bool ReadARecord(RecordStream rs)
        {
            switch (rs.PeekNextSid())
            {
            case ProtectRecord.sid:
                CheckNotPresent(_protectRecord);
                _protectRecord = rs.GetNext() as ProtectRecord;
                break;

            case ObjectProtectRecord.sid:
                CheckNotPresent(_objectProtectRecord);
                _objectProtectRecord = rs.GetNext() as ObjectProtectRecord;
                break;

            case ScenarioProtectRecord.sid:
                CheckNotPresent(_scenarioProtectRecord);
                _scenarioProtectRecord = rs.GetNext() as ScenarioProtectRecord;
                break;

            case PasswordRecord.sid:
                CheckNotPresent(_passwordRecord);
                _passwordRecord = rs.GetNext() as PasswordRecord;
                break;

            default:
                // all other record types are not part of the PageSettingsBlock
                return(false);
            }
            return(true);
        }
예제 #16
0
        public void Open(string path)
        {
            _file = new RecordStream <int>();
            _file.Open(path);
            DeclareRecordType();

            LoadTags();
        }
예제 #17
0
 public TlsProtocol(SecureRandom secureRandom)
 {
     mBlocking     = false;
     mInputBuffers = new ByteQueueStream();
     mOutputBuffer = new ByteQueueStream();
     mRecordStream = new RecordStream(this, mInputBuffers, mOutputBuffer);
     mSecureRandom = secureRandom;
 }
예제 #18
0
 public PageSettingsBlock(RecordStream rs)
 {
     _rowRecords = new ArrayList();
     while (ReadARecord(rs))
     {
         ;
     }
 }
예제 #19
0
 public PageSettingsBlock(RecordStream rs)
 {
     _plsRecords = new List <PLSAggregate>();
     while (ReadARecord(rs))
     {
         ;
     }
 }
예제 #20
0
        public CRTAggregate(RecordStream rs, ChartRecordAggregate container)
            : base(RuleName_CRT, container)
        {
            chartForamt = (ChartFormatRecord)rs.GetNext();
            rs.GetNext();

            chartTypeRecord = rs.GetNext();
            if (rs.PeekNextChartSid() == BopPopCustomRecord.sid)
            {
                bopPopCustom = (BopPopCustomRecord)rs.GetNext();
            }
            crtLink = (CrtLinkRecord)rs.GetNext();
            if (rs.PeekNextChartSid() == SeriesListRecord.sid)
            {
                seriesList = (SeriesListRecord)rs.GetNext();
            }
            if (rs.PeekNextChartSid() == Chart3dRecord.sid)
            {
                chart3d = (Chart3dRecord)rs.GetNext();
            }
            if (rs.PeekNextChartSid() == LegendRecord.sid)
            {
                ld = new LDAggregate(rs, this);
            }
            if (rs.PeekNextChartSid() == DropBarRecord.sid)
            {
                dropBar1 = new DropBarAggregate(rs, this);
                dropBar2 = new DropBarAggregate(rs, this);
            }

            while (rs.PeekNextChartSid() == CrtLineRecord.sid)
            {
                dicLines.Add((CrtLineRecord)rs.GetNext(), (LineFormatRecord)rs.GetNext());
            }
            if (rs.PeekNextChartSid() == DataLabExtRecord.sid || rs.PeekNextChartSid() == DefaultTextRecord.sid)
            {
                dft1 = new DFTTextAggregate(rs, this);
                if (rs.PeekNextChartSid() == DataLabExtRecord.sid || rs.PeekNextChartSid() == DefaultTextRecord.sid)
                {
                    dft2 = new DFTTextAggregate(rs, this);
                }
            }
            if (rs.PeekNextChartSid() == DataLabExtContentsRecord.sid)
            {
                dataLabExtContents = (DataLabExtContentsRecord)rs.GetNext();
            }

            if (rs.PeekNextChartSid() == DataFormatRecord.sid)
            {
                ss = new SSAggregate(rs, this);
            }
            while (rs.PeekNextChartSid() == ShapePropsStreamRecord.sid)
            {
                shapeList.Add(new ShapePropsAggregate(rs, this));
            }

            rs.GetNext();
        }
예제 #21
0
        public AXMAggregate(RecordStream rs, ChartRecordAggregate container)
            : base(RuleName_AXM, container)
        {
            yMult         = (YMultRecord)rs.GetNext();
            startObject   = (ChartStartObjectRecord)rs.GetNext();
            attachedLabel = new AttachedLabelAggregate(rs, this);

            endObject = (ChartEndObjectRecord)rs.GetNext();
        }
예제 #22
0
        public SeriesFormatAggregate(RecordStream rs, ChartRecordAggregate container)
            : base(RuleName_SERIESFORMAT, container)
        {
            series = (SeriesRecord)rs.GetNext();
            rs.GetNext();
            BRAIRecord       ai;
            SeriesTextRecord sText;

            while (rs.PeekNextChartSid() == BRAIRecord.sid)
            {
                sText = null;
                ai    = (BRAIRecord)rs.GetNext();
                if (rs.PeekNextChartSid() == SeriesTextRecord.sid)
                {
                    sText = (SeriesTextRecord)rs.GetNext();
                }
                dic4AI.Add(ai, sText);
            }
            if (rs.PeekNextChartSid() == DataFormatRecord.sid)
            {
                while (rs.PeekNextChartSid() == DataFormatRecord.sid)
                {
                    ssList.Add(new SSAggregate(rs, this));
                }
            }
            if (rs.PeekNextChartSid() == SerToCrtRecord.sid)
            {
                serToCrt = (SerToCrtRecord)rs.GetNext();
            }
            else
            {
                if (rs.PeekNextChartSid() == SerParentRecord.sid)
                {
                    serParent = (SerParentRecord)rs.GetNext();
                    if (rs.PeekNextChartSid() == SerAuxTrendRecord.sid)
                    {
                        serAuxTrend = (SerAuxTrendRecord)rs.GetNext();
                    }
                    else
                    {
                        serAuxErrBar = (SerAuxErrBarRecord)rs.GetNext();
                    }
                }
            }

            if (rs.PeekNextChartSid() == LegendExceptionRecord.sid)
            {
                while (rs.PeekNextChartSid() == LegendExceptionRecord.sid)
                {
                    leList.Add(new LegendExceptionAggregate(rs, this));
                }
            }

            Record r = rs.GetNext();//EndRecord

            Debug.Assert(r.GetType() == typeof(EndRecord));
        }
예제 #23
0
        /**
         * @param rs record stream with all {@link SharedFormulaRecord}
         * {@link ArrayRecord}, {@link TableRecord} {@link MergeCellsRecord} Records removed
         */
        public RowRecordsAggregate(RecordStream rs, SharedValueManager svm)
            : this(svm)
        {
            while (rs.HasNext())
            {
                Record rec = rs.GetNext();
                switch (rec.Sid)
                {
                case RowRecord.sid:
                    InsertRow((RowRecord)rec);
                    continue;

                case DConRefRecord.sid:
                    AddUnknownRecord(rec);
                    continue;

                case HyperlinkRecord.sid:
                    _hyperlinkRecordRecords.Add((HyperlinkRecord)rec);
                    continue;

                case DBCellRecord.sid:
                    // end of 'Row Block'.  Should only occur after cell records
                    // ignore DBCELL records because POI generates them upon re-serialization
                    continue;
                }
                if (rec is UnknownRecord)
                {
                    // might need to keep track of where exactly these belong
                    AddUnknownRecord((UnknownRecord)rec);

                    while (rs.PeekNextSid() == ContinueRecord.sid)
                    {
                        AddUnknownRecord(rs.GetNext());
                    }
                    continue;
                }
                if (rec is MulBlankRecord)
                {
                    _valuesAgg.AddMultipleBlanks((MulBlankRecord)rec);
                    continue;
                }

                if (!(rec is CellValueRecordInterface))
                {
                    //TODO: correct it, SeriesIndexRecord will appear in a separate chart sheet that contains a single chart
                    // rule SERIESDATA = Dimensions 3(SIIndex *(Number / BoolErr / Blank / Label))
                    if (rec.Sid == SeriesIndexRecord.sid)
                    {
                        AddUnknownRecord(rec);
                        continue;
                    }
                    throw new InvalidOperationException("Unexpected record type (" + rec.GetType().Name + ")");
                }
                _valuesAgg.Construct((CellValueRecordInterface)rec, rs, svm);
            }
        }
예제 #24
0
        public ConditionalFormattingTable(RecordStream rs)
        {
            IList temp = new ArrayList();

            while (rs.PeekNextClass() == typeof(CFHeaderRecord))
            {
                temp.Add(CFRecordsAggregate.CreateCFAggregate(rs));
            }
            _cfHeaders = temp;
        }
예제 #25
0
 /// <summary>
 /// This method reads PageSettingsBlock records from the supplied RecordStream until the first non-PageSettingsBlock record is encountered.
 /// As each record is read, it is incorporated into this PageSettingsBlock.
 /// </summary>
 /// <param name="rs"></param>
 public void AddLateRecords(RecordStream rs)
 {
     while (true)
     {
         if (!ReadARecord(rs))
         {
             break;
         }
     }
 }
예제 #26
0
 public DataValidityTable(RecordStream rs)
 {
     _headerRec = (DVALRecord)rs.GetNext();
     IList temp = new ArrayList();
     while (rs.PeekNextClass() == typeof(DVRecord))
     {
         temp.Add(rs.GetNext());
     }
     _validationList = temp;
 }
예제 #27
0
        public DatAggregate(RecordStream rs, ChartRecordAggregate container)
            : base(RuleName_DAT, container)
        {
            dat = (DatRecord)rs.GetNext();
            rs.GetNext();
            ld = new LDAggregate(rs, this);

            Record r = rs.GetNext();//EndRecord

            Debug.Assert(r.GetType() == typeof(EndRecord));
        }
예제 #28
0
 public void Flush()
 {
     if (Writer != null)
     {
         Writer.Flush();
     }
     if (RecordStream != null)
     {
         RecordStream.Flush();
     }
 }
예제 #29
0
        public SSAggregate(RecordStream rs, ChartRecordAggregate container)
            : base(RuleName_SS, container)
        {
            dataFormat = (DataFormatRecord)rs.GetNext();
            rs.GetNext();
            if (rs.PeekNextChartSid() == Chart3DBarShapeRecord.sid)
            {
                chart3DBarShape = (Chart3DBarShapeRecord)rs.GetNext();
            }
            if (rs.PeekNextChartSid() == LineFormatRecord.sid)
            {
                lineFormat = (LineFormatRecord)rs.GetNext();
                areaFormat = (AreaFormatRecord)rs.GetNext();
                pieFormat  = (PieFormatRecord)rs.GetNext();
            }
            if (rs.PeekNextChartSid() == SerFmtRecord.sid)
            {
                serFmt = (SerFmtRecord)rs.GetNext();
            }

            if (rs.PeekNextChartSid() == GelFrameRecord.sid)
            {
                gelFrame = new GelFrameAggregate(rs, this);
            }

            if (rs.PeekNextChartSid() == MarkerFormatRecord.sid)
            {
                markerFormat = (MarkerFormatRecord)rs.GetNext();
            }

            if (rs.PeekNextChartSid() == AttachedLabelRecord.sid)
            {
                attachedLabel = (AttachedLabelRecord)rs.GetNext();
            }

            if (rs.PeekNextChartSid() == ShapePropsStreamRecord.sid)
            {
                shapeProps1 = new ShapePropsAggregate(rs, this);
            }

            if (rs.PeekNextChartSid() == ShapePropsStreamRecord.sid)
            {
                shapeProps2 = new ShapePropsAggregate(rs, this);
            }

            if (rs.PeekNextChartSid() == CrtMlFrtRecord.sid)
            {
                crtMlFrt = new CrtMlFrtAggregate(rs, this);
            }

            Record r = rs.GetNext();//EndRecord

            Debug.Assert(r.GetType() == typeof(EndRecord));
        }
예제 #30
0
        public void Open(string path)
        {
            lock (_lock)
            {
                _file = new RecordStream <int>();
                DeclareRecordType();
                _file.Open(path);

                LoadPaths();
            }
        }
예제 #31
0
        unsafe internal LogLogRecord(
            SequenceNumber sequenceNumber,
            SequenceNumber user,
            SequenceNumber previous,
            byte* data,
            long length)
        {
            this.sequenceNumber = sequenceNumber;
            this.previous = previous;
            this.user = user;

            if (length < LogLogRecordHeader.Size)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.LogCorrupt());
            }

            byte[] headerBits = new byte[LogLogRecordHeader.Size];
            Marshal.Copy(new IntPtr(data),
                         headerBits,
                         0,
                         LogLogRecordHeader.Size);

            LogLogRecordHeader header = new LogLogRecordHeader(headerBits);
            if (header.MajorVersion > LogLogRecordHeader.CurrentMajorVersion)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.IncompatibleVersion());
            }

            length -= LogLogRecordHeader.Size;
            data += LogLogRecordHeader.Size;
            if (header.Padding)
            {
                long paddingSize = LogLogRecordHeader.DecodePaddingSize(data, length);
                if ((paddingSize < 0) || (paddingSize > length))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.LogCorrupt());
                }

                length -= paddingSize;
                data += paddingSize;
            }

            this.stream = new RecordStream(
                new UnmanagedMemoryStream(data, length));
        }