#include "stdafx.h" #include "StreamManager.h" #include "NativeStream.h" // --------------------------------------------------------------------------- // Stream 导出接口,供 C# P/Invoke 调用(真流式:Open 时指定 pView+importType,Write 即边解析边导入) // --------------------------------------------------------------------------- extern "C" __declspec(dllexport) int64_t Stream_Open(CSigmaView* pView, int importType, int* outError) { if (outError == nullptr) { return -1; } StreamError err = StreamError::STREAM_OK; int64_t handle = StreamManager::Instance().Open(pView, importType, err); *outError = static_cast(err); return handle; } extern "C" __declspec(dllexport) int Stream_Write(int64_t handle, const void* data, int size) { if (data == nullptr || size < 0) { return static_cast(StreamError::STREAM_WRITE_FAILED); } StreamError err = StreamManager::Instance().Write(handle, data, static_cast(size)); return static_cast(err); } extern "C" __declspec(dllexport) int Stream_Close(int64_t handle) { StreamError err = StreamManager::Instance().Close(handle); return static_cast(err); }