private void toolStripButton2_Click_1(object sender, EventArgs e) { if (pvdd == null) { MessageBox.Show("load image first"); return; } string dummyFileName = "Save Here"; SaveFileDialog sf = new SaveFileDialog(); sf.FileName = dummyFileName; if (sf.ShowDialog() == DialogResult.OK) { string savePath = Path.GetDirectoryName(sf.FileName); var ret = DirectoryRecord.GetAllRecords(pvdd.RootDir); foreach (var directoryRecord in ret) { throw new NotImplementedException(); //get path ,create dirs, save files //var pp=Path.Combine (path,) } } }
public bool FileExist(string path) { using (var fs = new FileStream(IsoFileInfo.FullName, FileMode.Open, FileAccess.Read)) { IsoReader reader = new IsoReader(); reader.Parse(fs); var ret = DirectoryRecord.GetAllRecords(reader.WorkPvd.RootDir); return(ret.Any(x => x.IsFile && (x.FullPath.ToLower() == path.ToLower() || Path.Combine(mountInfo.MountTarget.FullName, x.FullPath).ToLower() == path.ToLower()))); } }
public IFileInfo GetFile(string path) { using (var fs = new FileStream(IsoFileInfo.FullName, FileMode.Open, FileAccess.Read)) { IsoReader reader = new IsoReader(); reader.Parse(fs); var ret = DirectoryRecord.GetAllRecords(reader.WorkPvd.RootDir); var aa = ret.First(x => x.IsFile && x.FullPath.ToLower() == path.ToLower()); return(new IsoFileWrapper(new MountInfo() { IsoPath = IsoFileInfo }, aa) { Filesystem = this }); } }
public string ReadAllText(string fullName) { using (var fs = new FileStream(IsoFileInfo.FullName, FileMode.Open, FileAccess.Read)) { IsoReader reader = new IsoReader(); reader.Parse(fs); var ret = DirectoryRecord.GetAllRecords(reader.WorkPvd.RootDir); var fr = ret.First(x => x.IsFile && x.FullPath.ToLower() == fullName.ToLower()); var dat = fr.GetFileData(fs, reader.WorkPvd); MemoryStream ms = new MemoryStream(dat); var rdr = new StreamReader(ms); return(rdr.ReadToEnd()); } }
private void isoExtractAction(FileListControl arg1, IFileInfo arg2) { var target = arg1; if (target == fileListControl1) { target = fileListControl2; } else { target = fileListControl1; } using (var fs = new FileStream(arg2.FullName, FileMode.Open, FileAccess.Read)) { IsoReader reader = new IsoReader(); reader.Parse(fs); var pvd = reader.WorkPvd; string savePath = Path.Combine(target.CurrentDirectory.FullName, Path.GetFileNameWithoutExtension(arg2.Name)); if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } var ret = DirectoryRecord.GetAllRecords(pvd.RootDir); foreach (var directoryRecord in ret) { if (!directoryRecord.IsDirectory) { continue; } if (directoryRecord.LBA == pvd.RootDir.LBA) { continue; } if (directoryRecord.Parent != null && directoryRecord.Parent.LBA == directoryRecord.LBA) { continue; } if (directoryRecord.Parent != null && directoryRecord.Parent.Parent != null && directoryRecord.Parent.Parent.LBA == directoryRecord.LBA) { continue; } var pp = Path.Combine(savePath, directoryRecord.FullPath); if (!Directory.Exists(pp)) { Directory.CreateDirectory(pp); } } foreach (var directoryRecord in ret) { if (!directoryRecord.IsFile) { continue; } var data = directoryRecord.GetFileData(fs, pvd); var pp = Path.Combine(savePath, directoryRecord.FullPath); File.WriteAllBytes(pp, data); } Stuff.Info("Extraction complete!"); } }