ReadLength() public static method

public static ReadLength ( byte data, Cursor cursor ) : int
data byte
cursor Cursor
return int
示例#1
0
        void readDefines(byte[] data, Cursor cursor)
        {
            int len      = Utils.ReadLength(data, cursor);
            int newIndex = cursor.index + len;

            int maxcharacterId = Utils.ReadInt32(data, cursor);
            int definesCount   = Utils.ReadInt32(data, cursor);

            chId_defs     = new TagDefine[maxcharacterId + 1];
            classNameDefs = new Dictionary <string, TagDefine> (definesCount / 4);

            for (int i = 0; i < definesCount; i++)
            {
                TagDefine define = parseDefine(this, data, cursor);

                if (define != null)
                {
                    chId_defs[define.characterId] = define;
                    if (define is TagDefine && (define as TagDefine).className != null)
                    {
                        classNameDefs[(define as TagDefine).className] = define;
                    }
                }
            }
            cursor.index = newIndex;
        }
示例#2
0
        void readHeader(byte[] data, Cursor cursor)
        {
            int len      = Utils.ReadLength(data, cursor);
            int newIndex = cursor.index + len;

            version = Utils.ReadInt32(data, cursor);

            int supportedVersion = Utils.ReadInt32(data, cursor);

            NSUtils.Assert(LIB_VERSION >= supportedVersion, "BBGamelib:flash: library {0} is not supported by swf parser {1} ",
                           versionToString(LIB_VERSION), versionToString(supportedVersion));

            flashVersion = Utils.ReadByte(data, cursor);
            frameRate    = Utils.ReadByte(data, cursor);
            frameSize    = Utils.ReadVector2(data, cursor);
            prefix       = Utils.ReadString(data, cursor);

            cursor.index = newIndex;
        }