/// <summary> /// Give me three archives as bytes uncompressed please! /// </summary> /// <param name="FI">FileIndex</param> /// <param name="FS">FileSystem</param> /// <param name="FL">FileList</param> /// <param name="filename">Filename of the file to get</param> /// <returns></returns> public static byte[] FileInTwoArchives(byte[] FI, byte[] FS, byte[] FL, string filename) { string a = @"C:\ff8\data\eng\" + filename; string flText = System.Text.Encoding.UTF8.GetString(FL); flText = flText.Replace(Convert.ToString(0x0d), ""); int loc = -1; string[] files = flText.Split((char)0x0a); for (int i = 0; i != files.Length - 1; i++) { string testme = files[i].Substring(0, files[i].Length - 1).ToUpper(); if (testme != a.ToUpper()) { continue; } loc = i; break; } if (loc == -1) { throw new Exception("ArchiveWorker: No such file!"); } uint fsLen = BitConverter.ToUInt32(FI, loc * 12); uint fSpos = BitConverter.ToUInt32(FI, (loc * 12) + 4); bool compe = BitConverter.ToUInt32(FI, (loc * 12) + 8) != 0; byte[] file = new byte[BitConverter.ToUInt32(FS, (int)fSpos) + 4]; Array.Copy(FS, fSpos, file, 0, file.Length); return(compe ? LZSS.DecompressAll(file, (uint)file.Length, (int)fsLen) : file); }
public static byte[] GetBinaryFile(string archiveName, string fileName) { string a = /*@"C:\ff8\data\eng\" + */ fileName; byte[] isComp = GetBin(archiveName, a); return(_compressed ? LZSS.DecompressAll(isComp, (uint)isComp.Length, (int)_unpackedFileSize) : isComp); }