Ejemplo n.º 1
0
        public static string ToHexDumpString(this BiffRecord record, int maxLength = 0x10, bool showAttrInfo = false, bool includeHeader = false)
        {
            string biffString = record.ToString();

            byte[] bytes = record.GetBytes();

            //Skip the 4 byte header if we aren't including the header
            if (includeHeader == false)
            {
                bytes = bytes.Skip(4).ToArray();
            }

            string hexDumpString = HexDump(bytes);

            if (record is Formula)
            {
                Formula f = (Formula)record;
                if (f.cce == 0 && f.RawBytesValue.Length != bytes.Length + 4)
                {
                    biffString = "!Error Parsing Formula!";
                }
                else
                {
                    biffString = f.ToFormulaString(showAttrInfo);
                }
            }
            else if (record.Id == RecordType.Dimensions)
            {
                biffString = record.AsRecordType <Dimensions>().ToString();
            }
            else if (record.Id == RecordType.Lbl)
            {
                try
                {
                    biffString = record.AsRecordType <Lbl>().ToString();
                }
                catch (Exception e)
                {
                    biffString = record.ToString();
                }
            }


            if ((bytes.Length <= maxLength && bytes.Length > 0) ||
                record.Id == RecordType.Obj)
            {
                biffString += "\n" + hexDumpString;
            }

            return(biffString);
        }
        public static string ToHexDumpString(this BiffRecord record, int maxLength = 0x10, bool showAttrInfo = false)
        {
            string biffString = record.ToString();

            //Skip the 4 byte header
            byte[] bytes         = record.GetBytes().Skip(4).ToArray();
            string hexDumpString = HexDump(bytes);

            if (record is Formula)
            {
                biffString = ((Formula)record).ToFormulaString(showAttrInfo);
            }
            else if (record.Id == RecordType.Dimensions)
            {
                biffString = record.AsRecordType <Dimensions>().ToString();
            }
            else if (record.Id == RecordType.Lbl)
            {
                biffString = ((Lbl)record).ToString();
            }


            if ((bytes.Length <= maxLength && bytes.Length > 0) ||
                record.Id == RecordType.Obj)
            {
                biffString += "\n" + hexDumpString;
            }

            return(biffString);
        }
Ejemplo n.º 3
0
        public static string ToHexDumpString(this BiffRecord record, int maxLength = 0x10)
        {
            string biffString = record.ToString();

            //Skip the 4 byte header
            byte[] bytes         = record.GetBytes().Skip(4).ToArray();
            string hexDumpString = HexDump(bytes);

            if ((bytes.Length <= maxLength && bytes.Length > 0) ||
                record.Id == RecordType.Obj)
            {
                biffString += "\n" + hexDumpString;
            }

            return(biffString);
        }