public static void __hx_ctor_alphatab_io_BytesArray(global::alphatab.io.BytesArray __temp_me70, global::haxe.lang.Null <int> initialSize) { unchecked { int __temp_initialSize69 = ((global::haxe.lang.Runtime.eq((initialSize).toDynamic(), (default(global::haxe.lang.Null <int>)).toDynamic())) ? (((int)(4))) : (initialSize.@value)); __temp_me70._data = global::haxe.io.Bytes.alloc(__temp_initialSize69); __temp_me70.length = 0; } }
public static global::alphatab.io.BytesArray ofBytes(global::haxe.io.Bytes b) { unchecked { global::alphatab.io.BytesArray a = new global::alphatab.io.BytesArray(((global::haxe.lang.Null <int>)(default(global::haxe.lang.Null <int>)))); a._data = b; a.length = a._data.length; return(a); } }
public static global::alphatab.io.BytesArray ofBytes(global::haxe.io.Bytes b) { unchecked { global::alphatab.io.BytesArray a = new global::alphatab.io.BytesArray(((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) )); a._data = b; a.length = a._data.length; return a; } }
public virtual void readUncompressedBlock(global::haxe.io.Bytes data) { unchecked { int sectorSize = 4096; int offset = sectorSize; while (((offset + 3) < data.length)) { int entryType = this.getInteger(data, offset); if ((entryType == 2)) { global::alphatab.importer.GpxFile file = new global::alphatab.importer.GpxFile(); file.fileName = this.getString(data, (offset + 4), 127); file.fileSize = this.getInteger(data, (offset + 140)); bool storeFile = default(bool); if ((this._fileFilter != default(global::haxe.lang.Function))) { storeFile = ((bool)(this._fileFilter.__hx_invoke1_o(default(double), file.fileName))); } else { storeFile = this.defaultFileFilter(file.fileName); } if (storeFile) { this.files.push(file); } int dataPointerOffset = (offset + 148); int sector = 0; int sectorCount = 0; global::alphatab.io.BytesArray fileData = default(global::alphatab.io.BytesArray); if (storeFile) { fileData = new global::alphatab.io.BytesArray(new global::haxe.lang.Null <int>(file.fileSize, true)); } else { fileData = default(global::alphatab.io.BytesArray); } while (((sector = this.getInteger(data, (dataPointerOffset + (4 * sectorCount++)))) != 0)) { offset = (sector * sectorSize); if (storeFile) { fileData.addBytes(data.sub(offset, sectorSize)); } } if (storeFile) { int __temp_stmt507 = default(int); { double x = global::System.Math.Min(((double)(file.fileSize)), ((double)(fileData.length))); __temp_stmt507 = ((int)(x)); } file.data = global::haxe.io.Bytes.alloc(__temp_stmt507); file.data.blit(0, fileData.getBuffer(), 0, file.data.length); } } offset += sectorSize; } } }
public virtual global::haxe.io.Bytes decompress(global::alphatab.io.BitInput src, global::haxe.lang.Null <bool> skipHeader) { unchecked { bool __temp_skipHeader59 = ((global::haxe.lang.Runtime.eq((skipHeader).toDynamic(), (default(global::haxe.lang.Null <bool>)).toDynamic())) ? (((bool)(false))) : (skipHeader.@value)); global::alphatab.io.BytesArray uncompressed = new global::alphatab.io.BytesArray(((global::haxe.lang.Null <int>)(default(global::haxe.lang.Null <int>)))); int expectedLength = src.readInt32(); try { while ((uncompressed.length < expectedLength)) { int flag = src.readBits(1); if ((flag == 1)) { int wordSize = src.readBits(4); int offset = src.readBitsReversed(wordSize); int size = src.readBitsReversed(wordSize); int sourcePosition = (uncompressed.length - offset); int toRead = default(int); { double x = global::System.Math.Min(((double)(offset)), ((double)(size))); toRead = ((int)(x)); } global::haxe.io.Bytes subBuffer = uncompressed.sub(sourcePosition, toRead); uncompressed.addBytes(subBuffer); } else { int size1 = src.readBitsReversed(2); { int _g = 0; while ((_g < ((int)(size1)))) { int i = _g++; uncompressed.@add(src.readByte()); } } } } } catch (global::System.Exception __temp_catchallException505) { object __temp_catchall506 = __temp_catchallException505; if ((__temp_catchall506 is global::haxe.lang.HaxeException)) { __temp_catchall506 = ((global::haxe.lang.HaxeException)(__temp_catchallException505)).obj; } if ((__temp_catchall506 is global::haxe.io.Eof)) { global::haxe.io.Eof e = ((global::haxe.io.Eof)(__temp_catchall506)); { { } } } else { throw; } } return(uncompressed.getBytes(new global::haxe.lang.Null <int>(((__temp_skipHeader59) ? (4) : (0)), true))); } }
public virtual void readUncompressedBlock(global::haxe.io.Bytes data) { unchecked { int sectorSize = 4096; int offset = sectorSize; while (( ( offset + 3 ) < data.length )) { int entryType = this.getInteger(data, offset); if (( entryType == 2 )) { global::alphatab.importer.GpxFile file = new global::alphatab.importer.GpxFile(); file.fileName = this.getString(data, ( offset + 4 ), 127); file.fileSize = this.getInteger(data, ( offset + 140 )); bool storeFile = default(bool); if (( this._fileFilter != default(global::haxe.lang.Function) )) { storeFile = ((bool) (this._fileFilter.__hx_invoke1_o(default(double), file.fileName)) ); } else { storeFile = this.defaultFileFilter(file.fileName); } if (storeFile) { this.files.push(file); } int dataPointerOffset = ( offset + 148 ); int sector = 0; int sectorCount = 0; global::alphatab.io.BytesArray fileData = default(global::alphatab.io.BytesArray); if (storeFile) { fileData = new global::alphatab.io.BytesArray(new global::haxe.lang.Null<int>(file.fileSize, true)); } else { fileData = default(global::alphatab.io.BytesArray); } while (( (sector = this.getInteger(data, ( dataPointerOffset + ( 4 * sectorCount++ ) ))) != 0 )) { offset = ( sector * sectorSize ); if (storeFile) { fileData.addBytes(data.sub(offset, sectorSize)); } } if (storeFile) { int __temp_stmt507 = default(int); { double x = global::System.Math.Min(((double) (file.fileSize) ), ((double) (fileData.length) )); __temp_stmt507 = ((int) (x) ); } file.data = global::haxe.io.Bytes.alloc(__temp_stmt507); file.data.blit(0, fileData.getBuffer(), 0, file.data.length); } } offset += sectorSize; } } }
public virtual global::haxe.io.Bytes decompress(global::alphatab.io.BitInput src, global::haxe.lang.Null<bool> skipHeader) { unchecked { bool __temp_skipHeader59 = ( (global::haxe.lang.Runtime.eq((skipHeader).toDynamic(), (default(global::haxe.lang.Null<bool>)).toDynamic())) ? (((bool) (false) )) : (skipHeader.@value) ); global::alphatab.io.BytesArray uncompressed = new global::alphatab.io.BytesArray(((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) )); int expectedLength = src.readInt32(); try { while (( uncompressed.length < expectedLength )) { int flag = src.readBits(1); if (( flag == 1 )) { int wordSize = src.readBits(4); int offset = src.readBitsReversed(wordSize); int size = src.readBitsReversed(wordSize); int sourcePosition = ( uncompressed.length - offset ); int toRead = default(int); { double x = global::System.Math.Min(((double) (offset) ), ((double) (size) )); toRead = ((int) (x) ); } global::haxe.io.Bytes subBuffer = uncompressed.sub(sourcePosition, toRead); uncompressed.addBytes(subBuffer); } else { int size1 = src.readBitsReversed(2); { int _g = 0; while (( _g < ((int) (size1) ) )) { int i = _g++; uncompressed.@add(src.readByte()); } } } } } catch (global::System.Exception __temp_catchallException505) { object __temp_catchall506 = __temp_catchallException505; if (( __temp_catchall506 is global::haxe.lang.HaxeException )) { __temp_catchall506 = ((global::haxe.lang.HaxeException) (__temp_catchallException505) ).obj; } if (( __temp_catchall506 is global::haxe.io.Eof )) { global::haxe.io.Eof e = ((global::haxe.io.Eof) (__temp_catchall506) ); { { } } } else { throw; } } return uncompressed.getBytes(new global::haxe.lang.Null<int>(( (__temp_skipHeader59) ? (4) : (0) ), true)); } }