Exemplo n.º 1
0
        private string ReadString(LeImageReader rdr)
        {
            var cStr = rdr.ReadLengthPrefixedString(
                PrimitiveType.Byte,
                PrimitiveType.Char,
                Encoding.ASCII);

            return(cStr?.ToString());
        }
Exemplo n.º 2
0
        public void ReadLengthPrefixedString()
        {
            var img =
                new LeImageReader(
                    new LoadedImage(
                        Address.Ptr32(0x10000),
                        new byte[] { 0x12, 0x34, 0x03, 0x00, 0x00, 0x00, 0x46, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x02, 0x02 }),
                    2);
            StringConstant str = img.ReadLengthPrefixedString(PrimitiveType.Int32, PrimitiveType.WChar);

            Assert.AreEqual("Foo", str.ToString());
        }
Exemplo n.º 3
0
        public void ReadLengthPrefixedString()
        {
            var img =
                new LeImageReader(
                    new ByteMemoryArea(
                        Address.Ptr32(0x10000),
                        new byte[] {
                0x12, 0x34, 0x03, 0x00, 0x00, 0x00, 0x46, 0x00,
                0x6f, 0x00, 0x6f, 0x00, 0x02, 0x02
            }),
                    2);
            StringConstant str = img.ReadLengthPrefixedString(PrimitiveType.Int32, PrimitiveType.WChar, Encoding.Unicode);

            Assert.AreEqual("Foo", str.ToString());
            Assert.AreEqual(9, img.Offset);
        }