本文整理汇总了C#中IReadContext类的典型用法代码示例。如果您正苦于以下问题:C# IReadContext类的具体用法?C# IReadContext怎么用?C# IReadContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IReadContext类属于命名空间,在下文中一共展示了IReadContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public override object Read(IReadContext context)
{
var b1 = context.ReadByte();
var b2 = context.ReadByte();
var charValue = (char) ((b1 & unchecked(0xff)) | ((b2 & unchecked(0xff)) << 8));
return charValue;
}
示例2: Read
public override object Read(IReadContext readContext)
{
IInternalReadContext context = (IInternalReadContext)readContext;
int payloadOffset = context.ReadInt();
if (payloadOffset == 0)
{
context.NotifyNullReferenceSkipped();
return null;
}
int savedOffSet = context.Offset();
try
{
ITypeHandler4 typeHandler = ReadTypeHandler(context, payloadOffset);
if (typeHandler == null)
{
return null;
}
if (IsPlainObject(typeHandler))
{
return ReadPlainObject(readContext);
}
SeekSecondaryOffset(context, typeHandler);
return context.ReadAtCurrentSeekPosition(typeHandler);
}
finally
{
context.Seek(savedOffSet);
}
}
示例3: Read
// #end example
// #example: Read the StringBuilder
public object Read(IReadContext readContext)
{
int length = readContext.ReadInt();
byte[] data = new byte[length];
readContext.ReadBytes(data);
return new StringBuilder(Encoding.UTF8.GetString(data));
}
示例4: Read
public object Read(IReadContext context)
{
int classId = context.ReadInt();
long enumValue = context.ReadLong();
return ToEnum(context, classId, enumValue);
}
示例5: Eval
public override object Eval(GameState state, IReadContext c)
{
bool l = (bool)lhs.Eval(state, c);
// Lazy evaluation
if (l == true) return true;
return rhs.Eval(state, c);
}
示例6: Read
public virtual object Read(IReadContext context)
{
object read = StringHandler(context).Read(context);
if (null == read)
{
return null;
}
return ConvertString((string)read);
}
示例7: Read
public override object Read(IReadContext context)
{
double value = (double)base.Read(context);
if (double.IsNaN(value))
{
return null;
}
return value;
}
示例8: Read
public override object Read(IReadContext context)
{
long value = (long)base.Read(context);
if (value == long.MaxValue)
{
return null;
}
return value;
}
示例9: Read
public override object Read(IReadContext context)
{
byte[] bytes = new byte[2];
context.ReadBytes(bytes);
return (ushort)(
bytes[1] & 255 |
(bytes[0] & 255) << 8
);
}
示例10: Read
public override object Read(IReadContext context)
{
int i = context.ReadInt();
if (i == int.MaxValue)
{
return null;
}
return i;
}
示例11: Eval
public override object Eval(GameState state, IReadContext c)
{
var ret = new List<object>();
foreach (var item in set)
{
ret.Add(item.Eval(state, c));
}
return ret;
}
示例12: Read
public override object Read(IReadContext context)
{
float value = (float)base.Read(context);
if (float.IsNaN(value))
{
return null;
}
return value;
}
示例13: Read
public override object Read(IReadContext context)
{
var value = context.ReadLong();
if (value == long.MaxValue)
{
return PrimitiveNull();
}
return new DateTime(value);
}
示例14: Read
public override object Read(IReadContext context)
{
short value = (short)base.Read(context);
if (value == short.MaxValue)
{
return null;
}
return value;
}
示例15: WriteToReadRepository
/// <summary>
/// Initializes a new instance of the <see cref="WriteToReadRepository"/> class.
/// </summary>
public WriteToReadRepository(IReadContext readContext)
{
if (readContext == null)
{
throw new ArgumentNullException(nameof(readContext));
}
this.readContext = readContext;
}