public int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; number = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; time = MeridianDate.ToDateTime(BitConverter.ToUInt32(Buffer, cursor)); cursor += TypeSizes.INT; ushort strlen = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; poster = Encoding.Default.GetString(Buffer, cursor, strlen); cursor += strlen; strlen = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; title = Encoding.Default.GetString(Buffer, cursor, strlen); cursor += strlen; return(cursor - StartIndex); }
public unsafe void ReadFrom(ref byte *Buffer) { number = *((uint *)Buffer); Buffer += TypeSizes.INT; time = MeridianDate.ToDateTime(*((uint *)Buffer)); Buffer += TypeSizes.INT; ushort len = *((ushort *)Buffer); Buffer += TypeSizes.SHORT; poster = new string((sbyte *)Buffer, 0, len); Buffer += len; len = *((ushort *)Buffer); Buffer += TypeSizes.SHORT; title = new string((sbyte *)Buffer, 0, len); Buffer += len; }