Question

I'm using IMAPI2 in C# to burn a list of files to a multisession disk. But I want To be able to burn those files into a directory in the disk. Right now this is what I have

fileSystemImage = new MsftFileSystemImage();
            fileSystemImage.ChooseImageDefaults(discRecorder);
            fileSystemImage.FileSystemsToCreate =
            FsiFileSystems.FsiFileSystemJoliet | FsiFileSystems.FsiFileSystemISO9660;
if (multisessionInterfaces != null)
            {
                fileSystemImage.MultisessionInterfaces = multisessionInterfaces;
                fileSystemImage.ImportFileSystem();
            }
IFsiDirectoryItem rootItem = fileSystemImage.Root;
rootItem.AddTree(sourceDirectory,includeBaseDirectory)

This is a round about method because I have to create a temporary folder in my drive and copy all the files I want to burn into that folder and add that folder as the burn item.

I'm Using a slightly modified version of this C# IMAPI2 wrapper to implement this http://www.codeproject.com/Articles/24544/Burning-and-Erasing-CD-DVD-Blu-ray-Media-with-C-an

Was it helpful?

Solution

you can use the method IFsiDirectoryItem::AddDirectory of the IFsiDirectoryItem interface to add a directory to the file system image on the optical media; and after that, retrieve it with IFsiDirectoryItem::get_Item method.

For example: Instead of

rootItem.AddTree(sourceDirectory,includeBaseDirectory);

Replace with something like:

rootItem.AddDirectory(directoryName);
rootItem.get_Item(directoryName, newDirItem);   

You can create multiple directory levels (just call AddDirectory on the appropriate directory item instead of rootItem).

Also, you may want to reuse existing directories on optical media if the directories already exist. You can do that by taking into account the error IMAPI_E_DUP_NAME ((HRESULT)0xC0AAB112L) returned when trying to get the directory...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top