Exemplo n.º 1
0
 public UnmanagedPhysFSStream(PHYSFS_Io *io)
 {
     if (ManagedPhysFSStream.TryGetAsManagedIo(io, out var _))
     {
         throw new ArgumentException("Provided implementation is managed.");
     }
     this.io = io;
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 public static bool TryGetAsManagedIo(PHYSFS_Io *io, out ManagedPhysFSStream wrapper)
 {
     return(allocated.TryGetValue(io->opaque, out wrapper));
 }