C++
[C#](Creating Audio CDs using IMAPI2 - CodeProject)
imapi2
Imapi2可以在Windows7上穩(wěn)定運(yùn)行,但是在Windows10上運(yùn)行在續(xù)刻的時(shí)候總會(huì)出現(xiàn)錯(cuò)誤,原因暫時(shí)還未查明
提供可覆寫(xiě)功能
// 增加文件內(nèi)容,可覆蓋刻錄
public bool AddToOverrideFileSystem(IFsiDirectoryItem rootItem, MsftFileSystemImage fileSystem, string path)
{
IStream stream = null;
path += $"\\{displayName}";
try
{
Win32.SHCreateStreamOnFile(filePath, Win32.STGM_READ | Win32.STGM_SHARE_DENY_WRITE, ref stream);
rootItem.AddFile(path, stream);
return true;
}
catch(Exception ex)
{
Console.WriteLine($"增添文件失敗.{ex.Message}");
}
finally
{
if (stream != null)
{
Marshal.FinalReleaseComObject(stream);
}
}
return false;
}
// DirectoryItem
// 遞歸增加文件夾與文件
public bool AddToOverrideFileSystem(IFsiDirectoryItem rootItem, MsftFileSystemImage fileSystem,string path)
{
path += $"\\{displayName}";
if (fileSystem.Exists(path) == FsiItemType.FsiItemNotFound)
{
rootItem.AddDirectory(path);
}
foreach (var item in mediaItems)
{
item.AddToOverrideFileSystem(rootItem, fileSystem, path);
}
return true;
}