initial commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
|
||||
namespace PureCrack.Wire;
|
||||
|
||||
public sealed class ProtoValue
|
||||
{
|
||||
public ProtoWire Wire { get; }
|
||||
|
||||
public byte[] Bytes { get; }
|
||||
|
||||
public ulong Number { get; }
|
||||
|
||||
private ProtoValue(ProtoWire wire, byte[] bytes, ulong number)
|
||||
{
|
||||
Wire = wire;
|
||||
Bytes = bytes;
|
||||
Number = number;
|
||||
}
|
||||
|
||||
public static ProtoValue OfVarint(ulong v)
|
||||
{
|
||||
return new ProtoValue(ProtoWire.Varint, Array.Empty<byte>(), v);
|
||||
}
|
||||
|
||||
public static ProtoValue OfBytes(byte[] b)
|
||||
{
|
||||
return new ProtoValue(ProtoWire.Bytes, b, 0uL);
|
||||
}
|
||||
|
||||
public static ProtoValue OfFixed64(ulong v)
|
||||
{
|
||||
return new ProtoValue(ProtoWire.Fixed64, Array.Empty<byte>(), v);
|
||||
}
|
||||
|
||||
public static ProtoValue OfFixed32(uint v)
|
||||
{
|
||||
return new ProtoValue(ProtoWire.Fixed32, Array.Empty<byte>(), v);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user