public void TestProcessRecords()
        {
            bool[] wascalled = { false, }; // hack to pass boolean by ref into inner class

            IERFListener listener = new ERFListener1(ref wascalled);
            ArrayList param = new ArrayList();
            param.Add(BOFRecord.sid);
            EventRecordFactory factory = new EventRecordFactory(listener, param);

            BOFRecord bof = new BOFRecord();
            bof.Build = ((short)0);
            bof.BuildYear = ((short)1999);
            bof.RequiredVersion = (123);
            bof.Type = (BOFRecordType.Workbook);
            bof.Version = ((short)0x06);
            bof.HistoryBitMask = (BOFRecord.HISTORY_MASK);

            EOFRecord eof = EOFRecord.instance;
            byte[] bytes = new byte[bof.RecordSize + eof.RecordSize];
            int offset = 0;
            offset = bof.Serialize(offset, bytes);
            offset = eof.Serialize(offset, bytes);

            factory.ProcessRecords(new MemoryStream(bytes));
            Assert.IsTrue(wascalled[0], "The record listener must be called");
        }
Ejemplo n.º 2
0
        public override object Clone()
        {
            BOFRecord rec = new BOFRecord();

            rec.field_1_version  = field_1_version;
            rec.field_2_type     = field_2_type;
            rec.field_3_build    = field_3_build;
            rec.field_4_year     = field_4_year;
            rec.field_5_history  = field_5_history;
            rec.field_6_rversion = field_6_rversion;
            return(rec);
        }
Ejemplo n.º 3
0
 private BOFRecord CreateBOFRecord()
 {
     BOFRecord r = new BOFRecord();
     r.Version = ((short)600);
     r.Type = BOFRecordType.Chart;
     r.Build = ((short)0x1CFE);
     r.BuildYear = ((short)1997);
     r.HistoryBitMask = (0x40C9);
     r.RequiredVersion = (106);
     return r;
 }
Ejemplo n.º 4
0
 private static BOFRecord CreateBOFRecord()
 {
     BOFRecord retval = new BOFRecord();
     retval.Version = ((short)600);
     retval.Type = BOFRecord.TYPE_CHART;
     retval.Build = ((short)0x1CFE);
     retval.BuildYear = ((short)1997);
     retval.HistoryBitMask = (0x40C9);
     retval.RequiredVersion = (106);
     return retval;
 }
Ejemplo n.º 5
0
        /**
         * Creates the BOF record
         * @see org.apache.poi.hssf.record.BOFRecord
         * @see org.apache.poi.hssf.record.Record
         * @return record containing a BOFRecord
         */

        private static Record CreateBOF()
        {
            BOFRecord retval = new BOFRecord();

            retval.Version=(short)0x600;
            retval.Type = BOFRecordType.Workbook;
            retval.Build=(short)0x10d3;

            //        retval.Build=(short)0x0dbb;
            retval.BuildYear=(short)1996;
            retval.HistoryBitMask=0x41;   // was c1 before verify
            retval.RequiredVersion=0x6;
            return retval;
        }
Ejemplo n.º 6
0
 public override object Clone()
 {
     BOFRecord rec = new BOFRecord();
     rec.field_1_version = field_1_version;
     rec.field_2_type = field_2_type;
     rec.field_3_build = field_3_build;
     rec.field_4_year = field_4_year;
     rec.field_5_history = field_5_history;
     rec.field_6_rversion = field_6_rversion;
     return rec;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates the BOF record
        /// </summary>
        /// <returns>record containing a BOFRecord</returns>
        public static Record CreateBOF()
        {
            BOFRecord retval = new BOFRecord();

            retval.Version = ((short)0x600);
            retval.Type = ((short)0x010);

            retval.Build = ((short)0x0dbb);
            retval.BuildYear = ((short)1996);
            retval.HistoryBitMask = (0xc1);
            retval.RequiredVersion = (0x6);
            return retval;
        }
        public void TestCreateRecord()
        {
            BOFRecord bof = new BOFRecord();
            bof.Build = ((short)0);
            bof.BuildYear = ((short)1999);
            bof.RequiredVersion = (123);
            bof.Type = (BOFRecordType.Workbook);
            bof.Version = ((short)0x06);
            bof.HistoryBitMask = (BOFRecord.HISTORY_MASK);

            byte[] bytes = bof.Serialize();

            Record[] records = RecordFactory.CreateRecord(TestcaseRecordInputStream.Create(bytes));

            Assert.IsTrue(records.Length == 1, "record.Length must be 1, was =" + records.Length);
            Assert.IsTrue(CompareRec(bof, records[0]), "record is the same");

        }
Ejemplo n.º 9
0
        private void Prepare()
        {
            if (!ris.HasNextRecord)
                throw new ArgumentException("File Contains no records!");
            ris.NextRecord();

            // Work out what version we're dealing with
            int bofSid = ris.Sid;
            switch (bofSid)
            {
                case BOFRecord.biff2_sid:
                    biffVersion = 2;
                    break;
                case BOFRecord.biff3_sid:
                    biffVersion = 3;
                    break;
                case BOFRecord.biff4_sid:
                    biffVersion = 4;
                    break;
                case BOFRecord.biff5_sid:
                    biffVersion = 5;
                    break;
                default:
                    throw new ArgumentException("File does not begin with a BOF, found sid of " + bofSid);
            }

            // Get the type
            BOFRecord bof = new BOFRecord(ris);
            fileType = (int)bof.Type;
        }
Ejemplo n.º 10
0
        /**
         * Creates the BOF record
         * @see org.apache.poi.hssf.record.BOFRecord
         * @see org.apache.poi.hssf.record.Record
         * @return record containing a BOFRecord
         */

        protected Record CreateBOF()
        {
            BOFRecord retval = new BOFRecord();

            retval.Version=(short)0x600;
            retval.Type=(short)5;
            retval.Build=(short)0x10d3;

            //        retval.Build=(short)0x0dbb;
            retval.BuildYear=(short)1996;
            retval.HistoryBitMask=0x41;   // was c1 before verify
            retval.RequiredVersion=0x6;
            return retval;
        }