BBGamelib.flash.imp.Utils.ReadInt32 C# (CSharp) Method

ReadInt32() public static method

public static ReadInt32 ( byte data, Cursor cursor ) : int
data byte
cursor Cursor
return int
		public static int ReadInt32(byte[] data, Cursor cursor)
		{
			int aInt;
			if (BitConverter.IsLittleEndian) {
				int index = cursor.index;
				byte[] newData = new byte[]{data [index + 3], data [index + 2], data [index + 1], data [index + 0]};
				aInt = BitConverter.ToInt32 (newData, 0);			
			} else {
				aInt = BitConverter.ToInt32(data, cursor.index);
			}
			cursor.index += sizeof(Int32);
			return aInt;
		}
		public static float ReadFloat(byte[] data, Cursor cursor)

Usage Example

Beispiel #1
0
        public TagDefineMovie(Flash flash, byte[] data, Cursor cursor) : base(flash, data, cursor)
        {
            int tagsCount = Utils.ReadInt32(data, cursor);

            _tags = new ITag[tagsCount];
            for (int i = 0; i < tagsCount; i++)
            {
                byte type = Utils.ReadByte(data, cursor);
                if (type == TagPlaceObject.TYPE)
                {
                    ITag tag = new TagPlaceObject(this.flash, data, cursor);
                    _tags[i] = tag;
                }
                else if (type == TagRemoveObject.TYPE)
                {
                    ITag tag = new TagRemoveObject(this.flash, data, cursor);
                    _tags[i] = tag;
                }
            }

            _maxDepth = Utils.ReadInt32(data, cursor);

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

            _frames = new Frame[framesCount];
            for (int i = 0; i < framesCount; i++)
            {
                Frame frame = new Frame(i, data, cursor);
                _frames[i] = frame;
            }
        }
All Usage Examples Of BBGamelib.flash.imp.Utils::ReadInt32