public static Item DeserializeNextItemFromStream(IOStream stream) { unsafe { var itemContainer = GetThreadLocalItem(); var itemSize = CEventTrace.GetNextSerializedItemSize(stream.Stream); var deserializeStatus = CEventTrace.DeserializeItemFromStream(stream.Stream, itemContainer, itemSize); if (deserializeStatus != 1) { var errorMessage = CEventTrace.GetLastError(); throw new IOException(ApiInterop.FromUtf8Cstr(errorMessage)); } return(ParameterConversion.ConvertItem(itemContainer)); } }
public void SerializeToStream(IOStream stream) { unsafe { var serializedItemResult = 0; ParameterConversion.ConvertItem(this, nativeItem => { var itemSize = CEventTrace.GetSerializedItemSize(nativeItem); serializedItemResult = CEventTrace.SerializeItemToStream(stream.Stream, nativeItem, itemSize); }); if (serializedItemResult == 1) { return; } var errorMessage = CEventTrace.GetLastError(); throw new IOException(ApiInterop.FromUtf8Cstr(errorMessage)); } }