private byte[] getPadding(long size) { using (MemoryStream ms = new MemoryStream()) { long paddingSize = PSVIMGPadding.GetPadding(size); if (paddingSize != 0) { writePadding(ms, 0x2B, paddingSize - PSVIMGConstants.PSVIMG_PADDING_END.Length); DataUtils.WriteString(ms, PSVIMGConstants.PSVIMG_PADDING_END); } ms.Seek(0x00, SeekOrigin.Begin); return(ms.ToArray()); } }
private void findFile(string path) { _seek(0x00, SeekOrigin.Begin); while (psvStream.Position < psvStream.Length) { PsvImgHeader header = readHeader(); long size = (long)header.Statistics.Size; long padding = PSVIMGPadding.GetPadding(size); if (header.Path == path) { length = size; startPos = psvStream.Position; endPos = startPos + length; return; } else { _seek(size + padding, SeekOrigin.Current); PsvImgTailer tailer = readTailer(); } } throw new FileNotFoundException("Cannot find file specified"); }