Exemplo n.º 1
0
 /// <summary>
 /// Update Used Space
 /// </summary>
 /// <param name="driveLetter"></param>
 /// <returns></returns>
 private bool UpdateUsedSpace(string driveLetter)
 {
     lblStatus.Text = "Updating Used Space ...";
     this.Refresh();
     Application.DoEvents();
     var cd = new FL_MSF();
     var tracks = new FL_MSF();
     int l = 0;
     for (int i = 0; i < AudioCdWriter.FileCount; ++i) {
         l = l + AudioCdWriter.TrackLength((short)i);
     }
     int m = l / 60;
     int s = l - m * 60;
     tracks.set_M(m);
     tracks.set_s(s);
     CDInfo.GetInfo(driveLetter);
     cd.LBA = CDInfo.Capacity / 2352;
     if (cd.LBA == 0) {
         lblStatus.Text = "CD has no available space.";
         cmdAddFiles.Enabled = false;
         cmdDeleteFiles.Enabled = false;
         cmdClearAudioFiles.Enabled = false;
         cmdBurnAudioFiles.Enabled = false;
         //lblStatus.Text = "";
         return false;
     } else {
         cmdAddFiles.Enabled = true;
         cmdDeleteFiles.Enabled = true;
         cmdClearAudioFiles.Enabled = true;
         cmdBurnAudioFiles.Enabled = true;
         prgSpaceAvailable.Maximum = cd.LBA;
         if (tracks.LBA > -1) {
             lblStatus.Text = cd.LBA.ToString() + " available space " + tracks.LBA.ToString() + " total track(s) length";
             prgSpaceAvailable.Value1 = tracks.LBA;
             //prgSpaceAvailable.Value2 = tracks.LBA;
         } else {
             lblStatus.Text = cd.LBA.ToString() + " available space";
             prgSpaceAvailable.Value1 = 0;
             prgSpaceAvailable.Value2 = 0;
         }
     }
     //lblStatus.Text = "";
     this.Refresh();
     Application.DoEvents();
     var b = false;
     if (cd.get_M() < m) {
         b = true;
     }
     if (cd.get_M() == m && cd.get_s() < s) {
         b = true;
     }
     return b;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Update Used Space
        /// </summary>
        /// <param name="driveLetter"></param>
        /// <returns></returns>
        private bool UpdateUsedSpace(string driveLetter)
        {
            lblStatus.Text = "Updating Used Space ...";
            this.Refresh();
            Application.DoEvents();
            var cd     = new FL_MSF();
            var tracks = new FL_MSF();
            int l      = 0;

            for (int i = 0; i < AudioCdWriter.FileCount; ++i)
            {
                l = l + AudioCdWriter.TrackLength((short)i);
            }
            int m = l / 60;
            int s = l - m * 60;

            tracks.set_M(m);
            tracks.set_s(s);
            CDInfo.GetInfo(driveLetter);
            cd.LBA = CDInfo.Capacity / 2352;
            if (cd.LBA == 0)
            {
                lblStatus.Text             = "CD has no available space.";
                cmdAddFiles.Enabled        = false;
                cmdDeleteFiles.Enabled     = false;
                cmdClearAudioFiles.Enabled = false;
                cmdBurnAudioFiles.Enabled  = false;
                //lblStatus.Text = "";
                return(false);
            }
            else
            {
                cmdAddFiles.Enabled        = true;
                cmdDeleteFiles.Enabled     = true;
                cmdClearAudioFiles.Enabled = true;
                cmdBurnAudioFiles.Enabled  = true;
                prgSpaceAvailable.Maximum  = cd.LBA;
                if (tracks.LBA > -1)
                {
                    lblStatus.Text           = cd.LBA.ToString() + " available space " + tracks.LBA.ToString() + " total track(s) length";
                    prgSpaceAvailable.Value1 = tracks.LBA;
                    //prgSpaceAvailable.Value2 = tracks.LBA;
                }
                else
                {
                    lblStatus.Text           = cd.LBA.ToString() + " available space";
                    prgSpaceAvailable.Value1 = 0;
                    prgSpaceAvailable.Value2 = 0;
                }
            }
            //lblStatus.Text = "";
            this.Refresh();
            Application.DoEvents();
            var b = false;

            if (cd.get_M() < m)
            {
                b = true;
            }
            if (cd.get_M() == m && cd.get_s() < s)
            {
                b = true;
            }
            return(b);
        }