SHARE
TWEET

Untitled

a guest Jul 18th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static FSARFile GetFile(this FSARFileEntryInfo FileEntry, Byte[] FilesData)
  2.         {
  3.             FSARFile CurFile = new FSARFile();
  4.             CurFile.FileHeader = FileEntry;
  5.             CurFile.UncompressedData = new Byte[FileEntry.UncompressedSize];
  6.            
  7.             if(FileEntry.Compressed)
  8.             {
  9.                 CurFile.CompressedData = new Byte[FileEntry.CompressedSize - 2];
  10.                 Array.Copy(FilesData, (int) FileEntry.DataPos + 2, CurFile.CompressedData, 0, CurFile.CompressedData.Length);
  11.                 MemoryStream WeirdShit = new MemoryStream(CurFile.CompressedData);
  12.                 MemoryStream WS2 = new MemoryStream();
  13.                 DeflateStream DecompFile = new DeflateStream(WeirdShit, CompressionMode.Decompress);
  14.                 DecompFile.CopyTo(WS2);
  15.                 CurFile.UncompressedData = WS2.ToArray();
  16.             }
  17.             else
  18.             {
  19.                 Array.Copy(FilesData, (int) FileEntry.DataPos, CurFile.UncompressedData, 0, (int) FileEntry.UncompressedSize);
  20.             }
  21.             return CurFile;
  22.         }
  23.         public static FSARFile GetFile(Byte[] FilesData, FSARFileEntryInfo FileEntry)
  24.         {
  25.             FSARFile CurFile = new FSARFile();
  26.             CurFile.FileHeader = FileEntry;
  27.             CurFile.UncompressedData = new Byte[FileEntry.UncompressedSize];
  28.            
  29.             if(FileEntry.Compressed)
  30.             {
  31.                 CurFile.CompressedData = new Byte[FileEntry.CompressedSize - 2];
  32.                 Array.Copy(FilesData, (int) FileEntry.DataPos + 2, CurFile.CompressedData, 0, CurFile.CompressedData.Length);
  33.                 MemoryStream CompressedData = new MemoryStream(CurFile.CompressedData);
  34.                 MemoryStream DecompressedData = new MemoryStream();
  35.                 DeflateStream DecompFile = new DeflateStream(CompressedData, CompressionMode.Decompress);
  36.                 DecompFile.CopyTo(DecompressedData);
  37.                 CurFile.UncompressedData = DecompressedData.ToArray();
  38.  
  39.                 DecompressedData.Close();
  40.                 DecompFile.Close();
  41.                 CompressedData.Close();
  42.             }
  43.             else
  44.             {
  45.                 Array.Copy(FilesData, (int) FileEntry.DataPos, CurFile.UncompressedData, 0, (int) FileEntry.UncompressedSize);
  46.             }
  47.             return CurFile;
  48.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top