blob: 6ad43d3823fc16463c257f31eba13359d3790ef0 (
plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
using System;
using System.IO;
using System.Text;
namespace Ionic.Zlib
{
internal class SharedUtils
{
public static int URShift(int number, int bits)
{
return (int)((uint)number >> bits);
}
public static int ReadInput(TextReader sourceTextReader, byte[] target, int start, int count)
{
bool flag = target.Length == 0;
int result;
if (flag)
{
result = 0;
}
else
{
char[] array = new char[target.Length];
int num = sourceTextReader.Read(array, start, count);
bool flag2 = num == 0;
if (flag2)
{
result = -1;
}
else
{
for (int i = start; i < start + num; i++)
{
target[i] = (byte)array[i];
}
result = num;
}
}
return result;
}
internal static byte[] ToByteArray(string sourceString)
{
return Encoding.UTF8.GetBytes(sourceString);
}
internal static char[] ToCharArray(byte[] byteArray)
{
return Encoding.UTF8.GetChars(byteArray);
}
}
}
|