I’m moving some code over from a Win32 console app into Unity. I’ve been careful to keep the code Win32, to use only .Net 2.0 stuff, and to not use ‘unsafe’ but the constructor I’m using for FileStream does not seem to be present:
fs = new FileStream(hidHandle, FileAccess.ReadWrite, InputReportByteLength, true);
i.e. a call to
public FileStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync);
Looking in the mono source code I can see the constructor I need, but it is not there in Unity.
If I “go to definition” in Visual Studio the constructor I need is mentioned as a hint:
[Obsolete("Use FileStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) instead")] public FileStream(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync);
Where is it?
Is there another, Unity friendly, way to make an asynchronous FileStream from a SafeFileHandle to an overlapping device i/o ‘file’?