public void Extract(BundleFileExtractArgs e) { var fullpath = e.FileName; var isPng = Path.GetExtension(fullpath) == ".png"; fullpath = Path.ChangeExtension(fullpath, "dds"); Directory.CreateDirectory(Path.GetDirectoryName(fullpath) ?? ""); if (File.Exists(fullpath)) { File.Delete(fullpath); } using (var output = new FileStream(fullpath, FileMode.CreateNew, FileAccess.Write)) { Extract(output); } // convert all dds files to the extension specified in the settings // also convert "pngs" to pngs lol if (e.Extension != EUncookExtension.dds || isPng) { //convert var fi = new FileInfo(fullpath); if (fi.Exists) { // convert to png if file is a png, else convert to custom extension Texconv.Convert(Path.GetDirectoryName(fullpath), fullpath, isPng ? EUncookExtension.png : e.Extension); } // delete old DDS fi.Delete(); } }
public string Extract(BundleFileExtractArgs e) { var filename = e.FileName; switch (Comtype) { case 1: filename = Path.ChangeExtension(filename, "bin"); break; case 2: case 5: filename = Path.ChangeExtension(filename, "nxs"); break; case 3: case 4: filename = Path.ChangeExtension(filename, "apb"); break; default: break; } Directory.CreateDirectory(Path.GetDirectoryName(filename) ?? ""); using (var output = new FileStream(filename, FileMode.Create, FileAccess.Write)) { Extract(output); } return(filename); }
public void Extract(BundleFileExtractArgs e) { var fullpath = e.FileName; fullpath = Path.ChangeExtension(fullpath, "dds"); Directory.CreateDirectory(Path.GetDirectoryName(fullpath) ?? ""); if (File.Exists(fullpath)) { File.Delete(fullpath); } using (var output = new FileStream(fullpath, FileMode.CreateNew, FileAccess.Write)) { Extract(output); } if (e.Extension != EUncookExtension.dds) { //convert var fi = new FileInfo(fullpath); if (fi.Exists) { Texconv.Convert(Path.GetDirectoryName(fullpath), fullpath, e.Extension); } // delete old DDS fi.Delete(); } }
public string Extract(BundleFileExtractArgs e) { var newpath = Path.ChangeExtension(e.FileName, "dds"); var ext = Path.GetExtension(e.FileName); // create new directory and delete existing file Directory.CreateDirectory(Path.GetDirectoryName(newpath) ?? ""); if (File.Exists(newpath)) { File.Delete(newpath); } // extract to dds using (var output = new FileStream(newpath, FileMode.Create, FileAccess.Write)) { Extract(output); } // don't convert if user extract extension is already dds if (e.Extension == EUncookExtension.dds) { return(newpath); } // don't convert w2cube cubemaps if (ext == ".w2cube") { return(newpath); } var extractext = e.Extension; // do not convert pngs, jpgs and dds if (!(ext == ".dds" || ext == ".w2l")) { switch (ext) { case ".png": extractext = EUncookExtension.png; break; case ".jpg": extractext = EUncookExtension.jpg; break; } //convert var fi = new FileInfo(newpath); if (fi.Exists) { TexconvWrapper.Convert(Path.GetDirectoryName(newpath), newpath, (Common.Tools.DDS.EUncookExtension)extractext); } // delete old DDS fi.Delete(); } return(newpath); }
public void Extract(BundleFileExtractArgs e) { using (var output = new FileStream(e.FileName, FileMode.CreateNew, FileAccess.Write)) { Extract(output); output.Close(); } }
public void Extract(BundleFileExtractArgs e) { PageOFfset = cr2w_offs; ZSize = cr2w_size; Extract(new FileStream(Path.ChangeExtension(e.FileName, ".cr2w"), FileMode.Create)); PageOFfset = wem_offs; ZSize = wem_size; Extract(new FileStream(Path.ChangeExtension(e.FileName, ".wem"), FileMode.Create)); }
public string Extract(BundleFileExtractArgs e) { // create new directory and delete existing file Directory.CreateDirectory(Path.GetDirectoryName(e.FileName) ?? ""); if (File.Exists(e.FileName)) { File.Delete(e.FileName); } using (var output = new FileStream(e.FileName, FileMode.Create, FileAccess.Write)) { Extract(output); output.Close(); } return(e.FileName); }