public UnmanagedPhysFSStream(PHYSFS_Io *io) { if (ManagedPhysFSStream.TryGetAsManagedIo(io, out var _)) { throw new ArgumentException("Provided implementation is managed."); } this.io = io; }
static PHYSFS_Io *Duplicate(PHYSFS_Io *io) { try { var stream = allocated[io->opaque].stream; if (stream == null) { return((PHYSFS_Io *)new ManagedPhysFSStream(null)); } var stream2 = stream.Duplicate(); var other = new ManagedPhysFSStream(stream2); return((PHYSFS_Io *)other); } catch (Exception ex) { SetException(ex); PHYSFS_setErrorCode((int)EXCEPTION_ERROR); return(null); } }
public static bool TryGetAsManagedIo(PHYSFS_Io *io, out ManagedPhysFSStream wrapper) { return(allocated.TryGetValue(io->opaque, out wrapper)); }