scripts
This commit is contained in:
@@ -0,0 +1,235 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
// Token: 0x02000003 RID: 3
|
||||
public sealed class ByteString : IEnumerable<byte>, IEnumerable, IEquatable<ByteString>
|
||||
{
|
||||
// Token: 0x06000003 RID: 3 RVA: 0x000020BD File Offset: 0x000002BD
|
||||
internal static ByteString AttachBytes(byte[] bytes)
|
||||
{
|
||||
return new ByteString(bytes);
|
||||
}
|
||||
|
||||
// Token: 0x06000004 RID: 4 RVA: 0x000020C5 File Offset: 0x000002C5
|
||||
private ByteString(byte[] bytes)
|
||||
{
|
||||
this.bytes = bytes;
|
||||
}
|
||||
|
||||
// Token: 0x17000001 RID: 1
|
||||
// (get) Token: 0x06000005 RID: 5 RVA: 0x000020D4 File Offset: 0x000002D4
|
||||
public static ByteString Empty
|
||||
{
|
||||
get
|
||||
{
|
||||
return ByteString.empty;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000002 RID: 2
|
||||
// (get) Token: 0x06000006 RID: 6 RVA: 0x000020DB File Offset: 0x000002DB
|
||||
public int Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bytes.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000003 RID: 3
|
||||
// (get) Token: 0x06000007 RID: 7 RVA: 0x000020E5 File Offset: 0x000002E5
|
||||
public bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Length == 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000008 RID: 8 RVA: 0x000020F0 File Offset: 0x000002F0
|
||||
public byte[] ToByteArray()
|
||||
{
|
||||
return (byte[])this.bytes.Clone();
|
||||
}
|
||||
|
||||
// Token: 0x06000009 RID: 9 RVA: 0x00002102 File Offset: 0x00000302
|
||||
public string ToBase64()
|
||||
{
|
||||
return Convert.ToBase64String(this.bytes);
|
||||
}
|
||||
|
||||
// Token: 0x0600000A RID: 10 RVA: 0x0000210F File Offset: 0x0000030F
|
||||
public static ByteString FromBase64(string bytes)
|
||||
{
|
||||
if (!(bytes == ""))
|
||||
{
|
||||
return new ByteString(Convert.FromBase64String(bytes));
|
||||
}
|
||||
return ByteString.Empty;
|
||||
}
|
||||
|
||||
// Token: 0x0600000B RID: 11 RVA: 0x0000212F File Offset: 0x0000032F
|
||||
public static ByteString CopyFrom(params byte[] bytes)
|
||||
{
|
||||
return new ByteString((byte[])bytes.Clone());
|
||||
}
|
||||
|
||||
// Token: 0x0600000C RID: 12 RVA: 0x00002144 File Offset: 0x00000344
|
||||
public static ByteString CopyFrom(byte[] bytes, int offset, int count)
|
||||
{
|
||||
byte[] array = new byte[count];
|
||||
ByteArray.Copy(bytes, offset, array, 0, count);
|
||||
return new ByteString(array);
|
||||
}
|
||||
|
||||
// Token: 0x0600000D RID: 13 RVA: 0x00002168 File Offset: 0x00000368
|
||||
public static ByteString CopyFrom(string text, Encoding encoding)
|
||||
{
|
||||
return new ByteString(encoding.GetBytes(text));
|
||||
}
|
||||
|
||||
// Token: 0x0600000E RID: 14 RVA: 0x00002176 File Offset: 0x00000376
|
||||
public static ByteString CopyFromUtf8(string text)
|
||||
{
|
||||
return ByteString.CopyFrom(text, Encoding.UTF8);
|
||||
}
|
||||
|
||||
// Token: 0x17000004 RID: 4
|
||||
public byte this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bytes[index];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000010 RID: 16 RVA: 0x0000218D File Offset: 0x0000038D
|
||||
public string ToString(Encoding encoding)
|
||||
{
|
||||
return encoding.GetString(this.bytes, 0, this.bytes.Length);
|
||||
}
|
||||
|
||||
// Token: 0x06000011 RID: 17 RVA: 0x000021A4 File Offset: 0x000003A4
|
||||
public string ToStringUtf8()
|
||||
{
|
||||
return this.ToString(Encoding.UTF8);
|
||||
}
|
||||
|
||||
// Token: 0x06000012 RID: 18 RVA: 0x000021B1 File Offset: 0x000003B1
|
||||
public IEnumerator<byte> GetEnumerator()
|
||||
{
|
||||
return ((IEnumerable<byte>)this.bytes).GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x06000013 RID: 19 RVA: 0x000021BE File Offset: 0x000003BE
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return this.GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x06000014 RID: 20 RVA: 0x000021C6 File Offset: 0x000003C6
|
||||
public CodedInputStream CreateCodedInput()
|
||||
{
|
||||
return new CodedInputStream(this.bytes);
|
||||
}
|
||||
|
||||
// Token: 0x06000015 RID: 21 RVA: 0x000021D4 File Offset: 0x000003D4
|
||||
public static bool operator ==(ByteString lhs, ByteString rhs)
|
||||
{
|
||||
if (lhs == rhs)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (lhs == null || rhs == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (lhs.bytes.Length != rhs.bytes.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < lhs.Length; i++)
|
||||
{
|
||||
if (rhs.bytes[i] != lhs.bytes[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x06000016 RID: 22 RVA: 0x00002229 File Offset: 0x00000429
|
||||
public static bool operator !=(ByteString lhs, ByteString rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
// Token: 0x06000017 RID: 23 RVA: 0x00002235 File Offset: 0x00000435
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return this == obj as ByteString;
|
||||
}
|
||||
|
||||
// Token: 0x06000018 RID: 24 RVA: 0x00002244 File Offset: 0x00000444
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int num = 23;
|
||||
foreach (byte b in this.bytes)
|
||||
{
|
||||
num = (num << 8) | (int)b;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06000019 RID: 25 RVA: 0x00002274 File Offset: 0x00000474
|
||||
public bool Equals(ByteString other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
// Token: 0x0600001A RID: 26 RVA: 0x0000227D File Offset: 0x0000047D
|
||||
internal void WriteRawBytesTo(CodedOutputStream outputStream)
|
||||
{
|
||||
outputStream.WriteRawBytes(this.bytes, 0, this.bytes.Length);
|
||||
}
|
||||
|
||||
// Token: 0x0600001B RID: 27 RVA: 0x00002294 File Offset: 0x00000494
|
||||
public void CopyTo(byte[] array, int position)
|
||||
{
|
||||
ByteArray.Copy(this.bytes, 0, array, position, this.bytes.Length);
|
||||
}
|
||||
|
||||
// Token: 0x0600001C RID: 28 RVA: 0x000022AC File Offset: 0x000004AC
|
||||
public void WriteTo(Stream outputStream)
|
||||
{
|
||||
outputStream.Write(this.bytes, 0, this.bytes.Length);
|
||||
}
|
||||
|
||||
// Token: 0x04000002 RID: 2
|
||||
private static readonly ByteString empty = new ByteString(new byte[0]);
|
||||
|
||||
// Token: 0x04000003 RID: 3
|
||||
private readonly byte[] bytes;
|
||||
|
||||
// Token: 0x02000073 RID: 115
|
||||
internal static class Unsafe
|
||||
{
|
||||
// Token: 0x0600066F RID: 1647 RVA: 0x000020BD File Offset: 0x000002BD
|
||||
internal static ByteString FromBytes(byte[] bytes)
|
||||
{
|
||||
return new ByteString(bytes);
|
||||
}
|
||||
|
||||
// Token: 0x06000670 RID: 1648 RVA: 0x00016260 File Offset: 0x00014460
|
||||
internal static byte[] GetBuffer(ByteString bytes)
|
||||
{
|
||||
return bytes.bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user