public static IEnumerable <object> FromByteMultiple(this ITypeMapper mapper, IEnumerable <byte[]> source, Func <object> factory) { foreach (var buffer in source) { var target = factory(); mapper.FromByte(buffer, 0, target); yield return(target); } }
public static IEnumerable <object> FromByteMultiple(this ITypeMapper mapper, byte[] buffer, int start, Func <object> factory) { while (start + mapper.Size <= buffer.Length) { var target = factory(); mapper.FromByte(buffer, start, target); yield return(target); start += buffer.Length; } }
public static IEnumerable <T> FromStreamMultiple <T>(this ITypeMapper <T> mapper, Stream stream, Func <T> factory) { var buffer = new byte[mapper.Size]; while (stream.Read(buffer, 0, buffer.Length) == buffer.Length) { var target = factory(); mapper.FromByte(buffer, 0, target); yield return(target); } }
public static bool FromStream <T>(this ITypeMapper <T> mapper, Stream stream, T target) { var buffer = new byte[mapper.Size]; if (stream.Read(buffer, 0, buffer.Length) != buffer.Length) { return(false); } mapper.FromByte(buffer, 0, target); return(true); }
//-------------------------------------------------------------------------------- // FromByte NonGeneric //-------------------------------------------------------------------------------- public static void FromByte(this ITypeMapper mapper, byte[] buffer, object target) { mapper.FromByte(buffer, 0, target); }
//-------------------------------------------------------------------------------- // FromByte //-------------------------------------------------------------------------------- public static void FromByte <T>(this ITypeMapper <T> mapper, byte[] buffer, T target) { mapper.FromByte(buffer, 0, target); }
public void FromByte() { mapper.FromByte(allocatedBuffer, 0, allocatedData); }