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

                for (int i = 0; i < count; i++)
                {
                    string name = (string) reader.ReadValue();
                    WriteLine("{0}{1}", indentation, name);
                    //TODO: figure out what this number means
                    Debug.Assert(reader.ReadByte() == 1);

                    while (reader.PeekChar() != 0)
                    {
                        OutputProperty(reader, indentation + "  ");
                    }

                    Debug.Assert(reader.ReadByte() == 0);
                }

                Debug.Assert(stream.Position == stream.Length);
            }
        }
Пример #2
0
        private static void OutputLicense(byte[] data, string indentation)
        {
            using (MemoryStream stream = new MemoryStream(data))
            {
                DelphiBinaryReader reader = new DelphiBinaryReader(stream);
                int size = reader.ReadInteger();

                if (size > 0)
                {
                    //TODO: figure out what this number means
                    Debug.Assert(reader.ReadByte() == 6);
                    Debug.Assert(reader.ReadByte() == size);
                    //TODO: figure out what this data means
                    byte[] licenseData = reader.ReadBytes(size);
                    WriteLine("{0}{1}", indentation, Encoding.Unicode.GetString(licenseData));
                }

                Debug.Assert(stream.Position == stream.Length);
            }
        }
Пример #3
0
        private static void OutputDataBindings(byte[] data, string indentation)
        {
            using (MemoryStream stream = new MemoryStream(data))
            {
                DelphiBinaryReader reader = new DelphiBinaryReader(stream);
                int count = reader.ReadInteger();

                for (int i = 0; i < count; i++)
                {
                    int propertyIndex = reader.ReadInteger();
                    Debug.Assert(
                        propertyIndex == -518 ||
                        propertyIndex == -517 ||
                        (propertyIndex >= 1 && propertyIndex <= 9) ||
                        propertyIndex == 11 ||
                        propertyIndex == 12 ||
                        propertyIndex == 14 ||
                        propertyIndex == 16 ||
                        propertyIndex == 17 ||
                        propertyIndex == 19 ||
                        propertyIndex == 21 ||
                        (propertyIndex >= 29 && propertyIndex <= 33) ||
                        propertyIndex == 36 ||
                        propertyIndex == 39 ||
                        propertyIndex == 43 ||
                        (propertyIndex >= 101 && propertyIndex <= 105) ||
                        propertyIndex == 222 ||
                        propertyIndex == 0x60020010 ||
                        propertyIndex == 0x60020012 ||
                        propertyIndex == 0x60020016 ||
                        propertyIndex == 0x60020018 ||
                        propertyIndex == 0x6002001A);
                    string str = (string) reader.ReadValue();
                    WriteLine("{0}{1} ({2})", indentation, str, propertyIndex);
                }

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

                for (int i = 0; i < count; i++)
                {
                    int eventIndex = reader.ReadInteger();
                    Debug.Assert((eventIndex >= 1 && eventIndex <= 23) ||
                                 (eventIndex >= 201 && eventIndex <= 206) || eventIndex == 0x60000017 || eventIndex == 0x60000018);
                    string str = (string) reader.ReadValue();
                    WriteLine("{0}{1} ({2})", indentation, str, eventIndex);
                }

                Debug.Assert(stream.Position == stream.Length);
            }
        }
        private ICollection<DelphiComponent> ParseChildControls(byte[] data)
        {
            using (DelphiBinaryReader binaryReader = new DelphiBinaryReader(new MemoryStream(data)))
            {
                int count = binaryReader.ReadInteger();
                ICollection<DelphiComponent> childControls = new List<DelphiComponent>();

                for (int i = 0; i < count; i++)
                {
                    DelphiComponent component = new DelphiComponent();
                    component.Name = (string) binaryReader.ReadValue();
                    //TODO: figure out what this number means
                    byte b = binaryReader.ReadByte();
                    Debug.Assert(b == 1);

                    while (binaryReader.PeekChar() != 0)
                    {
                        ParseProperty(binaryReader, component.Properties);
                    }

                    b = binaryReader.ReadByte();
                    Debug.Assert(b == 0);
                    childControls.Add(component);
                }

                Debug.Assert(binaryReader.BaseStream.Position == binaryReader.BaseStream.Length);
                return childControls;
            }
        }