// ***Public methods*** public PhysFSFileStream(string FileName, PhysFSFileMode FileMode, ulong BufferSize) { // Open the specified file with the appropriate file access switch (FileMode) { case PhysFSFileMode.Read: pHandle = PhysFS_DLL.PHYSFS_openRead(FileName); break; case PhysFSFileMode.Write: pHandle = PhysFS_DLL.PHYSFS_openWrite(FileName); break; case PhysFSFileMode.Append: pHandle = PhysFS_DLL.PHYSFS_openAppend(FileName); break; default: throw new PhysFSException("Invalid FileMode specified"); } // If handle is null, an error occured, so raise an exception //!!! Does object get created if exception is thrown? if (pHandle == null) { throw new PhysFSException(); } // Set buffer size, raise an exception if an error occured if (PhysFS_DLL.PHYSFS_setBuffer(pHandle, BufferSize) == 0) { throw new PhysFSException(); } }
// ***Public methods*** public PhysFSFileStream(string FileName, PhysFSFileMode FileMode, ulong BufferSize) { // Open the specified file with the appropriate file access switch(FileMode) { case PhysFSFileMode.Read: pHandle = PhysFS_DLL.PHYSFS_openRead(FileName); break; case PhysFSFileMode.Write: pHandle = PhysFS_DLL.PHYSFS_openWrite(FileName); break; case PhysFSFileMode.Append: pHandle = PhysFS_DLL.PHYSFS_openAppend(FileName); break; default: throw new PhysFSException("Invalid FileMode specified"); } // If handle is null, an error occured, so raise an exception //!!! Does object get created if exception is thrown? if(pHandle == null) throw new PhysFSException(); // Set buffer size, raise an exception if an error occured if(PhysFS_DLL.PHYSFS_setBuffer(pHandle, BufferSize) == 0) throw new PhysFSException(); }
// This constructor sets the buffer size to 0 if not specified public PhysFSFileStream(string FileName, PhysFSFileMode FileMode) : this(FileName, FileMode, 0) { }