public int ReadTrack(int track, byte[] Data, ref uint DataSize, uint StartSecond, uint Seconds2Read, CdReadProgressEventHandler ProgressEvent)
 {
     if ((this.TocValid && (track >= this.Toc.FirstTrack)) && (track <= this.Toc.LastTrack))
     {
         int startSector = this.GetStartSector(track);
         int endSector   = this.GetEndSector(track);
         if ((startSector += ((int)(StartSecond * 0x4b))) >= endSector)
         {
             startSector -= (int)(StartSecond * 0x4b);
         }
         if ((Seconds2Read > 0) && ((startSector + ((int)(Seconds2Read * 0x4b))) < endSector))
         {
             endSector = startSector + ((int)(Seconds2Read * 0x4b));
         }
         DataSize = (uint)((endSector - startSector) * 0x930);
         if (Data != null)
         {
             if (Data.Length >= ((int)DataSize))
             {
                 CDBufferFiller filler = new CDBufferFiller(Data);
                 return(this.ReadTrack(track, new CdDataReadEventHandler(filler.OnCdDataRead), StartSecond, Seconds2Read, ProgressEvent));
             }
             return(0);
         }
         return(0);
     }
     return(-1);
 }
Beispiel #2
0
 public int ReadTrack(int track, byte[] Data, ref uint DataSize, uint StartSecond, uint Seconds2Read, CdReadProgressEventHandler ProgressEvent)
 {
     if ((this.TocValid && (track >= this.Toc.FirstTrack)) && (track <= this.Toc.LastTrack))
     {
         int startSector = this.GetStartSector(track);
         int endSector = this.GetEndSector(track);
         if ((startSector += ((int)(StartSecond * 0x4b))) >= endSector)
         {
             startSector -= (int)(StartSecond * 0x4b);
         }
         if ((Seconds2Read > 0) && ((startSector + ((int)(Seconds2Read * 0x4b))) < endSector))
         {
             endSector = startSector + ((int)(Seconds2Read * 0x4b));
         }
         DataSize = (uint)((endSector - startSector) * 0x930);
         if (Data != null)
         {
             if (Data.Length >= ((int)DataSize))
             {
                 CDBufferFiller filler = new CDBufferFiller(Data);
                 return this.ReadTrack(track, new CdDataReadEventHandler(filler.OnCdDataRead), StartSecond, Seconds2Read, ProgressEvent);
             }
             return 0;
         }
         return 0;
     }
     return -1;
 }