-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
208 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
using System; | ||
using System.Text; | ||
|
||
namespace ValveKeyValue | ||
{ | ||
public class KVBinaryBlob : KVValue | ||
{ | ||
public byte[] Bytes { get; } | ||
|
||
public override KVValueType ValueType => KVValueType.BinaryBlob; | ||
|
||
public KVBinaryBlob(byte[] value) | ||
{ | ||
Bytes = value; | ||
} | ||
|
||
#region IConvertible | ||
|
||
public override TypeCode GetTypeCode() | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override bool ToBoolean(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override byte ToByte(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override char ToChar(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override DateTime ToDateTime(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override decimal ToDecimal(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override double ToDouble(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override short ToInt16(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override int ToInt32(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override long ToInt64(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override sbyte ToSByte(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override float ToSingle(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override string ToString(IFormatProvider provider) | ||
=> ToString(); | ||
|
||
public override object ToType(Type conversionType, IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override ushort ToUInt16(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override uint ToUInt32(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override ulong ToUInt64(IFormatProvider provider) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
#endregion | ||
|
||
public override string ToString() | ||
{ | ||
var builder = new StringBuilder(); | ||
|
||
foreach (var oneByte in Bytes) | ||
{ | ||
builder.Append(oneByte.ToString("X2")); | ||
builder.Append(' '); | ||
} | ||
|
||
// Remove final space | ||
if (builder.Length > 1) | ||
{ | ||
builder.Length -= 1; | ||
} | ||
|
||
return builder.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters