public void Rebuild() { sio.FileStream fs; sio.FileInfo fi; foreach (var item in items) { fi = new sio.FileInfo(imlPath + item.file); if (!fi.Exists) { throw new sio.FileNotFoundException(string.Format("File '{0}' not found", fi.FullName)); } if (fi.Length > item.length) { throw new ArgumentException(string.Format("File '{0}' is bigger than defined in iml", fi.FullName)); } } fs = new sio.FileStream(isoPath, sio.FileMode.Create, sio.FileAccess.Write); Console.WriteLine("Rebuilding image '{0}'", isoPath); foreach (var item in items) { fs.Position = item.start; Console.WriteLine("Importing file '{0}'", item.file); fs.Insert(imlPath + item.file, 0); } fs.Close(); Console.WriteLine("Done"); }
public void Rebuild() { sio.FileStream fs; sio.FileInfo fi; foreach (var item in items) { fi = new sio.FileInfo(imlPath + item.file); if (!fi.Exists) throw new sio.FileNotFoundException(string.Format("File '{0}' not found", fi.FullName)); if (fi.Length > item.length) throw new ArgumentException(string.Format("File '{0}' is bigger than defined in iml", fi.FullName)); } fs = new sio.FileStream(isoPath, sio.FileMode.Create, sio.FileAccess.Write); Console.WriteLine("Rebuilding image '{0}'", isoPath); foreach (var item in items) { fs.Position = item.start; Console.WriteLine("Importing file '{0}'", item.file); fs.Insert(imlPath + item.file, 0); } fs.Close(); Console.WriteLine("Done"); }
public void RebuildPartition(string newIsoPath) { sio.FileStream fs; sio.FileInfo fi; Console.WriteLine("Rebuilding"); fs = new sio.FileStream(newIsoPath, sio.FileMode.Create, sio.FileAccess.Write); fi = new sio.FileInfo(rebPath + "partition.hdr"); if (fi.Exists) { fs.Insert(fi.FullName, logSize); fsOffLog = (int)(fs.Position / logSize); } else fsOffLog = 0; fsOff = fsOffLog * logSize; fs.Position = (fsOffLog + fsStart) * logSize; partition.Save(fs); fs.Flush(); partition.ImportAll(fs, rebPath); fs.Close(); }