/// <summary> /// Rename the filename, this does not set the fileid for all the qb types /// </summary> /// <param name="qbFilename">Source full filename.</param> /// <param name="newFullQbFilename">Full QB filename</param> /// <param name="fileType">.qb or .sqb=QB, .mqb=mid, .img=img .dbg=dbg etc</param> /// <param name="extension">.qb.ngc for Wii for example</param> public void RenameFile(string qbFilename, string newQbFilename, QbKey itemType) { PakHeaderItem phi = _pakHeaders[qbFilename.ToLower()]; phi.SetFilename(newQbFilename, itemType, _pakFormat.FileExtension, phi); using (BinaryEndianWriter bw = new BinaryEndianWriter(File.OpenWrite(_pakFormat.FullPakFilename))) { bw.BaseStream.Seek(phi.HeaderStart, SeekOrigin.Begin); writeHeaderItem(bw, phi); } //update the filename in the collection Dictionary <string, PakHeaderItem> p = new Dictionary <string, PakHeaderItem>(_pakHeaders.Count); foreach (PakHeaderItem ph in _pakHeaders.Values) { p.Add(ph.Filename.ToLower(), ph); } _pakHeaders = p; if (phi.PakFileType == PakItemType.Qb || phi.PakFileType == PakItemType.Sqb || phi.PakFileType == PakItemType.Midi) { try { QbFile qbf = ReadQbFile(newQbFilename); qbf.SetNewFileId(); ReplaceFile(newQbFilename, qbf); } catch { } } }