Example #1
0
        public void TestToHex()
        {
            Assert.AreEqual("000A", HexDump.ToHex((short)0xA));

            Assert.AreEqual("[]", HexDump.ToHex(new short[] { }));
            Assert.AreEqual("[000A]", HexDump.ToHex(new short[] { 0xA }));
            Assert.AreEqual(HexDump.ToHex(new short[] { 0xA, 0xB }), "[000A, 000B]");

            Assert.AreEqual("0A", HexDump.ToHex((byte)0xA));
            Assert.AreEqual("0000000A", HexDump.ToHex(0xA));

            Assert.AreEqual("[]", HexDump.ToHex(new byte[] { }));
            Assert.AreEqual("[0A]", HexDump.ToHex(new byte[] { 0xA }));
            Assert.AreEqual(HexDump.ToHex(new byte[] { 0xA, 0xB }), "[0A, 0B]");

            Assert.AreEqual(HexDump.ToHex(new byte[] { }, 10), ": 0");
            Assert.AreEqual(HexDump.ToHex(new byte[] { 0xA }, 10), "0: 0A");
            Assert.AreEqual(HexDump.ToHex(new byte[] { 0xA, 0xB }, 10), "0: 0A, 0B");
            Assert.AreEqual(HexDump.ToHex(new byte[] { 0xA, 0xB, 0xC, 0xD }, 2), "0: 0A, 0B\n2: 0C, 0D");
            Assert.AreEqual(HexDump.ToHex(new byte[] { 0xA, 0xB, 0xC, 0xD, 0xE, 0xF }, 2), "0: 0A, 0B\n2: 0C, 0D\n4: 0E, 0F");

            Assert.AreEqual("FFFF", HexDump.ToHex(unchecked ((short)0xFFFF)));

            Assert.AreEqual("00000000000004D2", HexDump.ToHex(1234L));

            ConfirmStr("0xFE", HexDump.ByteToHex(-2));
            ConfirmStr("0x25", HexDump.ByteToHex(37));
            ConfirmStr("0xFFFE", HexDump.ShortToHex(-2));
            ConfirmStr("0x0005", HexDump.ShortToHex(5));
            ConfirmStr("0xFFFFFF9C", HexDump.IntToHex(-100));
            ConfirmStr("0x00001001", HexDump.IntToHex(4097));
            ConfirmStr("0xFFFFFFFFFFFF0006", HexDump.LongToHex(-65530));
            ConfirmStr("0x0000000000003FCD", HexDump.LongToHex(16333));
        }
Example #2
0
        public override String ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("[ftPictFmla]\n");
            sb.Append("    .f2unknown     = ").Append(HexDump.IntToHex(field_1_unknown_int)).Append("\n");
            if (field_2_refPtg == null)
            {
                sb.Append("    .f3unknown     = ").Append(HexDump.ToHex(field_2_unknownFormulaData)).Append("\n");
            }
            else
            {
                sb.Append("    .formula       = ").Append(field_2_refPtg.ToString()).Append("\n");
            }
            if (field_4_ole_classname != null)
            {
                sb.Append("    .unicodeFlag   = ").Append(field_3_unicode_flag).Append("\n");
                sb.Append("    .oleClassname  = ").Append(field_4_ole_classname).Append("\n");
            }
            if (field_4_unknownByte != null)
            {
                sb.Append("    .f4unknown   = ").Append(HexDump.ByteToHex(Convert.ToByte(field_4_unknownByte))).Append("\n");
            }
            if (field_5_stream_id != null)
            {
                sb.Append("    .streamId      = ").Append(HexDump.IntToHex(Convert.ToInt32(field_5_stream_id))).Append("\n");
            }
            if (field_6_unknown.Length > 0)
            {
                sb.Append("    .f7unknown     = ").Append(HexDump.ToHex(field_6_unknown)).Append("\n");
            }
            sb.Append("[/ftPictFmla]");
            return(sb.ToString());
        }
Example #3
0
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[HYPERLINK RECORD]\n");
            buffer.Append("    .range            = ").Append(_range.FormatAsString()).Append("\n");
            buffer.Append("    .guid        = ").Append(_guid.FormatAsString()).Append("\n");
            buffer.Append("    .linkOpts          = ").Append(HexDump.IntToHex(this._linkOpts)).Append("\n");
            buffer.Append("    .label          = ").Append(Label).Append("\n");
            if ((_linkOpts & HLINK_TARGET_FRAME) != 0)
            {
                buffer.Append("    .targetFrame= ").Append(TargetFrame).Append("\n");
            }
            if ((_linkOpts & HLINK_URL) != 0 && _moniker != null)
            {
                buffer.Append("    .moniker          = ").Append(_moniker.FormatAsString()).Append("\n");
            }
            if ((_linkOpts & HLINK_PLACE) != 0)
            {
                buffer.Append("    .targetFrame= ").Append(TextMark).Append("\n");
            }
            buffer.Append("    .address            = ").Append(Address).Append("\n");
            buffer.Append("[/HYPERLINK RECORD]\n");
            return(buffer.ToString());
        }
Example #4
0
 private void ConfirmGUID(GUID g, int d1, int d2, int d3, long d4)
 {
     Assert.AreEqual(new String(HexDump.IntToHex(d1)), new String(HexDump.IntToHex(g.D1)));
     Assert.AreEqual(new String(HexDump.ShortToHex(d2)), new String(HexDump.ShortToHex(g.D2)));
     Assert.AreEqual(new String(HexDump.ShortToHex(d3)), new String(HexDump.ShortToHex(g.D3)));
     Assert.AreEqual(new String(HexDump.LongToHex(d4)), new String(HexDump.LongToHex(g.D4)));
 }
Example #5
0
        public override String ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("[TXO]\n");
            sb.Append("    .options        = ").Append(HexDump.ShortToHex(field_1_options)).Append("\n");
            sb.Append("         .IsHorizontal = ").Append(HorizontalTextAlignment).Append('\n');
            sb.Append("         .IsVertical   = ").Append(VerticalTextAlignment).Append('\n');
            sb.Append("         .textLocked   = ").Append(IsTextLocked).Append('\n');
            sb.Append("    .textOrientation= ").Append(HexDump.ShortToHex(TextOrientation)).Append("\n");
            sb.Append("    .reserved4      = ").Append(HexDump.ShortToHex(field_3_reserved4)).Append("\n");
            sb.Append("    .reserved5      = ").Append(HexDump.ShortToHex(field_4_reserved5)).Append("\n");
            sb.Append("    .reserved6      = ").Append(HexDump.ShortToHex(field_5_reserved6)).Append("\n");
            sb.Append("    .textLength     = ").Append(HexDump.ShortToHex(_text.Length)).Append("\n");
            sb.Append("    .reserved7      = ").Append(HexDump.IntToHex(field_8_reserved7)).Append("\n");

            sb.Append("    .string = ").Append(_text).Append('\n');

            for (int i = 0; i < _text.NumFormattingRuns; i++)
            {
                sb.Append("    .textrun = ").Append(((HSSFRichTextString)_text).GetFontOfFormattingRun(i)).Append('\n');
            }
            sb.Append("[/TXO]\n");
            return(sb.ToString());
        }
Example #6
0
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[RECALCID]\n");
            buffer.Append("    .reserved = ").Append(HexDump.ShortToHex(_reserved0)).Append("\n");
            buffer.Append("    .engineId = ").Append(HexDump.IntToHex(_engineId)).Append("\n");
            buffer.Append("[/RECALCID]\n");
            return(buffer.ToString());
        }
Example #7
0
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[BOUNDSHEET]\n");
            buffer.Append("    .bof        = ").Append(HexDump.IntToHex(PositionOfBof)).Append("\n");
            buffer.Append("    .visibility = ").Append(HexDump.ShortToHex(field_2_visibility)).Append("\n");
            buffer.Append("    .type       = ").Append(HexDump.ByteToHex(field_3_type)).Append("\n");
            buffer.Append("    .sheetname  = ").Append(Sheetname).Append("\n");
            buffer.Append("[/BOUNDSHEET]\n");
            return(buffer.ToString());
        }
Example #8
0
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[BOUNDSHEET]\n");
            buffer.Append("    .bof        = ").Append(HexDump.IntToHex(PositionOfBof)).Append("\n");
            buffer.Append("    .options    = ").Append(HexDump.ShortToHex(field_2_option_flags)).Append("\n");
            buffer.Append("    .unicodeflag= ").Append(HexDump.ByteToHex(field_4_isMultibyteUnicode)).Append("\n");
            buffer.Append("    .sheetname  = ").Append(field_5_sheetname).Append("\n");
            buffer.Append("[/BOUNDSHEET]\n");
            return(buffer.ToString());
        }
Example #9
0
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[TABLESTYLES]\n");
            buffer.Append("    .rt      =").Append(HexDump.ShortToHex(rt)).Append('\n');
            buffer.Append("    .grbitFrt=").Append(HexDump.ShortToHex(grbitFrt)).Append('\n');
            buffer.Append("    .unused  =").Append(HexDump.ToHex(unused)).Append('\n');
            buffer.Append("    .cts=").Append(HexDump.IntToHex(cts)).Append('\n');
            buffer.Append("    .rgchDefListStyle=").Append(rgchDefListStyle).Append('\n');
            buffer.Append("    .rgchDefPivotStyle=").Append(rgchDefPivotStyle).Append('\n');

            buffer.Append("[/TABLESTYLES]\n");
            return(buffer.ToString());
        }
Example #10
0
        public override string ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[SXVDEX]\n");

            buffer.Append("    .grbit1 =").Append(HexDump.IntToHex(grbit1)).Append("\n");
            buffer.Append("    .grbit2 =").Append(HexDump.ByteToHex(grbit2)).Append("\n");
            buffer.Append("    .citmShow =").Append(HexDump.ByteToHex(citmShow)).Append("\n");
            buffer.Append("    .isxdiSort =").Append(HexDump.ShortToHex(isxdiSort)).Append("\n");
            buffer.Append("    .isxdiShow =").Append(HexDump.ShortToHex(isxdiShow)).Append("\n");
            buffer.Append("    .subName =").Append(subName).Append("\n");
            buffer.Append("[/SXVDEX]\n");
            return(buffer.ToString());
        }
Example #11
0
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[TABLE]\n");
            buffer.Append("    .range    = ").Append(Range.ToString()).Append("\n");
            buffer.Append("    .flags    = ").Append(HexDump.ByteToHex(field_5_flags)).Append("\n");
            buffer.Append("    .alwaysClc= ").Append(IsAlwaysCalc).Append("\n");
            buffer.Append("    .reserved = ").Append(HexDump.IntToHex(field_6_res)).Append("\n");
            CellReference crRowInput = cr(field_7_rowInputRow, field_8_colInputRow);
            CellReference crColInput = cr(field_9_rowInputCol, field_10_colInputCol);

            buffer.Append("    .rowInput = ").Append(crRowInput.FormatAsString()).Append("\n");
            buffer.Append("    .colInput = ").Append(crColInput.FormatAsString()).Append("\n");
            buffer.Append("[/TABLE]\n");
            return(buffer.ToString());
        }
Example #12
0
        public override String ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(GetType().Name).Append(" [ARRAY]\n");
            sb.Append(" range=").Append(Range.ToString()).Append("\n");
            sb.Append(" options=").Append(HexDump.ShortToHex(_options)).Append("\n");
            sb.Append(" notUsed=").Append(HexDump.IntToHex(_field3notUsed)).Append("\n");
            sb.Append(" formula:").Append("\n");
            Ptg[] ptgs = _formula.Tokens;
            for (int i = 0; i < ptgs.Length; i++)
            {
                Ptg ptg = ptgs[i];
                sb.Append(ptg.ToString()).Append(ptg.RVAType).Append("\n");
            }
            sb.Append("]");
            return(sb.ToString());
        }
Example #13
0
        public string FormatAsString()
        {
            StringBuilder sb = new StringBuilder(36);

            int PREFIX_LEN = "0x".Length;

            sb.Append(HexDump.IntToHex(_d1), PREFIX_LEN, 8);
            sb.Append("-");
            sb.Append(HexDump.ShortToHex(_d2), PREFIX_LEN, 4);
            sb.Append("-");
            sb.Append(HexDump.ShortToHex(_d3), PREFIX_LEN, 4);
            sb.Append("-");
            char[] d4Chars = HexDump.LongToHex(D4);
            sb.Append(d4Chars, PREFIX_LEN, 4);
            sb.Append("-");
            sb.Append(d4Chars, PREFIX_LEN + 4, 12);
            return(sb.ToString());
        }
Example #14
0
        /**
         * print a sort of string representation ([SHARED FORMULA RECORD] id = x [/SHARED FORMULA RECORD])
         */

        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[SHARED FORMULA (").Append(HexDump.IntToHex(sid)).Append("]\n");
            buffer.Append("    .range      = ").Append(Range.ToString()).Append("\n");
            buffer.Append("    .reserved    = ").Append(HexDump.ShortToHex(field_5_reserved)).Append("\n");

            Ptg[] ptgs = field_7_parsed_expr.Tokens;
            for (int k = 0; k < ptgs.Length; k++)
            {
                buffer.Append("Formula[").Append(k).Append("]");
                Ptg ptg = ptgs[k];
                buffer.Append(ptg.ToString()).Append(ptg.RVAType).Append("\n");
            }

            buffer.Append("[/SHARED FORMULA]\n");
            return(buffer.ToString());
        }
Example #15
0
 public void AppendToString(StringBuilder buffer)
 {
     buffer.Append("    .xor.key = ").Append(HexDump.IntToHex(_key)).Append("\n");
     buffer.Append("    .xor.verifier  = ").Append(HexDump.IntToHex(_verifier)).Append("\n");
 }
 public void ConfirmInt(int expVal)
 {
     cmp(HexDump.IntToHex(expVal), HexDump.IntToHex(_bds.ReadInt()));
 }
Example #17
0
 public override string ToString()
 {
     return(string.Format("    " + OfficeArtProperties.GetFillStyleName(Opid.OpId) + "opid=" + HexDump.ShortToHex(Opid.OpId)
                          + "; op=" + HexDump.IntToHex(Op)));
 }