Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit iso file with discutils

Tags:

c#

.net

iso

I'm trying to modify an existing iso file by adding files using discutils. So far I've tried CDBuilder but that only allows creating an iso file. CDReader can open the file and I can enumerate the contents but I can't find a way of adding files.

Can anyone point me in the right direction?

Edit: There's a CDReader class that can be used to open an existing .iso file. Once open, you can enumerate the contents should you wish to extract files, but there is no clear method for adding a file. e.g.

using (FileStream fs = File.Open(imageFilePath, FileMode.Open))
{                    
    CDReader cd = new CDReader(fs, true, true);
    foreach (var dir in cd.Root.GetDirectories())
    {
        Console.WriteLine(dir.Name);
    }
}

There is also a CDBuilder class which is used to build .iso files from scratch, but it cannot be used to open an existing .iso file. Yes I could create a temporary copy of the .iso image as CDBuilder object but I that would consume a lot of memory especially when adding a large number of files. Can the discutils library be used for this purpose?

Thanks

like image 329
megamania Avatar asked Jun 02 '14 23:06

megamania


1 Answers

.NET DiscUtils only supports reading or creating ISO files. Modifying is not supported yet. And yes, the only way for you is to recreate ISO from existing with DiskUtils.

like image 113
viteo Avatar answered Sep 17 '22 12:09

viteo