示例#1
0
 public virtual string readHeader(global::alphatab.io.BitInput src)
 {
     unchecked
     {
         return(src.readString(4));
     }
 }
示例#2
0
 public virtual void load(global::haxe.io.BytesInput data)
 {
     unchecked
     {
         global::alphatab.io.BitInput src = new global::alphatab.io.BitInput(((global::haxe.io.BytesInput)(data)));
         this.readBlock(src);
     }
 }
示例#3
0
 public static void __hx_ctor_alphatab_io_BitInput(global::alphatab.io.BitInput __temp_me67, global::haxe.io.BytesInput input)
 {
     unchecked
     {
         __temp_me67._input     = input;
         __temp_me67._readBytes = 0;
         __temp_me67._position  = 8;
     }
 }
示例#4
0
 public virtual void readBlock(global::alphatab.io.BitInput data)
 {
     unchecked
     {
         string header = this.readHeader(data);
         if (string.Equals(header, "BCFZ"))
         {
             this.readUncompressedBlock(this.decompress(data, new global::haxe.lang.Null <bool>(true, true)));
         }
         else
         {
             if (string.Equals(header, "BCFS"))
             {
                 this.readUncompressedBlock(data.readAll(default(global::haxe.lang.Null <int>)));
             }
             else
             {
                 throw global::haxe.lang.HaxeException.wrap(global::alphatab.importer.ScoreImporter.UnsupportedFormat);
             }
         }
     }
 }
示例#5
0
        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)));
            }
        }
示例#6
0
		public virtual   void load(global::haxe.io.BytesInput data)
		{
			unchecked 
			{
				global::alphatab.io.BitInput src = new global::alphatab.io.BitInput(((global::haxe.io.BytesInput) (data) ));
				this.readBlock(src);
			}
		}