コード例 #1
0
            /// <summary>
            /// Read ctor
            /// </summary>
            protected EntryInstance(Type parent, ResReader reader)
            {
                this.parent = parent;

                // header
                var size = reader.ReadUInt16();
                flags = (EntryFlags) reader.ReadUInt16();
                key = StringPoolRef.Read(reader, parent.TypeSpec.Package.KeyStrings);
            }
コード例 #2
0
            /// <summary>
            /// Read ctor
            /// </summary>
            protected EntryInstance(Type parent, ResReader reader)
            {
                this.parent = parent;

                // header
                var size = reader.ReadUInt16();

                flags = (EntryFlags)reader.ReadUInt16();
                key   = StringPoolRef.Read(reader, parent.TypeSpec.Package.KeyStrings);
            }
コード例 #3
0
            /// <summary>
            /// Read an entry and return it.
            /// </summary>
            internal static EntryInstance Read(Type parent, ResReader reader)
            {
                var position = reader.Position;
                var size = reader.ReadUInt16();
                var flags = (EntryFlags) reader.ReadUInt16();
                reader.Position = position;

                if ((flags & EntryFlags.Complex) != 0)
                    return new ComplexEntryInstance(parent, reader);
                return new SimpleEntryInstance(parent, reader);
            }
コード例 #4
0
ファイル: StringPool.cs プロジェクト: yuva2achieve/dot42
        /// <summary>
        /// Default a length for charsize=2
        /// </summary>
        private static int DecodeLength16(ResReader reader, byte[] strings, ref int offset)
        {
            var length = reader.ReadUInt16(strings, offset);

            offset += 2;
            if ((length & 0x8000) != 0)
            {
                length  = ((length & 0x7FFF) << 16) | reader.ReadUInt16(strings, offset);
                offset += 2;
            }
            return(length);
        }
コード例 #5
0
            /// <summary>
            /// Read an entry and return it.
            /// </summary>
            internal static EntryInstance Read(Type parent, ResReader reader)
            {
                var position = reader.Position;
                var size     = reader.ReadUInt16();
                var flags    = (EntryFlags)reader.ReadUInt16();

                reader.Position = position;

                if ((flags & EntryFlags.Complex) != 0)
                {
                    return(new ComplexEntryInstance(parent, reader));
                }
                return(new SimpleEntryInstance(parent, reader));
            }
コード例 #6
0
ファイル: Value.cs プロジェクト: Xtremrules/dot42
 /// <summary>
 /// Reading ctor
 /// </summary>
 internal Value(ResReader reader)
 {
     var size = reader.ReadUInt16();
     reader.Skip(1); // res0
     type = (Types)reader.ReadByte();
     data = reader.ReadInt32();
 }
コード例 #7
0
ファイル: StringPool.cs プロジェクト: yuva2achieve/dot42
        /// <summary>
        /// Returns raw string (without any styling information) at specified index.
        /// Returns null if index is invalid or object was not initialized.
        /// </summary>
        private static string GetRaw(int index, int[] stringOffsets, byte[] strings, bool isUtf8, ResReader reader)
        {
            if (index < 0 || (stringOffsets == null) || (index >= stringOffsets.Length))
            {
                return(null);
            }
            var offset = stringOffsets[index];
            int length;

            if (isUtf8)
            {
                // charsize = 1
                // Decode length
                var u16Length = DecodeLength8(strings, ref offset);
                length = DecodeLength8(strings, ref offset);
                return(AndroidEncodings.UTF8.GetString(strings, offset, length));
            }

            // charsize = 2
            length = DecodeLength16(reader, strings, ref offset);
            var data = new char[length];

            for (var i = 0; i < length; i++)
            {
                data[i] = (char)reader.ReadUInt16(strings, offset);
                offset += 2;
            }
            return(new string(data));
        }
コード例 #8
0
        /// <summary>
        /// Reading ctor
        /// </summary>
        internal Value(ResReader reader)
        {
            var size = reader.ReadUInt16();

            reader.Skip(1); // res0
            type = (Types)reader.ReadByte();
            data = reader.ReadInt32();
        }
コード例 #9
0
            /// <summary>
            /// Reading ctor
            /// </summary>
            internal StartElement(ResReader reader, XmlTree tree)
                : base(reader, tree, ChunkTypes.RES_XML_START_ELEMENT_TYPE)
            {
                var attributeStart = reader.ReadUInt16();
                var attributeSize  = reader.ReadUInt16();
                var attributeCount = reader.ReadUInt16();
                var id             = reader.ReadUInt16();
                var classIndex     = reader.ReadUInt16();
                var styleIndex     = reader.ReadUInt16();

                for (var i = 0; i < attributeCount; i++)
                {
                    attributes.Add(new Attribute(reader, tree));
                }
            }
コード例 #10
0
            /// <summary>
            /// Reading ctor
            /// </summary>
            internal StartElement(ResReader reader, XmlTree tree)
                : base(reader, tree, ChunkTypes.RES_XML_START_ELEMENT_TYPE)
            {
                var attributeStart = reader.ReadUInt16();
                var attributeSize = reader.ReadUInt16();
                var attributeCount = reader.ReadUInt16();
                var id = reader.ReadUInt16();
                var classIndex = reader.ReadUInt16();
                var styleIndex = reader.ReadUInt16();

                for (var i = 0; i < attributeCount; i++)
                {
                    attributes.Add(new Attribute(reader, tree));
                }
            }
コード例 #11
0
 /// <summary>
 /// Reader ctor
 /// </summary>
 protected Chunk(ResReader reader)
 {
     type       = (ChunkTypes)reader.ReadUInt16();
     headerSize = reader.ReadUInt16();
     size       = reader.ReadInt32();
 }