Files/Folders in C#

vbimport

#1

Hi everybody,

q1:
running my code below, i always get the last 2 folders burned on cdrom. All i want to do, is to burn my 4 folders (images, web, html, sonst), files included to the rootfolder. Just before burning (…nDrive.BurnIsoAudioCD( )…) the value of “nRootFolder.Folders.Count”=4.

q2:
in spite of my flag: ‘flags = flags | NERO_BURN_FLAGS.NERO_BURN_FLAG_CLOSE_SESSION;’ the cdrom is not closed and more sessions can be burned onto???

thanks Oliver
public void AddAllShowFolders(string sRoot)
{
AddAllFilesOfFolder(nRootFolder, sRoot);

NeroFolder fo = new NeroFolderClass();
fo.Name = "html";
AddAllFilesOfFolder(fo, sRoot+@"\html");
nRootFolder.Folders.Add(fo);			

fo = new NeroFolderClass();
fo.Name = "sonst";
AddAllFilesOfFolder(fo, sRoot+@"\sonst");
nRootFolder.Folders.Add(fo);

fo = new NeroFolderClass();
fo.Name = "web";
AddAllFilesOfFolder(fo, sRoot+@"\web");
nRootFolder.Folders.Add(fo);

fo = new NeroFolderClass();
fo.Name = "images";
AddAllFilesOfFolder(fo, sRoot+@"\images");
nRootFolder.Folders.Add(fo);

}

private void AddAllFilesOfFolder(NeroFolder fo, string sFolder)
{
DirectoryInfo di = new DirectoryInfo(sFolder);
foreach(FileInfo fi in di.GetFiles())
{
NeroFile newFile = new NeroFileClass();
newFile.Name = fi.Name;
newFile.SourceFilePath = fi.FullName;
fo.Files.Add(newFile);
}
di = null;
}

public void Burn(NERO_MEDIA_TYPE mediaType)
{
nISOTrack.RootFolder = nRootFolder;
nType = mediaType;

//adding handler 
nDrive.OnDoneBurn			+= new   NeroDriveEvents_OnDoneBurnEventHandler(OnDoneBurn);
nDrive.OnProgress			+= new _INeroDriveEvents_OnProgressEventHandler(OnProgress);
nDrive.OnDoneWaitForMedia	+= new _INeroDriveEvents_OnDoneWaitForMediaEventHandler(nDrive_OnDoneWaitForMedia);
nDrive.OnAddLogLine			+= new _INeroDriveEvents_OnAddLogLineEventHandler(nDrive_OnAddLogLine);
nDrive.OnSetPhase			+= new _INeroDriveEvents_OnSetPhaseEventHandler(nDrive_OnSetPhase);
nDrive.OnAborted			+= new _INeroDriveEvents_OnAbortedEventHandler(nDrive_OnAborted);
nDrive.OnDoneImport			+= new _INeroDriveEvents_OnDoneImportEventHandler(nDrive_OnDoneImport);
    
nClass.ClearErrors();
nClass.OnFileSelImage		+= new _INeroEvents_OnFileSelImageEventHandler(OnFileSelImage);
nClass.OnMegaFatal			+= new _INeroEvents_OnMegaFatalEventHandler(nClass_OnMegaFatal);
nClass.OnNonEmptyCDRW		+= new _INeroEvents_OnNonEmptyCDRWEventHandler(nClass_OnNonEmptyCDRW);
nClass.OnWaitCD				+= new _INeroEvents_OnWaitCDEventHandler(nClass_OnWaitCD);
nClass.OnWaitCDMediaInfo	+= new _INeroEvents_OnWaitCDMediaInfoEventHandler(nClass_OnWaitCDMediaInfo);
nClass.OnWaitCDReminder		+= new _INeroEvents_OnWaitCDReminderEventHandler(nClass_OnWaitCDReminder);
nClass.OnWaitCDDone			+= new _INeroEvents_OnWaitCDDoneEventHandler(nClass_OnWaitCDDone);
nClass.OnDriveStatusChanged	+= new _INeroEvents_OnDriveStatusChangedEventHandler(nClass_OnDriveStatusChanged);
                                  
icurrentNumber = 0;
     
nISOTrack.BurnOptions = NERO_BURN_OPTIONS.NERO_BURN_OPTION_CREATE_ISO_FS;
nISOTrack.BurnOptions = nISOTrack.BurnOptions | NERO_BURN_OPTIONS.NERO_BURN_OPTION_RELAX_JOLIET;
nISOTrack.BurnOptions = nISOTrack.BurnOptions | NERO_BURN_OPTIONS.NERO_BURN_OPTION_USE_JOLIET;
		
NEROLib.NERO_BURN_FLAGS flags = new NEROLib.NERO_BURN_FLAGS();
flags = flags | NERO_BURN_FLAGS.NERO_BURN_FLAG_CLOSE_SESSION;
flags = flags | NERO_BURN_FLAGS.NERO_BURN_FLAG_BUF_UNDERRUN_PROT;
flags = flags | NERO_BURN_FLAGS.NERO_BURN_FLAG_VERIFY;
flags = flags | NERO_BURN_FLAGS.NERO_BURN_FLAG_DETECT_NON_EMPTY_CDRW;
flags = flags | NERO_BURN_FLAGS.NERO_BURN_FLAG_DISABLE_EJECT;

if (nDrive.DeviceReady)
{
	if (bSimulate)
		nDrive.BurnIsoAudioCD("", "", false, nISOTrack, null, null, flags | NERO_BURN_FLAGS.NERO_BURN_FLAG_SIMULATE, iSpeed, nType); 
	else
		nDrive.BurnIsoAudioCD("", "", false, nISOTrack, null, null, flags | NERO_BURN_FLAGS.NERO_BURN_FLAG_WRITE, iSpeed, nType); 
		
	CleanUp();			
}
else
{
	sErrorMsg = "Drive Error";
}

}


#2

Hi, your second question is simple to answer, the NERO_BURN_FLAG_CLOSE_SESSION is used to prevent the disc been closed - not to close it. i.e. remove the flag to get the functionality you want.

Mike