public static IDisposable Mount(IPhysicsFSStream stream, string fname, string mountPoint, bool appendToPath) { if (stream == null) { throw new ArgumentNullException("stream"); } PHYSFS_Io *io; switch (stream) { case UnmanagedPhysFSStream unmanaged: io = (PHYSFS_Io *)unmanaged; break; case ManagedPhysFSStream managed: io = (PHYSFS_Io *)managed; break; default: io = (PHYSFS_Io *)new ManagedPhysFSStream(stream); break; } int ret; fixed(byte *fn = StringToUTF8(fname)) fixed(byte *mp = StringToUTF8(mountPoint)) { ret = PHYSFS_mountIo(io, fn, mp, appendToPath ? 1 : 0); } if (ret == 0) { throw Exception(); } return(new UnmountDisposable(fname)); }
public ManagedPhysFSStream(IPhysicsFSStream stream) { /* * if (stream is UnmanagedPhysFSStream) * throw new ArgumentException("Provided implementation is not managed."); */ this.stream = stream; me = GCHandle.Alloc(this); io.version = 0; io.opaque = (IntPtr)me; allocated.Add(io.opaque, this); io.read = read; io.write = write; io.seek = seek; io.tell = tell; io.length = length; io.duplicate = duplicate; io.flush = flush; io.destroy = destroy; }
public ArchiveArguments(IPhysicsFSStream stream, string name, bool forWrite) { this.Stream = stream; this.Name = name; this.IsForWriting = forWrite; }