简化代码

This commit is contained in:
YFdyh000 2020-03-16 09:35:30 +08:00
parent 6293ddacc6
commit af71eed96e

View file

@ -804,22 +804,15 @@ namespace v2rayN
public static string UnGzip(byte[] buf) public static string UnGzip(byte[] buf)
{ {
byte[] buffer = new byte[1024]; MemoryStream sb = new MemoryStream();
int n;
using (MemoryStream sb = new MemoryStream())
{
using (GZipStream input = new GZipStream(new MemoryStream(buf), using (GZipStream input = new GZipStream(new MemoryStream(buf),
CompressionMode.Decompress, CompressionMode.Decompress,
false)) false))
{ {
while ((n = input.Read(buffer, 0, buffer.Length)) > 0) input.CopyTo(sb);
{
sb.Write(buffer, 0, n);
}
} }
return Encoding.UTF8.GetString(sb.ToArray()); return Encoding.UTF8.GetString(sb.ToArray());
} }
}
#endregion #endregion