在磁盘中创建一个文件夹,然后使用IMAPI 2刻录到该文件夹​​中 [英] Create a folder in disk and Burn Into it using IMAPI 2

查看:246
本文介绍了在磁盘中创建一个文件夹,然后使用IMAPI 2刻录到该文件夹​​中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在C#中使用IMAPI2将文件列表刻录到多会话磁盘.但是我希望能够将这些文件刻录到磁盘中的目录中. 现在,这就是我所拥有的

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.

我正在使用此C#IMAPI2包装程序的稍作修改的版本来实现此

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

推荐答案

,您可以使用方法对其进行检索IFsiDirectoryItem :: get_Item 方法.

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.

例如:代替

rootItem.AddTree(sourceDirectory,includeBaseDirectory);

替换为:

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

您可以创建多个目录级别(只需在适当的目录项而不是rootItem上调用AddDirectory).

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

此外,如果目录已经存在,则可能要重用光学介质上的现有目录.可以通过考虑在尝试获取目录时返回的错误IMAPI_E_DUP_NAME((HRESULT)0xC0AAB112L)来实现此目的...

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...

这篇关于在磁盘中创建一个文件夹,然后使用IMAPI 2刻录到该文件夹​​中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆