-
Notifications
You must be signed in to change notification settings - Fork 2
/
Brotli.cs
29 lines (28 loc) · 896 Bytes
/
Brotli.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UmamusumeDeserializeDB5
{
public static class Brotli
{
public static byte[] Compress(byte[] input)
{
using var source = new MemoryStream(input);
using var dest = new MemoryStream();
using (var brotli = new BrotliStream(dest, (CompressionLevel)11))
source.CopyTo(brotli);
return dest.ToArray();
}
public static byte[] Decompress(byte[] input)
{
using var source = new MemoryStream(input);
using var dest = new MemoryStream();
using (var brotli = new BrotliStream(source, CompressionMode.Decompress))
brotli.CopyTo(dest);
return dest.ToArray();
}
}
}