Пример #1
0
        private static void Output_Series(byte[] data, string indentation)
        {
            using (MemoryStream stream = new MemoryStream(data))
            {
                DelphiBinaryReader reader = new DelphiBinaryReader(stream);
                int count = reader.ReadInt32();

                for (int i = 0; i < count; i++)
                {
                    int len = reader.ReadInt32();
                    string type = reader.ReadString(len);
                    WriteLine("{0}{1}", indentation, type);
                    OutputComponent(reader.ReadComponent(true), indentation + "  ");
                    OutputProperty("SQL", reader.ReadString(reader.ReadInt32()), indentation + "  ");
                    //TODO: figure out what these numbers mean
                    Debug.Assert(reader.ReadInt32() == 0);
                    Debug.Assert(reader.ReadInt32() == 0);
                }

                Debug.Assert(stream.Position == stream.Length);
            }
        }
Пример #2
0
        private static void OutputTreeNode(DelphiBinaryReader reader, int level, string indentation)
        {
            //TODO: figure out what this number means
            Debug.Assert(reader.ReadInt32() == level + 26);
            OutputProperty("SmallImageIndex", reader.ReadInt32(), indentation);
            OutputProperty("SelectedImageIndex", reader.ReadInt32(), indentation);
            OutputProperty("StateImageIndex", reader.ReadInt32(), indentation);
            OutputProperty("LargeImageIndex", reader.ReadInt32(), indentation);
            OutputProperty("Indent", reader.ReadInt32(), indentation);
            int childCount = reader.ReadInt32();
            OutputProperty("Caption", reader.ReadString(), indentation);

            for (int i = 0; i < childCount; i++)
            {
                WriteLine("{0}[{1}]", indentation + "  ", i);
                OutputTreeNode(reader, level + 1, indentation + "    ");
            }
        }
Пример #3
0
        private static void Output_Items_Data(byte[] data, string indentation)
        {
            using (MemoryStream stream = new MemoryStream(data))
            {
                DelphiBinaryReader reader = new DelphiBinaryReader(stream);
                int firstInt = reader.ReadInt32();

                if (firstInt == data.Length)
                {
                    int rootCount = reader.ReadInt32();
                    int totalChildren = 0;

                    for (int i = 0; i < rootCount; i++)
                    {
                        WriteLine("{0}[{1}]", indentation, i);
                        OutputProperty("SmallImageIndex", reader.ReadInt32(), indentation + "  ");
                        OutputProperty("StateImageIndex", reader.ReadInt32(), indentation + "  ");
                        OutputProperty("LargeImageIndex", reader.ReadInt32(), indentation + "  ");
                        int childCount = reader.ReadInt32();
                        OutputProperty("Indent", reader.ReadInt32(), indentation + "  ");
                        OutputProperty("Caption", reader.ReadString(), indentation + "  ");
                        totalChildren += childCount;

                        for (int j = 0; j < childCount; j++)
                        {
                            WriteLine("{0}[{1}]", indentation + "    ", j);
                            OutputProperty("Caption", reader.ReadString(), indentation + "      ");
                        }
                    }

                    WriteLine("{0}SubItemProperties", indentation);

                    for (int i = 0; i < totalChildren; i++)
                    {
                        WriteLine("{0}[{1}]", indentation + "  ", i);
                        OutputProperty("SmallImageIndex", reader.ReadInt16(), indentation + "    ");
                    }
                }
                else
                {
                    for (int i = 0; i < firstInt; i++)
                    {
                        WriteLine("{0}[{1}]", indentation, i);
                        OutputTreeNode(reader, 0, indentation + "  ");
                    }
                }

                Debug.Assert(stream.Position == stream.Length);
            }
        }
Пример #4
0
        private static void OutputPictureData(byte[] data, string indentation)
        {
            using (MemoryStream stream = new MemoryStream(data))
            {
                DelphiBinaryReader reader = new DelphiBinaryReader(stream);
                string type = reader.ReadString();

                if (type == "TBitmap")
                {
                    byte[] imageData = reader.ReadBinary();

                    if (imageData.Length > 0)
                    {
                        using (Stream imageStream = new MemoryStream(imageData))
                        {
                            Image image = Image.FromStream(imageStream);
                            WriteLine("{0}{1}", indentation, image.Size);
                        }
                    }
                }
                else if (type == "TIcon")
                {
                    byte[] imageData = reader.ReadBytes(data.Length - 6);

                    using (Stream imageStream = new MemoryStream(imageData))
                    {
                        Icon image = new Icon(imageStream);
                        WriteLine("{0}{1}", indentation, image.Size);
                    }
                }
                else if (type == "TMetafile")
                {
                    int len = reader.ReadInt32();
                    byte[] imageData = reader.ReadBytes(len - 4);

                    using (Stream imageStream = new MemoryStream(imageData))
                    {
                        Image image = Image.FromStream(imageStream);
                        WriteLine("{0}{1}", indentation, image.Size);
                    }
                }
                else
                {
                    Debug.Assert(false);
                }

                Debug.Assert(stream.Position == stream.Length);
            }
        }