DecompressAll() public static method

Decompiles LZSS. You have to know the OutputSize.
public static DecompressAll ( byte data, uint fileSize, int size ) : byte[]
data byte buffer
fileSize uint Original filesize of compressed file
size int Filesize of final file
return byte[]
コード例 #1
0
        /// <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);
        }
コード例 #2
0
        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);
        }