Example #1
0
        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        public override String ToString()
        {
            String nl        = Environment.NewLine;
            String extraData = HexDump.Dump(this.remainingData, 0, 0);

            return(GetType().Name + ":" + nl +
                   "  RecordId: 0x" + HexDump.ToHex(RECORD_ID) + nl +
                   "  Version: 0x" + HexDump.ToHex(Version) + nl +
                   "  Instance: 0x" + HexDump.ToHex(Instance) + nl +
                   "  Flag: " + field_1_flag + nl +
                   "  Col1: " + field_2_col1 + nl +
                   "  DX1: " + field_3_dx1 + nl +
                   "  Row1: " + field_4_row1 + nl +
                   "  DY1: " + field_5_dy1 + nl +
                   "  Col2: " + field_6_col2 + nl +
                   "  DX2: " + field_7_dx2 + nl +
                   "  Row2: " + field_8_row2 + nl +
                   "  DY2: " + field_9_dy2 + nl +
                   "  Extra Data:" + nl + extraData);
        }
Example #2
0
        /// <summary>
        /// Dumps out a hex value by Reading from a input stream.
        /// </summary>
        /// <param name="bytes">How many bytes this hex value consists of.</param>
        /// <param name="in1">The stream to Read the hex value from.</param>
        private void OutHex(int bytes, Stream in1)
        {
            switch (bytes)
            {
            case 1:
                Console.Write(HexDump.ToHex((byte)in1.ReadByte()));
                break;

            case 2:
                Console.Write(HexDump.ToHex(LittleEndian.ReadShort(in1)));
                break;

            case 4:
                Console.Write(HexDump.ToHex(LittleEndian.ReadInt(in1)));
                break;

            default:
                throw new IOException("Unable to output variable of that width");
            }
        }
Example #3
0
        public void TestToString()
        {
            String          nl = Environment.NewLine;
            EscherOptRecord r  = new EscherOptRecord();

            r.Options  = (short)0x000F;
            r.RecordId = EscherOptRecord.RECORD_ID;
            EscherProperty prop1 = new EscherBoolProperty((short)1, 1);

            r.AddEscherProperty(prop1);
            String expected = "EscherOptRecord:" + nl +
                              "  isContainer: True" + nl +
                              "  options: 0x0013" + nl +
                              "  recordId: 0x" + HexDump.ToHex(EscherOptRecord.RECORD_ID) + nl +
                              "  numchildren: 0" + nl +
                              "  properties:" + nl +
                              "    propNum: 1, RAW: 0x0001, propName: unknown, complex: False, blipId: False, value: 1 (0x00000001)" + nl;

            Assert.AreEqual(expected, r.ToString());
        }
Example #4
0
        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        public override String ToString()
        {
            String        nl            = Environment.NewLine;
            StringBuilder propertiesBuf = new StringBuilder();

            for (IEnumerator iterator = properties.GetEnumerator(); iterator.MoveNext();)
            {
                propertiesBuf.Append("    "
                                     + iterator.Current.ToString()
                                     + nl);
            }

            return("EscherOptRecord:" + nl +
                   "  isContainer: " + IsContainerRecord + nl +
                   "  options: 0x" + HexDump.ToHex(Options) + nl +
                   "  recordId: 0x" + HexDump.ToHex(RecordId) + nl +
                   "  numchildren: " + ChildRecords.Count + nl +
                   "  properties:" + nl +
                   propertiesBuf.ToString());
        }
Example #5
0
        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        public override String ToString()
        {
            String nl = Environment.NewLine;

            StringBuilder children = new StringBuilder();

            if (ChildRecords.Count > 0)
            {
                children.Append("  children: " + nl);
                for (IEnumerator iterator = ChildRecords.GetEnumerator(); iterator.MoveNext();)
                {
                    EscherRecord record = (EscherRecord)iterator.Current;
                    children.Append(record.ToString());
                    children.Append(nl);
                }
            }

            String theDumpHex = "";

            try
            {
                if (_thedata.Length != 0)
                {
                    theDumpHex  = "  Extra Data(" + _thedata.Length + "):" + nl;
                    theDumpHex += HexDump.Dump(_thedata, 0, 0);
                }
            }
            catch (Exception)
            {
                theDumpHex = "Error!!";
            }

            return(this.GetType().Name + ":" + nl +
                   "  isContainer: " + IsContainerRecord + nl +
                   "  version: 0x" + HexDump.ToHex(Version) + nl +
                   "  instance: 0x" + HexDump.ToHex(Instance) + nl +
                   "  recordId: 0x" + HexDump.ToHex(RecordId) + nl +
                   "  numchildren: " + ChildRecords.Count + nl +
                   theDumpHex +
                   children.ToString());
        }
Example #6
0
        public void TestSerialize()
        {
            EscherBlipWMFRecord r = new EscherBlipWMFRecord();

            r.BoundaryLeft     = 1;
            r.BoundaryHeight   = 2;
            r.BoundaryTop      = 3;
            r.BoundaryWidth    = 4;
            r.CacheOfSavedSize = 5;
            r.CacheOfSize      = 6;
            r.Filter           = (byte)7;
            r.CompressionFlag  = (byte)8;
            r.SecondaryUID     = new byte[] { (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01,
                                              (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01,
                                              (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01,
                                              (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, };
            r.Width    = 10;
            r.Height   = 11;
            r.RecordId = EscherBlipWMFRecord.RECORD_ID_START;
            r.Options  = (short)5420;
            r.Data     = new byte[] { (byte)0x01, (byte)0x02 };

            byte[] buf = new byte[r.RecordSize];
            r.Serialize(0, buf);

            Assert.AreEqual("[2C, 15, 18, F0, 26, 00, 00, 00, " +
                            "01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, " +
                            "06, 00, 00, 00, " + // field_2_cacheOfSize
                            "03, 00, 00, 00, " + // field_3_boundaryTop
                            "01, 00, 00, 00, " + // field_4_boundaryLeft
                            "04, 00, 00, 00, " + // field_5_boundaryWidth
                            "02, 00, 00, 00, " + // field_6_boundaryHeight
                            "0A, 00, 00, 00, " + // field_7_x
                            "0B, 00, 00, 00, " + // field_8_y
                            "05, 00, 00, 00, " + // field_9_cacheOfSavedSize
                            "08, " +             // field_10_compressionFlag
                            "07, " +             // field_11_filter
                            "01, 02, ]",         // field_12_data
                            HexDump.ToHex(buf));
            Assert.AreEqual(60, r.RecordSize);
        }
Example #7
0
        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        public override String ToString()
        {
            String nl = Environment.NewLine;

            String       extraData;
            MemoryStream b = new MemoryStream();

            try
            {
                HexDump.Dump(this.field_pictureData, 0, b, 0);
                extraData = b.ToString();
            }
            catch (Exception e)
            {
                extraData = e.ToString();
            }
            return(this.GetType().Name + ":" + nl +
                   "  RecordId: 0x" + HexDump.ToHex(RecordId) + nl +
                   "  Options: 0x" + HexDump.ToHex(Options) + nl);
            //"  Extra Data:" + nl + extraData;
        }
Example #8
0
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[OBJECTLINK]\n");
            buffer.Append("    .AnchorId             = ")
            .Append("0x").Append(HexDump.ToHex(AnchorId))
            .Append(" (").Append(AnchorId).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("    .link1                = ")
            .Append("0x").Append(HexDump.ToHex(Link1))
            .Append(" (").Append(Link1).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("    .link2                = ")
            .Append("0x").Append(HexDump.ToHex(Link2))
            .Append(" (").Append(Link2).Append(" )");
            buffer.Append(Environment.NewLine);

            buffer.Append("[/OBJECTLINK]\n");
            return(buffer.ToString());
        }
Example #9
0
        public override String ToXml(String tab)
        {
            String        extraData = HexDump.Dump(this.remainingData, 0, 0).Trim();
            StringBuilder builder   = new StringBuilder();

            builder.Append(tab)
            .Append(FormatXmlRecordHeader(GetType().Name, HexDump.ToHex(RecordId),
                                          HexDump.ToHex(Version), HexDump.ToHex(Instance)))
            .Append(tab).Append("\t").Append("<Flag>").Append(field_1_flag).Append("</Flag>\n")
            .Append(tab).Append("\t").Append("<Col1>").Append(field_2_col1).Append("</Col1>\n")
            .Append(tab).Append("\t").Append("<DX1>").Append(field_3_dx1).Append("</DX1>\n")
            .Append(tab).Append("\t").Append("<Row1>").Append(field_4_row1).Append("</Row1>\n")
            .Append(tab).Append("\t").Append("<DY1>").Append(field_5_dy1).Append("</DY1>\n")
            .Append(tab).Append("\t").Append("<Col2>").Append(field_6_col2).Append("</Col2>\n")
            .Append(tab).Append("\t").Append("<DX2>").Append(field_7_dx2).Append("</DX2>\n")
            .Append(tab).Append("\t").Append("<Row2>").Append(field_8_row2).Append("</Row2>\n")
            .Append(tab).Append("\t").Append("<DY2>").Append(field_9_dy2).Append("</DY2>\n")
            .Append(tab).Append("\t").Append("<ExtraData>").Append(extraData).Append("</ExtraData>\n");
            builder.Append(tab).Append("</").Append(GetType().Name).Append(">\n");
            return(builder.ToString());
        }
Example #10
0
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[SERIESTEXT]\n");
            buffer.Append("    .id                   = ")
            .Append("0x").Append(HexDump.ToHex(Id))
            .Append(" (").Append(Id).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("    .textLength           = ")
            .Append(field_4_text.Length);
            buffer.Append(Environment.NewLine);
            buffer.Append("    .is16bit         = ").Append(is16bit);
            buffer.Append(Environment.NewLine);
            buffer.Append("    .text                 = ")
            .Append(" (").Append(Text).Append(" )");
            buffer.Append(Environment.NewLine);

            buffer.Append("[/SERIESTEXT]\n");
            return(buffer.ToString());
        }
Example #11
0
        public override string ToXml(string tab)
        {
            string extraData;

            //MemoryStream b = new MemoryStream();
            try {
                //HexDump.Dump(this.field_pictureData, 0, b, 0);
                extraData = HexDump.ToHex(field_pictureData);
            }
            catch (Exception e) {
                extraData = e.ToString();
            }
            StringBuilder builder = new StringBuilder();

            builder.Append(tab).Append(FormatXmlRecordHeader(GetType().Name, HexDump.ToHex(RecordId), HexDump.ToHex(Version), HexDump.ToHex(Instance)))
            .Append(tab).Append("\t").Append("<UID>0x").Append(HexDump.ToHex(field_1_UID)).Append("</UID>\n")
            .Append(tab).Append("\t").Append("<Marker>0x").Append(HexDump.ToHex(field_2_marker)).Append("</Marker>\n")
            .Append(tab).Append("\t").Append("<ExtraData>").Append(extraData).Append("</ExtraData>\n");
            builder.Append(tab).Append("</").Append(GetType().Name).Append(">\n");
            return(builder.ToString());
        }
Example #12
0
        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        public override String ToString()
        {
            String nl = Environment.NewLine;

            //        String extraData;
            //        MemoryStream b = new MemoryStream();
            //        try
            //        {
            //            HexDump.dump(this.remainingData, 0, b, 0);
            //            extraData = b.ToString();
            //        }
            //        catch ( Exception e )
            //        {
            //            extraData = "error";
            //        }
            return(GetType().Name + ":" + nl +
                   "  RecordId: 0x" + HexDump.ToHex(RECORD_ID) + nl +
                   "  Options: 0x" + HexDump.ToHex(Options) + nl +
                   "  NumShapes: " + field_1_numShapes + nl +
                   "  LastMSOSPID: " + field_2_lastMSOSPID + nl);
        }
Example #13
0
        public void TestFillFields()
        {
            EscherBlipWMFRecord r = new EscherBlipWMFRecord();

            r.FillFields(data, 0, new DefaultEscherRecordFactory());

            Assert.AreEqual(EscherBlipWMFRecord.RECORD_ID_START, r.RecordId);
            Assert.AreEqual(1, r.BoundaryLeft);
            Assert.AreEqual(2, r.BoundaryHeight);
            Assert.AreEqual(3, r.BoundaryTop);
            Assert.AreEqual(4, r.BoundaryWidth);
            Assert.AreEqual(5, r.CacheOfSavedSize);
            Assert.AreEqual(6, r.CacheOfSize);
            Assert.AreEqual(7, r.Filter);
            Assert.AreEqual(8, r.CompressionFlag);
            Assert.AreEqual("[01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, ]", HexDump.ToHex(r.SecondaryUID));
            Assert.AreEqual(10, r.Width);
            Assert.AreEqual(11, r.Height);
            Assert.AreEqual((short)5420, r.Options);
            Assert.AreEqual("[01, 02, ]", HexDump.ToHex(r.Data));
        }
        public void TestSerialize()
        {
            UnknownEscherRecord r = new UnknownEscherRecord();

            r.Options  = (short)0x123F;
            r.RecordId = unchecked ((short)0xF112);
            byte[] data = new byte[8];
            r.Serialize(0, data);

            Assert.AreEqual("[3F, 12, 12, F1, 00, 00, 00, 00]", HexDump.ToHex(data));

            EscherRecord childRecord = new UnknownEscherRecord();

            childRecord.Options  = unchecked ((short)0x9999);
            childRecord.RecordId = unchecked ((short)0xFF01);
            r.AddChildRecord(childRecord);
            data = new byte[16];
            r.Serialize(0, data);

            Assert.AreEqual("[3F, 12, 12, F1, 08, 00, 00, 00, 99, 99, 01, FF, 00, 00, 00, 00]", HexDump.ToHex(data));
        }
Example #15
0
        public override string ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[CHART3D]").AppendLine()
            .Append("   .anRot              =").Append(HexDump.ToHex(field_1_anRot)).Append("(").Append(field_1_anRot).AppendLine(")")
            .Append("   .anElev             =").Append(HexDump.ToHex(field_2_anElev)).Append("(").Append(field_2_anElev).AppendLine(")")
            .Append("   .pcDist             =").Append(HexDump.ToHex(field_3_pcDist)).Append("(").Append(field_3_pcDist).AppendLine(")")
            .Append("   .pcHeight           =").Append(HexDump.ToHex(field_4_pcHeight)).Append("(").Append(field_4_pcHeight).AppendLine(")")
            .Append("   .pcDepth            =").Append(HexDump.ToHex(field_5_pcDepth)).Append("(").Append(field_5_pcDepth).AppendLine(")")
            .Append("   .pcGap              =").Append(HexDump.ToHex(field_6_pcGap)).Append("(").Append(field_6_pcGap).AppendLine(")")
            .Append("   .option             =").Append(HexDump.ToHex(field_7_option)).Append("(").Append(field_7_option).AppendLine(")")
            .Append("       .fPerspective       =").Append(IsPerspective).AppendLine()
            .Append("       .fCluster           =").Append(IsCluster).AppendLine()
            .Append("       .f3DScaling         =").Append(Is3DScaling).AppendLine()
            .Append("       .fNotPieChart       =").Append(IsNotPieChart).AppendLine()
            .Append("       .fWalls2D           =").Append(IsWalls2D).AppendLine()
            .AppendLine("[/CHART3D]");

            return(buffer.ToString());
        }
Example #16
0
        private static void ConfirmRC4(String k, String origText, String expEncrHex)
        {
            byte[] actEncr = Encoding.GetEncoding("GB2312").GetBytes(origText);
            new RC4(Encoding.GetEncoding("GB2312").GetBytes(k)).Encrypt(actEncr);
            byte[] expEncr = HexRead.ReadFromString(expEncrHex);

            if (!Arrays.Equals(expEncr, actEncr))
            {
                throw new ComparisonFailure("Data mismatch", HexDump.ToHex(expEncr), HexDump.ToHex(actEncr));
            }


            //Cipher cipher;
            //try
            //{
            //    cipher = Cipher.GetInstance("RC4");
            //}
            //catch (GeneralSecurityException e)
            //{
            //    throw new Exception(e);
            //}
            //String k2 = k + k; // Sun has minimum of 5 bytes for key
            //SecretKeySpec skeySpec = new SecretKeySpec(k2.Bytes, "RC4");

            //try
            //{
            //    cipher.Init(Cipher.DECRYPT_MODE, skeySpec);
            //}
            //catch (InvalidKeyException e)
            //{
            //    throw new Exception(e);
            //}
            //byte[] origData = origText.getBytes();
            //byte[] altEncr = cipher.update(origData);
            //if (!Arrays.Equals(expEncr, altEncr))
            //{
            //    throw new Exception("Mismatch from jdk provider");
            //}
        }
Example #17
0
        public override String ToXml(String tab)
        {
            String theDumpHex = "";

            try
            {
                if (_thedata.Length != 0)
                {
                    theDumpHex += HexDump.Dump(_thedata, 0, 0);
                }
            }
            catch (Exception)
            {
                theDumpHex = "Error!!";
            }
            StringBuilder builder = new StringBuilder();

            builder.Append(tab).Append(FormatXmlRecordHeader(GetType().Name, HexDump.ToHex(RecordId), HexDump.ToHex(Version), HexDump.ToHex(Instance)))
            .Append(tab).Append("\t").Append("<ExtraData>").Append(theDumpHex).Append("</ExtraData>\n");
            builder.Append(tab).Append("</").Append(GetType().Name).Append(">\n");
            return(builder.ToString());
        }
Example #18
0
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[SHTPROPS]\n");
            buffer.Append("    .flags                = ")
            .Append("0x").Append(HexDump.ToHex(Flags))
            .Append(" (").Append(Flags).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("         .chartTypeManuallyFormatted     = ").Append(IsManSerAlloc).Append('\n');
            buffer.Append("         .plotVisibleOnly          = ").Append(IsPlotVisibleOnly).Append('\n');
            buffer.Append("         .doNotSizeWithWindow      = ").Append(IsNotSizeWithWindow).Append('\n');
            buffer.Append("         .defaultPlotDimensions     = ").Append(IsManPlotArea).Append('\n');
            buffer.Append("         .autoPlotArea             = ").Append(IsAlwaysAutoPlotArea).Append('\n');
            buffer.Append("    .empty                = ")
            .Append("0x").Append(HexDump.ToHex(Blank))
            .Append(" (").Append(Blank).Append(" )");
            buffer.Append(Environment.NewLine);

            buffer.Append("[/SHTPROPS]\n");
            return(buffer.ToString());
        }
Example #19
0
        /// <summary>
        /// Retrieves the string representation for this property.
        /// </summary>
        /// <returns></returns>
        public override String ToString()
        {
            String nl = Environment.NewLine;

            StringBuilder results = new StringBuilder();

            results.Append("    {EscherArrayProperty:" + nl);
            results.Append("     Num Elements: " + NumberOfElementsInArray + nl);
            results.Append("     Num Elements In Memory: " + NumberOfElementsInMemory + nl);
            results.Append("     Size of elements: " + SizeOfElements + nl);
            for (int i = 0; i < NumberOfElementsInArray; i++)
            {
                results.Append("     Element " + i + ": " + HexDump.ToHex(GetElement(i)) + nl);
            }
            results.Append("}" + nl);

            return("propNum: " + PropertyNumber
                   + ", propName: " + EscherProperties.GetPropertyName(PropertyNumber)
                   + ", complex: " + IsComplex
                   + ", blipId: " + IsBlipId
                   + ", data: " + nl + results.ToString());
        }
        /**
         * Returns the string representation of this record.
         */

        public override string ToString()
        {
            string nl = Environment.NewLine;

            string extraData;

            using (MemoryStream b = new MemoryStream()) {
                try {
                    HexDump.Dump(remainingData, 0, b, 0);
                    //extraData = b.ToString();
                    extraData = Encoding.UTF8.GetString(b.ToArray());
                }
                catch (Exception) {
                    extraData = "error\n";
                }
                return(GetType().Name + ":" + nl +
                       "  RecordId: 0x" + HexDump.ToHex(RECORD_ID) + nl +
                       "  Version: 0x" + HexDump.ToHex(Version) + nl +
                       "  Instance: 0x" + HexDump.ToHex(Instance) + nl +
                       "  Extra Data:" + nl + extraData);
            }
        }
Example #21
0
        /// <summary>
        /// Toes the string.
        /// </summary>
        /// <param name="indent">The indent.</param>
        /// <returns></returns>
        public String ToString(String indent)
        {
            String nl = Environment.NewLine;

            StringBuilder children = new StringBuilder();

            if (ChildRecords.Count > 0)
            {
                children.Append("  children: " + nl);

                int count = 0;
                for (IEnumerator iterator = ChildRecords.GetEnumerator(); iterator.MoveNext();)
                {
                    String newIndent = indent + "   ";

                    EscherRecord record = (EscherRecord)iterator.Current;
                    children.Append(newIndent + "Child " + count + ":" + nl);

                    if (record is EscherContainerRecord)
                    {
                        EscherContainerRecord ecr = (EscherContainerRecord)record;
                        children.Append(ecr.ToString(newIndent));
                    }
                    else
                    {
                        children.Append(record.ToString());
                    }
                    count++;
                }
            }

            return
                (indent + this.GetType().Name + " (" + RecordName + "):" + nl +
                 indent + "  isContainer: " + IsContainerRecord + nl +
                 indent + "  options: 0x" + HexDump.ToHex(Options) + nl +
                 indent + "  recordId: 0x" + HexDump.ToHex(RecordId) + nl +
                 indent + "  numchildren: " + ChildRecords.Count + nl +
                 indent + children.ToString());
        }
Example #22
0
        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.object"/>.
        /// </returns>
        public override string ToString()
        {
            string nl = Environment.NewLine;

            string extraData = string.Empty;

            using (MemoryStream b = new MemoryStream()) {
                try {
                    HexDump.Dump(field_pictureData, 0, b, 0);
                    extraData = HexDump.ToHex(b.ToArray());
                }
                catch (Exception e) {
                    extraData = e.ToString();
                }
                return(GetType().Name + ":" + nl +
                       "  RecordId: 0x" + HexDump.ToHex(RecordId) + nl +
                       "  Options: 0x" + HexDump.ToHex(Options) + nl +
                       "  Version: 0x" + HexDump.ToHex(Version) + nl +
                       "  Instance: 0x" + HexDump.ToHex(Instance) + nl +
                       "  Extra Data:" + nl + extraData);
            }
        }
        /**
         * Returns the string representation of this record.
         */
        public override String ToString()
        {
            String nl = Environment.NewLine;

            String       extraData;
            MemoryStream b = new MemoryStream();

            try
            {
                HexDump.Dump(this.remainingData, 0, b, 0);
                extraData = b.ToString();
            }
            catch (Exception)
            {
                extraData = "error\n";
            }
            return(GetType().Name + ":" + nl +
                   "  RecordId: 0x" + HexDump.ToHex(RECORD_ID) + nl +
                   "  Options: 0x" + HexDump.ToHex(Options) + nl);
            //"  Extra Data:" + nl +
            //extraData;
        }
Example #24
0
        public void TestToString()
        {
            string          nl = Environment.NewLine;
            EscherOptRecord r  = new EscherOptRecord();

            // don't try to shoot in foot, please -- vlsergey
            // r.setOptions((short)0x000F);
            r.RecordId = EscherOptRecord.RECORD_ID;
            EscherProperty prop1 = new EscherBoolProperty((short)1, 1);

            r.AddEscherProperty(prop1);
            string expected = "EscherOptRecord:" + nl +
                              "  isContainer: False" + nl +
                              "  version: 0x0003" + nl +
                              "  instance: 0x0001" + nl +
                              "  recordId: 0x" + HexDump.ToHex(EscherOptRecord.RECORD_ID) + nl +
                              "  numchildren: 0" + nl +
                              "  properties:" + nl +
                              "    propNum: 1, RAW: 0x0001, propName: unknown, complex: False, blipId: False, value: 1 (0x00000001)" + nl;

            Assert.AreEqual(expected, r.ToString());
        }
Example #25
0
        public override string ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[CRTLAYOUT12]").AppendLine()
            .Append("   .rt               =").Append(HexDump.ToHex(field_1_frtHeader_rt)).Append("(").Append(field_1_frtHeader_rt).AppendLine(")")
            .Append("   .grbit            =").Append(HexDump.ToHex(field_2_frtHeader_grbitFrt)).Append("(").Append(field_2_frtHeader_grbitFrt).AppendLine(")")
            .Append("   .reserved         =").Append(HexDump.ToHex(0)).Append("(").Append(0).AppendLine(")")
            .Append("   .dwCheckSum       =").Append(HexDump.ToHex(field_5_dwCheckSum)).Append("(").Append(field_5_dwCheckSum).AppendLine(")")
            .Append("   .option           =").Append(HexDump.ToHex(field_6_option)).Append("(").Append(field_6_option).AppendLine(")")
            .Append("       .autolayouttype =").Append(autolayouttype.GetValue(field_6_option)).AppendLine()
            .Append("   .wXMode           =").Append(HexDump.ToHex(field_7_wXMode)).Append("(").Append(field_7_wXMode).AppendLine(")")
            .Append("   .wYMode           =").Append(HexDump.ToHex(field_8_wYMode)).Append("(").Append(field_8_wYMode).AppendLine(")")
            .Append("   .wWidthMode       =").Append(HexDump.ToHex(field_9_wWidthMode)).Append("(").Append(field_9_wWidthMode).AppendLine(")")
            .Append("   .wHeightMode      =").Append(HexDump.ToHex(field_10_wHeightMode)).Append("(").Append(field_10_wHeightMode).AppendLine(")")
            .Append("   .x                =").Append(HexDump.ToHex(BitConverter.DoubleToInt64Bits(field_11_x))).Append("(").Append(field_11_x).AppendLine(")")
            .Append("   .y                =").Append(HexDump.ToHex(BitConverter.DoubleToInt64Bits(field_12_y))).Append("(").Append(field_12_y).AppendLine(")")
            .Append("   .dx               =").Append(HexDump.ToHex(BitConverter.DoubleToInt64Bits(field_13_dx))).Append("(").Append(field_13_dx).AppendLine(")")
            .Append("   .dy               =").Append(HexDump.ToHex(BitConverter.DoubleToInt64Bits(field_14_dy))).Append("(").Append(field_14_dy).AppendLine(")")
            .AppendLine("[/CRTLAYOUT12]");

            return(buffer.ToString());
        }
Example #26
0
        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        public override String ToString()
        {
            String nl = Environment.NewLine;

            //        String extraData;
            //        MemoryStream b = new MemoryStream();
            //        try
            //        {
            //            HexDump.dump(this.remainingData, 0, b, 0);
            //            extraData = b.ToString();
            //        }
            //        catch ( Exception e )
            //        {
            //            extraData = "error";
            //        }
            return(GetType().Name + ":" + nl +
                   "  RecordId: 0x" + HexDump.ToHex(RECORD_ID) + nl +
                   "  Options: 0x" + HexDump.ToHex(Options) + nl +
                   "  RectX: " + field_1_rectX1 + nl +
                   "  RectY: " + field_2_rectY1 + nl +
                   "  RectWidth: " + field_3_rectX2 + nl +
                   "  RectHeight: " + field_4_rectY2 + nl);
        }
Example #27
0
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[VALUERANGE]\n");
            buffer.Append("    .minimumAxisValue     = ")
            .Append(" (").Append(MinimumAxisValue).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("    .maximumAxisValue     = ")
            .Append(" (").Append(MaximumAxisValue).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("    .majorIncrement       = ")
            .Append(" (").Append(MajorIncrement).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("    .minorIncrement       = ")
            .Append(" (").Append(MinorIncrement).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("    .categoryAxisCross    = ")
            .Append(" (").Append(CategoryAxisCross).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("    .options              = ")
            .Append("0x").Append(HexDump.ToHex(Options))
            .Append(" (").Append(Options).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("         .automaticMinimum         = ").Append(IsAutomaticMinimum).Append('\n');
            buffer.Append("         .automaticMaximum         = ").Append(IsAutomaticMaximum).Append('\n');
            buffer.Append("         .automaticMajor           = ").Append(IsAutomaticMajor).Append('\n');
            buffer.Append("         .automaticMinor           = ").Append(IsAutomaticMinor).Append('\n');
            buffer.Append("         .automaticCategoryCrossing     = ").Append(IsAutomaticCategoryCrossing).Append('\n');
            buffer.Append("         .logarithmicScale         = ").Append(IsLogarithmicScale).Append('\n');
            buffer.Append("         .valuesInReverse          = ").Append(IsValuesInReverse).Append('\n');
            buffer.Append("         .crossCategoryAxisAtMaximum     = ").Append(IsCrossCategoryAxisAtMaximum).Append('\n');
            buffer.Append("         .reserved                 = ").Append(IsReserved).Append('\n');

            buffer.Append("[/VALUERANGE]\n");
            return(buffer.ToString());
        }
Example #28
0
        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        public override String ToString()
        {
            String nl = Environment.NewLine;

            String extraData;

            using (MemoryStream b = new MemoryStream())
            {
                try
                {
                    HexDump.Dump(this._remainingData, 0, b, 0);
                    //extraData = b.ToString();
                    extraData = Encoding.UTF8.GetString(b.ToArray());
                }
                catch (Exception e)
                {
                    extraData = e.ToString();
                }
                return(GetType().Name + ":" + nl +
                       "  RecordId: 0x" + HexDump.ToHex(RECORD_ID) + nl +
                       "  Version: 0x" + HexDump.ToHex(Version) + '\n' +
                       "  Instance: 0x" + HexDump.ToHex(Instance) + '\n' +
                       "  BlipTypeWin32: " + field_1_blipTypeWin32 + nl +
                       "  BlipTypeMacOS: " + field_2_blipTypeMacOS + nl +
                       "  SUID: " + HexDump.ToHex(field_3_uid) + nl +
                       "  Tag: " + field_4_tag + nl +
                       "  Size: " + field_5_size + nl +
                       "  Ref: " + field_6_ref + nl +
                       "  Offset: " + field_7_offset + nl +
                       "  Usage: " + field_8_usage + nl +
                       "  Name: " + field_9_name + nl +
                       "  Unused2: " + field_10_unused2 + nl +
                       "  Unused3: " + field_11_unused3 + nl +
                       "  blipRecord: " + (field_12_blipRecord == null ? "null" : field_12_blipRecord.ToString()) + nl +
                       "  Extra Data:" + nl + extraData);
            }
        }
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("[ftCmo]\n");
            buffer.Append("    .objectType           = ")
            .Append("0x").Append(HexDump.ToHex((short)ObjectType))
            .Append(" (").Append(ObjectType).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("    .objectId             = ")
            .Append("0x").Append(HexDump.ToHex(ObjectId))
            .Append(" (").Append(ObjectId).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("    .option               = ")
            .Append("0x").Append(HexDump.ToHex(Option))
            .Append(" (").Append(Option).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("         .locked                   = ").Append(IsLocked).Append('\n');
            buffer.Append("         .printable                = ").Append(IsPrintable).Append('\n');
            buffer.Append("         .autoFill                 = ").Append(IsAutoFill).Append('\n');
            buffer.Append("         .autoline                 = ").Append(IsAutoline).Append('\n');
            buffer.Append("    .reserved1            = ")
            .Append("0x").Append(HexDump.ToHex(Reserved1))
            .Append(" (").Append(Reserved1).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("    .reserved2            = ")
            .Append("0x").Append(HexDump.ToHex(Reserved2))
            .Append(" (").Append(Reserved2).Append(" )");
            buffer.Append(Environment.NewLine);
            buffer.Append("    .reserved3            = ")
            .Append("0x").Append(HexDump.ToHex(Reserved3))
            .Append(" (").Append(Reserved3).Append(" )");
            buffer.Append(Environment.NewLine);

            buffer.Append("[/ftCmo]\n");
            return(buffer.ToString());
        }
        public override String ToXml(String tab)
        {
            String extraData;

            using (MemoryStream b = new MemoryStream())
            {
                try
                {
                    HexDump.Dump(this.remainingData, 0, b, 0);
                    extraData = HexDump.ToHex(b.ToArray());
                }
                catch (Exception)
                {
                    extraData = "error\n";
                }
                if (extraData.Contains("No Data"))
                {
                    extraData = "No Data";
                }
                StringBuilder builder = new StringBuilder();
                builder.Append(tab)
                .Append(FormatXmlRecordHeader(GetType().Name, HexDump.ToHex(RecordId),
                                              HexDump.ToHex(Version), HexDump.ToHex(Instance)))
                .Append(tab).Append("\t").Append("<Flag>").Append(field_1_flag).Append("</Flag>\n")
                .Append(tab).Append("\t").Append("<Col1>").Append(field_2_col1).Append("</Col1>\n")
                .Append(tab).Append("\t").Append("<DX1>").Append(field_3_dx1).Append("</DX1>\n")
                .Append(tab).Append("\t").Append("<Row1>").Append(field_4_row1).Append("</Row1>\n")
                .Append(tab).Append("\t").Append("<DY1>").Append(field_5_dy1).Append("</DY1>\n")
                .Append(tab).Append("\t").Append("<Col2>").Append(field_6_col2).Append("</Col2>\n")
                .Append(tab).Append("\t").Append("<DX2>").Append(field_7_dx2).Append("</DX2>\n")
                .Append(tab).Append("\t").Append("<Row2>").Append(field_8_row2).Append("</Row2>\n")
                .Append(tab).Append("\t").Append("<DY2>").Append(field_9_dy2).Append("</DY2>\n")
                .Append(tab).Append("\t").Append("<ExtraData>").Append(extraData).Append("</ExtraData>\n");
                builder.Append(tab).Append("</").Append(GetType().Name).Append(">\n");
                return(builder.ToString());
            }
        }