📄 unit1.cpp
字号:
Function bDiscClick
Description = Displays the Disc Information details
in the Other form
get the Disc Information From the First Completed
track to the Last Completed Tracks.
*******************************************************************************/
void __fastcall TForm1::bDiscClick(TObject *Sender)
{
Mbdrvlib::TDisc Disc;
unsigned int i, ii;
unsigned long int a, b;
unsigned int fb, ub, tb;
TVolumeDescriptor vd;
String str;
byte bs;
frmSession = new TfrmSession(this);
frmSession->lb->Items->Clear();
Disc = mcdb->GetDiscInformation();
if (!(Disc.Valid) )
{
frmSession->lb->Items->Add(" Error getting session information");
frmSession->ShowModal();
return;
}
bs = mcdb->SessionsOnDisc() + 1;
mcdb->ReadTrackInformation(bs);
{
for(i = mcdb->Disc.FirstCompleteSession ;i <= mcdb->Disc.LastCompleteSession; i++)
{
memset(buf, 0,sizeof(buf));
if ( mcdb->ReadTOC(0, buf, 248, i, true, false))
a = MSF2LBA(0, buf[9], buf[10], buf[11]);
else
a = 0;
if (a != 0 )
{
a = a - 150;
str =IntToDec(buf[9], 3, " ")+':'+ IntToDec(buf[10], 2, "0")+':'+IntToDec(buf[11], 2, "0");
mcdb->ReadTrackInformation(i);
for (ii=16 ; ii<=16; ii++)
{
if ( mcdb->Read10(a+ii, 1, (char *)&vd, 2048) )
if (vd.NoOfSectors != 0)
{
b = ceil(mcdb->TrackInformation.TrackSize * 2048 / 1024 / 1024);
frmSession->lb->Items->Add(" "+IntToDec(i, 3, " ")+ " "+str+" "+IntToDec(b, 4, " ")+" MB");
goto found;
}
}
frmSession->lb->Items->Add(" "+IntToDec(i, 3, " ")+ " "+str+" ???? MB");
found:
}
}
}
str = " ";
if (mcdb->ReadTOC(0, buf, 248, 0xAA, true, false) )
{
str =IntToDec(buf[9], 3, " ")+ ":"+ IntToDec(buf[10], 2, " ")+":"+IntToDec(buf[11], 2, " ");
}
else
str ="00:00:00";
fb = mcdb->FreeBlocksOnDisc();
frmSession->lb->Items->Add(" Free " + str + " "+IntToDec(ceil((fb / 1024 / 1024)*2048), 4," ")+" MB");
Disc = mcdb->GetDiscInformation();
frmSession->lMedium->Caption = DiscTypeString[mcdb->DiscType()];
ub = mcdb->UsedBlocksOnDisc();
tb = mcdb->TotalBlocksOnDisc();
frmSession->lDiscSize->Caption = FormatFloat("#,##0.00 MB", (double )tb / 1024.0 / 1024.0 * 2048.0 );
frmSession->lUsedSpace->Caption = FormatFloat("#,##0.00 MB", (double )ub / 1024.0 / 1024.0 * 2048.0 );
frmSession->Visible = false;
frmSession->ShowModal();
}
/*******************************************************************************
Function mcdbWriteDone
Description = This Event handler is called after the write
process is done.
It Checks for the error Messages if they are
Present Then Give the Message.
if Successfully Completed then Ejects
the Medium.
*******************************************************************************/
void __fastcall TForm1::mcdbWriteDone(TObject *Sender, AnsiString Error)
{
Timer1->Enabled = false;
pTop->Enabled = true;
pTop2->Enabled = true;
bSaveISO->Enabled = true;
bBurnISO->Enabled = true;
DriveCB->Enabled = true;
Timer1Timer(Sender);
if (!(Error.IsEmpty()))
{
mcdb->DebugMsg(">>> WRITE/BURNCD PROCESS DONE WITH ERROR", 0);
mcdb->DebugMsg(">>> " +Error, 0);
}
else
{
mcdb->DebugMsg(">>> WRITE/BURNCD PROCESS DONE", 0);
if (oArchiveFiles)
mcdb->ResetFilesArchiveBit();
}
if ( (Error.IsEmpty()) && (ccEject) )
mcdb->LoadMedium(true);
if (oArchiveFiles)
mcdb->ResetFilesArchiveBit();
mcdb->ClearAll(MaxFiles, MaxDirs);
MessageBeep(MB_OK);
bAbort->Visible = False;
mcdb->DebugMsg(" ", 0);
}
/*******************************************************************************
Function Label1Click(TObject *Sender)
Description = Opens the Web Site in The explorer Window.
*******************************************************************************/
void __fastcall TForm1::Label1Click(TObject *Sender)
{
ShellExecute(ValidParentForm(this)->Handle,"open", "http://www.binarymagics.com", NULL, NULL, SW_SHOWNORMAL);
}
/*******************************************************************************
Function mcdbFinalizingTrack (TObject *Sender)
Description = Event Handler Foir Finalizinf the Track
it Gives Error When the track is Finalizing
*******************************************************************************/
void __fastcall TForm1::mcdbFinalizingTrack(TObject *Sender)
{
mcdb->DebugMsg(">>> FINALIZING TRACK", 0);
}
/*******************************************************************************
Function Abort Operation Called
Description = Abort the Current Operation.
*******************************************************************************/
void __fastcall TForm1::bAbortClick(TObject *Sender)
{
mcdb->Abort();
bAbort->Visible = false;
}
/*******************************************************************************
Function ExplorerDragDropDropped
Description = Get the draged files from the Explorer.
*******************************************************************************/
void __fastcall TForm1::ExplorerDragDropDropped(TObject *Sender,
int ItemsCount)
{
int i;
String tmp;
__int64 size;
TListItem *tmpItem;
for (i = 0; i <ItemsCount ; i++ )
{
tmp = ExplorerDragDrop->Items->Strings[i];
tmp = Trim(tmp);
if (DirectoryExists(tmp))
{
if ( tmp[tmp.Length()] != '\\' )
tmp = tmp + '\\';
clBox->Items->Add();
tmpItem = clBox->Items->Item[clBox->Items->Count-1];
size = mcdb->GetDirSize(tmp);
tmpItem->SubItems->Add(tmp);
tmpItem->SubItems->Add(FormatFloat("#,##", size));
tmpItem->Checked = true;
}
else
{
clBox->Items->Add();
tmpItem = clBox->Items->Item[clBox->Items->Count-1];
size = mcdb->GetDirSize(tmp);
tmpItem->SubItems->Add(tmp);
tmpItem->SubItems->Add(FormatFloat("#,##", size));
}
}
}
/*******************************************************************************
Function Remove1Click(TObject *Sender)
Description = Removes the Selected File or Directory From The List
of files & directories.
*******************************************************************************/
void __fastcall TForm1::Remove1Click(TObject *Sender)
{
if (clBox->Selected != NULL)
{
clBox->Selected->Delete();
}
}
/*******************************************************************************
Function mcdbAddFile
Description = Add The Selected File
*******************************************************************************/
void __fastcall TForm1::mcdbAddFile(TObject *Sender,
const AnsiString FullPath, AnsiString &LongFileName,
AnsiString &ShortFileName, TDateTime &DateTime, int Attr,
__int64 FileSize, bool &Skip)
{
if ( FullPath != "" )
{
try
{
TFileStream *fs = new TFileStream(FullPath, fmOpenRead+fmShareDenyNone);
fs->Free();
}
catch(...)
{
mcdb->DebugMsg(">>> SKIPING; FILE IS IN USE "+ FullPath, 0);
}
}
if ( LongFileName.Length() > 107 )
{
mcdb->DebugMsg(">>> SKIPING; FILE NAME LENGTH > 107 "+ FullPath, 0);
Skip = true;
}
if (!(Skip))
{
lSize->Caption = FormatFloat("#,##0.00", (mcdb->FilesSize) / (1024 * 1024))+" MB";
}
}
/*******************************************************************************
Function BurnISOClick
Description = Burn the
*******************************************************************************/
void __fastcall TForm1::bBurnISOClick(TObject *Sender)
{
unsigned int a,b;
if (od->Execute())
{
mcdb->ReadBufferCapacity(a, b);
pHBuf->Max = a;
bAbort->Visible = true;
Timer1->Enabled = true;
mcdb->DebugMsg(">>> STARTING BURN .ISO IMAGE ON " + mcdb->Device, 0);
pTop->Enabled = false;
pTop2->Enabled = false;
bSaveISO->Enabled = false;
bBurnISO->Enabled = false;
DriveCB->Enabled = false;
Timer1->Enabled = true;
mcdb->BurnISOImage(od->FileName);
pcd->Max = mcdb->ImageSize;
}
}
/*******************************************************************************
Function cPathInfoClick
Description = Path Info Click
*******************************************************************************/
void __fastcall TForm1::cPathInfoClick(TObject *Sender)
{
TIniFile *ini;
ini = new TIniFile( "MCDB.ini" );
String state;
if (Form1->cPathInfo->State == cbChecked)
state = "Checked";
else if (Form1->cPathInfo->State == cbGrayed)
state = "Grayed";
else
state = "Unchecked";
ini->WriteString("Options", "SavePath", state);
delete ini;
}
/*******************************************************************************
Function clBoxEditing
Description = Dont allow the editing of the Files and Directories.
********************************************************************************
*/
void __fastcall TForm1::clBoxEditing(TObject *Sender, TListItem *Item,
bool &AllowEdit)
{
AllowEdit = false;
}
/*******************************************************************************
Function bNetworkClick()
Description = Get the Complete Network path
*******************************************************************************/
void __fastcall TForm1::bNetworkClick(TObject *Sender)
{
String str;
if (InputQuery("Network Path","Enter Complete Network path (\\Machine1\C)", str) )
{
lbDir->Directory = str;
}
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
bBurn->Enabled = true;
}
/*******************************************************************************
Function Advance Click
Description = Sets the advance and configuration Settings of the
Burner Server.
*******************************************************************************/
void __fastcall TForm1::bAdvanceClick(TObject *Sender)
{
frmSettings = new TfrmSettings(this);
frmSettings->cEject->Checked = ccEject;
frmSettings->cShowFiles->Checked = ccShowFiles;
frmSettings->cImportSession->Checked = ccImportSession;
frmSettings->ShowModal();
}
void __fastcall TForm1::mcdbDebugMessage(TObject *Sender,
AnsiString Message, BYTE mType)
{
Memo1->Lines->Add(Message);
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -