简化代码

pull/567/head
YFdyh000 2020-03-16 09:35:30 +08:00
parent 6293ddacc6
commit af71eed96e
1 changed files with 6 additions and 13 deletions

View File

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