public void AttachBuffer(BufferDevice buffer) { res = NvJpegNativeMethods.nvjpegStateAttachDeviceBuffer(_state, buffer.Buffer); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvjpegStateAttachDeviceBuffer", res)); if (res != nvjpegStatus.Success) { throw new NvJpegException(res); } }