예제 #1
0
        public FeatRecord(RecordInputStream in1)
        {
            futureHeader = new FtrHeader(in1);

            isf_sharedFeatureType = in1.ReadShort();
            reserved1 = (byte)in1.ReadByte();
            reserved2 = in1.ReadInt();
            int cref = in1.ReadUShort();
            cbFeatData = in1.ReadInt();
            reserved3 = in1.ReadShort();

            cellRefs = new CellRangeAddress[cref];
            for (int i = 0; i < cellRefs.Length; i++)
            {
                cellRefs[i] = new CellRangeAddress(in1);
            }

            switch (isf_sharedFeatureType)
            {
                case FeatHdrRecord.SHAREDFEATURES_ISFPROTECTION:
                    sharedFeature = new FeatProtection(in1);
                    break;
                case FeatHdrRecord.SHAREDFEATURES_ISFFEC2:
                    sharedFeature = new FeatFormulaErr2(in1);
                    break;
                case FeatHdrRecord.SHAREDFEATURES_ISFFACTOID:
                    sharedFeature = new FeatSmartTag(in1);
                    break;
                default:
                    System.Console.WriteLine("Unknown Shared Feature " + isf_sharedFeatureType + " found!");
                    break;
            }
        }
        public ExtendedPivotTableViewFieldsRecord(RecordInputStream in1)
        {

            grbit1 = in1.ReadInt();
            grbit2 = in1.ReadUByte();
            citmShow = in1.ReadUByte();
            isxdiSort = in1.ReadUShort();
            isxdiShow = in1.ReadUShort();
            // This record seems to have different valid encodings
		    switch (in1.Remaining) {
			    case 0:
				    // as per "Microsoft Excel Developer's Kit" book
				    // older version of SXVDEX - doesn't seem to have a sub-total name
				    reserved1 = 0;
				    reserved2 = 0;
				    subName = null;
				    return;
			    case 10:
				    // as per "MICROSOFT OFFICE EXCEL 97-2007 BINARY FILE FORMAT SPECIFICATION" pdf
				    break;
			    default:
				    throw new RecordFormatException("Unexpected remaining size (" + in1.Remaining + ")");
		    }
            int cchSubName = in1.ReadUShort();
            reserved1 = in1.ReadInt();
            reserved2 = in1.ReadInt();
            if (cchSubName != STRING_NOT_PRESENT_LEN)
            {
                subName = in1.ReadUnicodeLEString(cchSubName);
            }
        }
예제 #3
0
        /**
         * Constructs a DVAL record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public DVALRecord(RecordInputStream in1)
        {
            this.field_1_options = in1.ReadShort();
            this.field_2_horiz_pos = in1.ReadInt();
            this.field_3_vert_pos = in1.ReadInt();
            this.field_cbo_id = in1.ReadInt();
            this.field_5_dv_no = in1.ReadInt();
        }
예제 #4
0
        /**
         * Constructs a Chart record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public ChartRecord(RecordInputStream in1)
        {
            field_1_x = in1.ReadInt();
            field_2_y = in1.ReadInt();
            field_3_width = in1.ReadInt();
            field_4_height = in1.ReadInt();

        }
예제 #5
0
        /**
         * Constructs a ChartFormatRecord record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public ChartFormatRecord(RecordInputStream in1)
        {
            field1_x_position = in1.ReadInt();
            field2_y_position = in1.ReadInt();
            field3_width = in1.ReadInt();
            field4_height = in1.ReadInt();
            field5_grbit = in1.ReadShort();
        }
예제 #6
0
        /**
         * Constructs a Dimensions record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public DimensionsRecord(RecordInputStream in1)
        {
            field_1_first_row = in1.ReadInt();
            field_2_last_row = in1.ReadInt();
            field_3_first_col = in1.ReadShort();
            field_4_last_col = in1.ReadShort();
            field_5_zero = in1.ReadShort();
        }
예제 #7
0
        public FeatProtection(RecordInputStream in1)
        {
            fSD = in1.ReadInt();
            passwordVerifier = in1.ReadInt();

            title = StringUtil.ReadUnicodeString(in1);

            securityDescriptor = in1.ReadRemainder();
        }
예제 #8
0
        /**
         * Constructs a Axis record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public AxisRecord(RecordInputStream in1)
        {
            field_1_axisType = in1.ReadShort();
            field_2_reserved1 = in1.ReadInt();
            field_3_reserved2 = in1.ReadInt();
            field_4_reserved3 = in1.ReadInt();
            field_5_reserved4 = in1.ReadInt();

        }
예제 #9
0
        /**
         * Constructs a AreaFormat record and s its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public AreaFormatRecord(RecordInputStream in1)
        {

            field_1_foregroundColor = in1.ReadInt();
            field_2_backgroundColor = in1.ReadInt();
            field_3_pattern = in1.ReadShort();
            field_4_formatFlags = in1.ReadShort();
            field_5_forecolorIndex = in1.ReadShort();
            field_6_backcolorIndex = in1.ReadShort();
        }
예제 #10
0
        /**
         * Constructs a Legend record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public LegendRecord(RecordInputStream in1)
        {
            field_1_xAxisUpperLeft = in1.ReadInt();
            field_2_yAxisUpperLeft = in1.ReadInt();
            field_3_xSize = in1.ReadInt();
            field_4_ySize = in1.ReadInt();
            field_5_type = (byte)in1.ReadByte();
            field_6_spacing = (byte)in1.ReadByte();
            field_7_options = in1.ReadShort();

        }
예제 #11
0
        /**
         * Constructs an Index record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public IndexRecord(RecordInputStream in1)
        {
            field_5_dbcells =
                new List<int>(DBCELL_CAPACITY);   // initial capacity of 30
            field_1_zero = in1.ReadInt();
            field_2_first_row = in1.ReadInt();
            field_3_last_row_add1 = in1.ReadInt();
            field_4_ibXF = in1.ReadInt();
            while (in1.Remaining > 0)
            {

                // Console.WriteLine("Getting " + k);
                field_5_dbcells.Add(in1.ReadInt());
            }
        }
예제 #12
0
        /**
         * Constructs an LabelSST record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public LabelSSTRecord(RecordInputStream in1)
        {
            field_1_row = in1.ReadUShort();
            field_2_column = in1.ReadUShort();
            field_3_xf_index = in1.ReadShort();
            field_4_sst_index = in1.ReadInt();
        }
예제 #13
0
    /**
     * Constructs a RK record and Sets its fields appropriately.
     * @param in the RecordInputstream to Read the record from
     */

    public RKRecord(RecordInputStream in1)
    {
        field_1_row = in1.ReadUShort();
        field_2_col = in1.ReadUShort();
        field_3_xf_index = in1.ReadShort();
        field_4_rk_number = in1.ReadInt();
    }
예제 #14
0
        /**
         * Constructs a Tick record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */
        public TickRecord(RecordInputStream in1)
        {
            field_1_majorTickType = (byte)in1.ReadByte();
            field_2_minorTickType = (byte)in1.ReadByte();
            field_3_labelPosition = (byte)in1.ReadByte();
            field_4_background = (byte)in1.ReadByte();
            field_5_labelColorRgb = (byte)in1.ReadInt();
            field_6_zero1 = in1.ReadInt();
            field_7_zero2 = in1.ReadInt();
            field_8_zero3 = in1.ReadInt();
            field_9_zero4 = in1.ReadInt();

            field_10_options = in1.ReadShort();
            field_11_tickColor = in1.ReadShort();
            field_12_zero5 = in1.ReadShort();
        }
예제 #15
0
        /**
         * Constructs a LineFormat record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public LineFormatRecord(RecordInputStream in1)
        {
            field_1_lineColor = in1.ReadInt();
            field_2_linePattern = in1.ReadShort();
            field_3_weight = in1.ReadShort();
            field_4_format = in1.ReadShort();
            field_5_colourPaletteIndex = in1.ReadShort();
        }
예제 #16
0
        public ArrayRecord(RecordInputStream in1)
            : base(in1)
        {

            _options = in1.ReadUShort();
            _field3notUsed = in1.ReadInt();
            int formulaLen = in1.ReadUShort();
            _formulaTokens = Ptg.ReadTokens(formulaLen, in1);
        }
예제 #17
0
        /**
         * Constructs a FILEPASS record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public FilePassRecord(RecordInputStream in1)
        {
            field_1_encryptedpassword = in1.ReadInt();

            //Whilst i have Read in the password, HSSF currently has no plans to support/decrypt the remainder
            //of this workbook
            throw new RecordFormatException("HSSF does not currently support encrypted workbooks");
 
        }
예제 #18
0
 public ArrayRecord(RecordInputStream in1)
     : base(in1)
 {
     _options = in1.ReadUShort();
     _field3notUsed = in1.ReadInt();
     int formulaTokenLen = in1.ReadUShort();
     int totalFormulaLen = in1.Available();
     _formula = NPOI.SS.Formula.Formula.Read(formulaTokenLen, in1, totalFormulaLen);
 }
예제 #19
0
 public OldSheetRecord(RecordInputStream in1)
 {
     field_1_position_of_BOF = in1.ReadInt();
     field_2_visibility = in1.ReadUByte();
     field_3_type = in1.ReadUByte();
     int field_4_sheetname_length = in1.ReadUByte();
     field_5_sheetname = new byte[field_4_sheetname_length];
     in1.Read(field_5_sheetname, 0, field_4_sheetname_length);
 }
예제 #20
0
        /**
         * Constructs an Index record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public IndexRecord(RecordInputStream in1)
        {
            field_1_zero = in1.ReadInt();
            if (field_1_zero != 0)
            {
                throw new RecordFormatException("Expected zero for field 1 but got " + field_1_zero);
            }
            field_2_first_row = in1.ReadInt();
            field_3_last_row_add1 = in1.ReadInt();
            field_4_zero = in1.ReadInt();

            int nCells = in1.Remaining / 4;
            field_5_dbcells =
                new IntList(nCells);   // initial capacity of 30
            for (int i = 0; i < nCells; i++)
            {
                field_5_dbcells.Add(in1.ReadInt());
            }

        }
예제 #21
0
        public TableStylesRecord(RecordInputStream in1)
        {
            rt = in1.ReadUShort();
            grbitFrt = in1.ReadUShort();
            in1.ReadFully(unused);
            cts = in1.ReadInt();
            int cchDefListStyle = in1.ReadUShort();
            int cchDefPivotStyle = in1.ReadUShort();

            rgchDefListStyle = in1.ReadUnicodeLEString(cchDefListStyle);
            rgchDefPivotStyle = in1.ReadUnicodeLEString(cchDefPivotStyle);
        }
예제 #22
0
        /**
         * Constructs a TextObjectBase record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public TextObjectBaseRecord(RecordInputStream in1)
        {
            field_1_options = in1.ReadShort();
            field_2_textOrientation = in1.ReadShort();
            field_3_reserved4 = in1.ReadShort();
            field_4_reserved5 = in1.ReadShort();
            field_5_reserved6 = in1.ReadShort();
            field_6_textLength = in1.ReadShort();
            field_7_formattingRunLength = in1.ReadShort();
            field_8_reserved7 = in1.ReadInt();

        }
예제 #23
0
 public SheetExtRecord(RecordInputStream in1)
 {
     rt = in1.ReadShort();
     if (rt != 0x0862)
     {
         throw new ArgumentException("frtHeader.rt must be equals 0x0862 in SheetExt record");
     }
     grbitFrt = in1.ReadShort();
     in1.ReadInt();  //reserved
     in1.ReadInt();  //reserved
     cb = in1.ReadInt();
     optionflag = in1.ReadShort();
     in1.ReadShort(); //reserved
     if (cb == 0x28)
     {
         optionflag2 = in1.ReadShort();
         xclrType = in1.ReadInt();
         xclrValue = in1.ReadInt();
         numTint = in1.ReadLong();
         in1.ReadShort();
     }
 }
예제 #24
0
        /**
         * Constructs a BoundSheetRecord and Sets its fields appropriately
         *
         * @param in the RecordInputstream to Read the record from
         */
        public BoundSheetRecord(RecordInputStream in1)
        {
            field_1_position_of_BOF = in1.ReadInt();	// bof
            field_2_option_flags = in1.ReadShort();	// flags
            int field_3_sheetname_length = in1.ReadUByte();						// len(str)
            field_4_isMultibyteUnicode = (byte)in1.ReadByte();						// Unicode

            if (this.IsMultibyte)
            {
                field_5_sheetname = in1.ReadUnicodeLEString(field_3_sheetname_length);
            }
            else
            {
                field_5_sheetname = in1.ReadCompressedUnicode(field_3_sheetname_length);
            }
        }
예제 #25
0
        /**
         * Constructs a WindowTwo record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public WindowTwoRecord(RecordInputStream in1)
        {
            int size = in1.Remaining;
            field_1_options = in1.ReadShort();
            field_2_top_row = in1.ReadShort();
            field_3_left_col = in1.ReadShort();
            field_4_header_color = in1.ReadInt();
            if (size > 10)
            {
                field_5_page_break_zoom = in1.ReadShort();
                field_6_normal_zoom = in1.ReadShort();
            }
            if (size > 14)
            {   // there Is a special case of this record that has only 14 bytes...undocumented!
                field_7_reserved = in1.ReadInt();
            }
        }
예제 #26
0
 private static object ReadAConstantValue(RecordInputStream in1)
 {
     byte grbit = (byte)in1.ReadByte();
     switch (grbit)
     {
         case TYPE_EMPTY:
             in1.ReadLong(); // 8 byte 'not used' field
             return EMPTY_REPRESENTATION;
         case TYPE_NUMBER:
             return in1.ReadDouble();
         case TYPE_STRING:
             return in1.ReadUnicodeString();
         case TYPE_bool:
             return ReadBoolean(in1);
         case TYPE_ERROR_CODE:
             int errCode = in1.ReadUShort();
             // next 6 bytes are Unused
             in1.ReadUShort();
             in1.ReadInt();
             return ErrorConstant.ValueOf(errCode);
     }
     throw new Exception("Unknown grbit value (" + grbit + ")");
 }
예제 #27
0
        public CFRuleRecord(RecordInputStream in1)
        {
            field_1_condition_type = (byte)in1.ReadByte();
            field_2_comparison_operator = (byte)in1.ReadByte();
            int field_3_formula1_len = in1.ReadUShort();
            int field_4_formula2_len = in1.ReadUShort();
            field_5_options = in1.ReadInt();
            field_6_not_used = in1.ReadShort();

            if (ContainsFontFormattingBlock)
            {
                _fontFormatting = new FontFormatting(in1);
            }

            if (ContainsBorderFormattingBlock)
            {
                _borderFormatting = new BorderFormatting(in1);
            }

            if (ContainsPatternFormattingBlock)
            {
                _patternFormatting = new PatternFormatting(in1);
            }
            field_17_formula1 = FR.Formula.Read(field_3_formula1_len, in1);
            field_18_formula2 = FR.Formula.Read(field_4_formula2_len, in1);
    }
예제 #28
0
파일: RKRecord.cs 프로젝트: purehzj/npoi-1
        /**
         * Constructs a RK record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public RKRecord(RecordInputStream in1)
            : base(in1)
        {
            field_4_rk_number = in1.ReadInt();
        }
예제 #29
0
        /**
         * Constructs an ExtendedFormat record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public ExtendedFormatRecord(RecordInputStream in1)
        {
            field_1_font_index = in1.ReadShort();
            field_2_format_index = in1.ReadShort();
            field_3_cell_options = in1.ReadShort();
            field_4_alignment_options = in1.ReadShort();
            field_5_indention_options = in1.ReadShort();
            field_6_border_options = in1.ReadShort();
            field_7_palette_options = in1.ReadShort();
            field_8_adtl_palette_options = in1.ReadInt();
            field_9_fill_palette_options = in1.ReadShort();
        }
예제 #30
0
 public ExtSSTInfoSubRecord(RecordInputStream in1)
 {
     field_1_stream_pos = in1.ReadInt();
     field_2_bucket_sst_offset = in1.ReadShort();
     field_3_zero = in1.ReadShort();
 }
예제 #31
0
        /**
         * Constructs a BOFRecord and Sets its fields appropriately
         * @param in the RecordInputstream to Read the record from
         */

        public BOFRecord(RecordInputStream in1)
        {
            field_1_version = in1.ReadShort();
            field_2_type = in1.ReadShort();

            // Some external tools don't generate all of
            //  the remaining fields
            if (in1.Remaining >= 2)
            {
                field_3_build = in1.ReadShort();
            }
            if (in1.Remaining >= 2)
            {
                field_4_year = in1.ReadShort();
            }
            if (in1.Remaining >= 4)
            {
                field_5_history = in1.ReadInt();
            }
            if (in1.Remaining >= 4)
            {
                field_6_rversion = in1.ReadInt();
            }
        }
예제 #32
0
        /**
         * Constructs a RECALCID record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public RecalcIdRecord(RecordInputStream in1)
        {
            in1.ReadUShort(); // field 'rt' should have value 0x01C1, but Excel doesn't care during reading
            _reserved0 = in1.ReadUShort();
            _engineId  = in1.ReadInt();
        }
예제 #33
0
        /**
         * Constructs an LabelSST record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public LabelSSTRecord(RecordInputStream in1)
            : base(in1)
        {
            field_4_sst_index = in1.ReadInt();
        }
예제 #34
0
        public TextObjectRecord(RecordInputStream in1)
        {
            field_1_options         = in1.ReadUShort();
            field_2_textOrientation = in1.ReadUShort();
            field_3_reserved4       = in1.ReadUShort();
            field_4_reserved5       = in1.ReadUShort();
            field_5_reserved6       = in1.ReadUShort();
            int field_6_textLength           = in1.ReadUShort();
            int field_7_formattingDataLength = in1.ReadUShort();

            field_8_reserved7 = in1.ReadInt();

            if (in1.Remaining > 0)
            {
                // Text Objects can have simple reference formulas
                // (This bit not mentioned in the MS document)
                if (in1.Remaining < 11)
                {
                    throw new RecordFormatException("Not enough remaining data for a link formula");
                }
                int formulaSize = in1.ReadUShort();
                _unknownPreFormulaInt = in1.ReadInt();
                Ptg[] ptgs = Ptg.ReadTokens(formulaSize, in1);
                if (ptgs.Length != 1)
                {
                    throw new RecordFormatException("Read " + ptgs.Length
                                                    + " tokens but expected exactly 1");
                }
                _linkRefPtg = (OperandPtg)ptgs[0];
                if (in1.Remaining > 0)
                {
                    _unknownPostFormulaByte = (byte)in1.ReadByte();
                }
                else
                {
                    _unknownPostFormulaByte = null;
                }
            }
            else
            {
                _linkRefPtg = null;
            }
            if (in1.Remaining > 0)
            {
                throw new RecordFormatException("Unused " + in1.Remaining + " bytes at end of record");
            }

            String text;

            if (field_6_textLength > 0)
            {
                text = ReadRawString(in1, field_6_textLength);
            }
            else
            {
                text = "";
            }
            _text = new HSSFRichTextString(text);

            if (field_7_formattingDataLength > 0)
            {
                ProcessFontRuns(in1, _text, field_7_formattingDataLength);
            }
        }
예제 #35
0
        public CFRule12Record(RecordInputStream in1)
        {
            futureHeader        = new FtrHeader(in1);
            ConditionType       = ((byte)in1.ReadByte());
            ComparisonOperation = ((byte)in1.ReadByte());
            int field_3_formula1_len = in1.ReadUShort();
            int field_4_formula2_len = in1.ReadUShort();

            ext_formatting_length = in1.ReadInt();
            ext_formatting_data   = new byte[0];
            if (ext_formatting_length == 0)
            {
                // 2 bytes reserved
                in1.ReadUShort();
            }
            else
            {
                int len = ReadFormatOptions(in1);
                if (len < ext_formatting_length)
                {
                    ext_formatting_data = new byte[ext_formatting_length - len];
                    in1.ReadFully(ext_formatting_data);
                }
            }

            Formula1 = (Formula.Read(field_3_formula1_len, in1));
            Formula2 = (Formula.Read(field_4_formula2_len, in1));

            int formula_scale_len = in1.ReadUShort();

            formula_scale = Formula.Read(formula_scale_len, in1);

            ext_opts              = (byte)in1.ReadByte();
            priority              = in1.ReadUShort();
            template_type         = in1.ReadUShort();
            template_param_length = (byte)in1.ReadByte();
            if (template_param_length == 0 || template_param_length == 16)
            {
                template_params = new byte[template_param_length];
                in1.ReadFully(template_params);
            }
            else
            {
                //logger.Log(POILogger.WARN, "CF Rule v12 template params length should be 0 or 16, found " + template_param_length);
                in1.ReadRemainder();
            }

            byte type = ConditionType;

            if (type == CONDITION_TYPE_COLOR_SCALE)
            {
                color_gradient = new ColorGradientFormatting(in1);
            }
            else if (type == CONDITION_TYPE_DATA_BAR)
            {
                data_bar = new DataBarFormatting(in1);
            }
            else if (type == CONDITION_TYPE_FILTER)
            {
                filter_data = in1.ReadRemainder();
            }
            else if (type == CONDITION_TYPE_ICON_SET)
            {
                multistate = new IconMultiStateFormatting(in1);
            }
        }
예제 #36
0
        /**
         * Read hyperlink from input stream
         *
         * @param in the stream to Read from
         */
        public HyperlinkRecord(RecordInputStream in1)
        {
            _range = new CellRangeAddress(in1);

            // 16-byte GUID
            _guid = new GUID(in1);

            /*
             * streamVersion (4 bytes): An unsigned integer that specifies the version number
             * of the serialization implementation used to save this structure. This value MUST equal 2.
             */
            int streamVersion = in1.ReadInt();

            if (streamVersion != 0x00000002)
            {
                throw new RecordFormatException("Stream Version must be 0x2 but found " + streamVersion);
            }
            _linkOpts = in1.ReadInt();

            if ((_linkOpts & HLINK_LABEL) != 0)
            {
                int label_len = in1.ReadInt();
                _label = in1.ReadUnicodeLEString(label_len);
            }
            if ((_linkOpts & HLINK_TARGET_FRAME) != 0)
            {
                int len = in1.ReadInt();
                _targetFrame = in1.ReadUnicodeLEString(len);
            }
            if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) != 0)
            {
                _moniker = null;
                int nChars = in1.ReadInt();
                _address = in1.ReadUnicodeLEString(nChars);
            }
            if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) == 0)
            {
                _moniker = new GUID(in1);

                if (URL_MONIKER.Equals(_moniker))
                {
                    int length = in1.ReadInt();

                    /*
                     * The value of <code>length<code> be either the byte size of the url field
                     * (including the terminating NULL character) or the byte size of the url field plus 24.
                     * If the value of this field is set to the byte size of the url field,
                     * then the tail bytes fields are not present.
                     */
                    int remaining = in1.Remaining;
                    if (length == remaining)
                    {
                        int nChars = length / 2;
                        _address = in1.ReadUnicodeLEString(nChars);
                    }
                    else
                    {
                        int nChars = (length - TAIL_SIZE) / 2;
                        _address = in1.ReadUnicodeLEString(nChars);

                        /*
                         * TODO: make sense of the remaining bytes
                         * According to the spec they consist of:
                         * 1. 16-byte  GUID: This field MUST equal
                         *    {0xF4815879, 0x1D3B, 0x487F, 0xAF, 0x2C, 0x82, 0x5D, 0xC4, 0x85, 0x27, 0x63}
                         * 2. Serial version, this field MUST equal 0 if present.
                         * 3. URI Flags
                         */
                        _uninterpretedTail = ReadTail(URL_uninterpretedTail, in1);
                    }
                }
                else if (FILE_MONIKER.Equals(_moniker))
                {
                    _fileOpts = in1.ReadShort();

                    int len = in1.ReadInt();
                    _shortFilename     = StringUtil.ReadCompressedUnicode(in1, len);
                    _uninterpretedTail = ReadTail(FILE_uninterpretedTail, in1);
                    int size = in1.ReadInt();
                    if (size > 0)
                    {
                        int charDataSize = in1.ReadInt();

                        //From the spec: An optional unsigned integer that MUST be 3 if present
                        // but some files has 4
                        int usKeyValue = in1.ReadUShort();
                        _address = StringUtil.ReadUnicodeLE(in1, charDataSize / 2);
                    }
                    else
                    {
                        _address = null;
                    }
                }
                else if (STD_MONIKER.Equals(_moniker))
                {
                    _fileOpts = in1.ReadShort();

                    int len = in1.ReadInt();

                    byte[] path_bytes = new byte[len];
                    in1.ReadFully(path_bytes);

                    _address = Encoding.UTF8.GetString(path_bytes);
                }
            }

            if ((_linkOpts & HLINK_PLACE) != 0)
            {
                int len = in1.ReadInt();
                _textMark = in1.ReadUnicodeLEString(len);
            }

            if (in1.Remaining > 0)
            {
                Console.WriteLine(HexDump.ToHex(in1.ReadRemainder()));
            }
        }