Initial commit
parent
9e4f114edf
commit
779d939530
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 14
|
||||||
|
VisualStudioVersion = 14.0.24720.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpPhysFS", "SharpPhysFS\SharpPhysFS.csproj", "{AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,326 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace PhysFS
|
||||||
|
{
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate int InitDelegate();
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate void DeinitDelegate();
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate IntPtr MallocDelegate(ulong size);
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate IntPtr ReallocDelegate(IntPtr ptr, ulong size);
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate void FreeDelegate(IntPtr ptr);
|
||||||
|
|
||||||
|
public delegate void StringCallback(IntPtr data, string str);
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate void EnumFilesCallback(IntPtr data, string origdir, string fname);
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct ArchiveInfo
|
||||||
|
{
|
||||||
|
[MarshalAs(UnmanagedType.LPStr)]
|
||||||
|
public string extension;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.LPStr)]
|
||||||
|
public string description;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.LPStr)]
|
||||||
|
public string author;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.LPStr)]
|
||||||
|
public string url;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct Version
|
||||||
|
{
|
||||||
|
public byte major;
|
||||||
|
public byte minor;
|
||||||
|
public byte patch;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public class Allocator
|
||||||
|
{
|
||||||
|
[MarshalAs(UnmanagedType.FunctionPtr)]
|
||||||
|
public InitDelegate Init;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.FunctionPtr)]
|
||||||
|
public DeinitDelegate Deinit;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.FunctionPtr)]
|
||||||
|
public MallocDelegate Malloc;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.FunctionPtr)]
|
||||||
|
public ReallocDelegate Realloc;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.FunctionPtr)]
|
||||||
|
public FreeDelegate Free;
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Interop
|
||||||
|
{
|
||||||
|
const string DLL_NAME = "physfs.dll";
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void PHYSFS_getLinkedVersion(ref Version ver);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_init(string argv0);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_deinit();
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern IntPtr PHYSFS_supportedArchiveTypes();
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void PHYSFS_freeList(IntPtr listVar);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern IntPtr PHYSFS_getLastError();
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern string PHYSFS_getDirSeparator();
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void PHYSFS_permitSymbolicLinks(int allow);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static unsafe extern IntPtr PHYSFS_getCdRomDirs();
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern string PHYSFS_getBaseDir();
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern string PHYSFS_getUserDir();
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern string PHYSFS_getWriteDir();
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_setWriteDir(string newDir);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_addToSearchPath(string newDir, int appendToPath);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_removeFromSearchPath(string oldDir);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static unsafe extern IntPtr PHYSFS_getSearchPath();
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_setSaneConfig(string organization, string appName, string archiveExt, int includeCdRoms, int archivesFirst);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_mkdir(string dirName);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_delete(string filename);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern string PHYSFS_getRealDir(string filename);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static unsafe extern IntPtr PHYSFS_enumerateFiles(string dir);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_exists(string fname);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_isDirectory(string fname);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_isSymbolicLink(string fname);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern long PHYSFS_getLastModTime(string filename);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern IntPtr PHYSFS_openWrite(string filename);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern IntPtr PHYSFS_openAppend(string filename);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern IntPtr PHYSFS_openRead(string filename);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_close(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern long PHYSFS_read(IntPtr handle, IntPtr buffer, uint objSize, uint objCount);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern long PHYSFS_write(IntPtr handle, IntPtr buffer, uint objSize, uint objCount);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_eof(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern long PHYSFS_tell(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_seek(IntPtr handle, ulong pos);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern long PHYSFS_fileLength(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_setBuffer(IntPtr handle, ulong bufsize);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_flush(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern short PHYSFS_swapSLE16(short val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern ushort PHYSFS_swapULE16(ushort val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_swapSLE32(int val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern uint PHYSFS_swapULE32(uint val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern long PHYSFS_swapSLE64(long val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern ulong PHYSFS_swapULE64(ulong val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern short PHYSFS_swapSBE16(short val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern ushort PHYSFS_swapUBE16(ushort val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_swapSBE32(int val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern uint PHYSFS_swapUBE32(uint val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern long PHYSFS_swapSBE64(long val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern ulong PHYSFS_swapUBE64(ulong val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_readSLE16(IntPtr file, ref short val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_readULE16(IntPtr file, ref ushort val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_readSBE16(IntPtr file, ref short val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_readUBE16(IntPtr file, ref ushort val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_readSLE32(IntPtr file, ref int val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_readULE32(IntPtr file, ref uint val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_readSBE32(IntPtr file, ref int val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_readUBE32(IntPtr file, ref uint val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_readSLE64(IntPtr file, ref long val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_readULE64(IntPtr file, ref ulong val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_readSBE64(IntPtr file, ref long val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_readUBE64(IntPtr file, ref ulong val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_writeSLE16(IntPtr file, short val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_writeULE16(IntPtr file, ushort val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_writeSBE16(IntPtr file, short val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_writeUBE16(IntPtr file, ushort val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_writeSLE32(IntPtr file, int val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_writeULE32(IntPtr file, uint val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_writeSBE32(IntPtr file, int val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_writeUBE32(IntPtr file, uint val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_writeSLE64(IntPtr file, long val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_writeULE64(IntPtr file, ulong val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_writeSBE64(IntPtr file, long val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_writeUBE64(IntPtr file, ulong val);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_isInit();
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_symbolicLinksPermitted();
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_setAllocator(Allocator allocator);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int PHYSFS_mount(string newDir, string mountPoint, int appendToPath);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern string PHYSFS_getMountPoint(string dir);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void PHYSFS_getCdRomDirsCallback(StringCallback c, IntPtr d);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void PHYSFS_getSearchPathCallback(StringCallback c, IntPtr d);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void PHYSFS_enumerateFilesCallback(string dir, EnumFilesCallback c, IntPtr d);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static unsafe extern void PHYSFS_utf8FromUcs4(uint* src, char* dst, ulong len);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static unsafe extern void PHYSFS_utf8ToUcs4(string src, uint* dst, ulong len);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static unsafe extern void PHYSFS_utf8FromUcs2(ushort* src, char* dst, ulong len);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static unsafe extern void PHYSFS_utf8ToUcs2(string src, ushort* dst, ulong len);
|
||||||
|
|
||||||
|
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static unsafe extern void PHYSFS_utf8FromLatin1(string src, char* dst, ulong len);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,753 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace PhysFS
|
||||||
|
{
|
||||||
|
public class PhysFSException : Exception
|
||||||
|
{
|
||||||
|
public PhysFSException()
|
||||||
|
: base(PhysFS.GetLastError())
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PhysFSLibNotFound : Exception
|
||||||
|
{
|
||||||
|
public PhysFSLibNotFound()
|
||||||
|
: base("Couldn't locate PhysFS library")
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class PhysFS
|
||||||
|
{
|
||||||
|
public static class LowLevel
|
||||||
|
{
|
||||||
|
public static IntPtr OpenWrite(string filename)
|
||||||
|
{
|
||||||
|
var val = Interop.PHYSFS_openWrite(filename);
|
||||||
|
if (val == null)
|
||||||
|
throw new PhysFSException();
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IntPtr OpenAppend(string filename)
|
||||||
|
{
|
||||||
|
var val = Interop.PHYSFS_openAppend(filename);
|
||||||
|
if (val == null)
|
||||||
|
throw new PhysFSException();
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IntPtr OpenRead(string filename)
|
||||||
|
{
|
||||||
|
var val = Interop.PHYSFS_openRead(filename);
|
||||||
|
if (val == null)
|
||||||
|
throw new PhysFSException();
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Close(IntPtr file)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_close(file);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long Read(IntPtr file, byte[] buffer, uint objSize, uint objCount)
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
fixed (void* ptr = buffer)
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_read(file, (IntPtr)ptr, objSize, objCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long Write(IntPtr file, byte[] buffer, uint objSize, uint objCount)
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
fixed (void* ptr = buffer)
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_write(file, (IntPtr)ptr, objSize, objCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool EOF(IntPtr file)
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_eof(file) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long Tell(IntPtr file)
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_tell(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Seek(IntPtr file, ulong pos)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_seek(file, pos);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long FileLength(IntPtr file)
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_fileLength(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetBuffer(IntPtr file, ulong bufSize)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_setBuffer(file, bufSize);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Flush(IntPtr file)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_flush(file);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static T FromPtr<T>(IntPtr ptr)
|
||||||
|
{
|
||||||
|
return (T)Marshal.PtrToStructure(ptr, typeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ThrowException(int err)
|
||||||
|
{
|
||||||
|
if (err == 0)
|
||||||
|
{
|
||||||
|
throw new PhysFSException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the version of PhysicsFS that is linked against your program
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The version of PhysicsFS that is linked against your program</returns>
|
||||||
|
public static Version GetLinkedVersion()
|
||||||
|
{
|
||||||
|
Version v = new Version();
|
||||||
|
Interop.PHYSFS_getLinkedVersion(ref v);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize the PhysicsFS library.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Must be called before any other PhysicsFS function.
|
||||||
|
/// This should be called prior to any attempts to change your process's current working directory.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="argv0">This should be the path of the executable (first arguments passed to main function in C programs)</param>
|
||||||
|
public static void Init(string argv0)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_init(argv0);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deinitialize the PhysicsFS library.
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <para>
|
||||||
|
/// This closes any files opened via PhysicsFS, blanks the search/write paths, frees memory, and invalidates all of your file handles.
|
||||||
|
/// </para>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// This call can throw if there's a file open for writing that refuses to close
|
||||||
|
/// (for example, the underlying operating system was buffering writes to network filesystem,
|
||||||
|
/// and the fileserver has crashed, or a hard drive has failed, etc). It is usually best to
|
||||||
|
/// close all write handles yourself before calling this function, so that you can gracefully handle a specific failure.
|
||||||
|
/// Once successfully deinitialized, Init can be called again to restart the subsystem.
|
||||||
|
/// All default API states are restored at this point, with the exception of any custom allocator you might have specified, which survives between initializations.
|
||||||
|
/// </remarks>
|
||||||
|
public static void Deinit()
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_deinit();
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add an archive or directory to the search path.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// If this is a duplicate, the entry is not added again, even though the function succeeds.
|
||||||
|
/// You may not add the same archive to two different mountpoints: duplicate checking is done against the archive and not the mountpoint.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// When you mount an archive, it is added to a virtual file system...all files in all of the archives are interpolated into a single hierachical file tree.
|
||||||
|
/// Two archives mounted at the same place (or an archive with files overlapping another mountpoint) may have overlapping files:
|
||||||
|
/// in such a case, the file earliest in the search path is selected, and the other files are inaccessible to the application.
|
||||||
|
/// This allows archives to be used to override previous revisions; you can use the mounting mechanism to place archives at a specific point
|
||||||
|
/// in the file tree and prevent overlap; this is useful for downloadable mods that might trample over application data or each other, for example.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// The mountpoint does not need to exist prior to mounting, which is different than those familiar with the Unix concept of "mounting" may not expect.
|
||||||
|
/// As well, more than one archive can be mounted to the same mountpoint, or mountpoints and archive contents can overlap...the interpolation mechanism still functions as usual.
|
||||||
|
/// </para>
|
||||||
|
/// <param name="dir">directory or archive to add to the path, in platform-dependent notation.</param>
|
||||||
|
/// <param name="mountPoint">Location in the interpolated tree that this archive will be "mounted", in platform-independent notation. null or "" is equivalent to "/".</param>
|
||||||
|
/// <param name="appendToPath">True to append to search path, false to prepend.</param>
|
||||||
|
public static void Mount(string dir, string mountPoint, bool appendToPath)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_mount(dir, mountPoint, appendToPath ? 1 : 0);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get human-readable error information.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// Get the last PhysicsFS error message as a human-readable, null-terminated string.
|
||||||
|
/// This will be null if there's been no error since the last call to this function.
|
||||||
|
/// The pointer returned by this call points to an internal buffer.
|
||||||
|
/// Each thread has a unique error state associated with it, but each time a new error message is set,
|
||||||
|
/// it will overwrite the previous one associated with that thread.
|
||||||
|
/// It is safe to call this function at anytime, even before PhysFS.Init().
|
||||||
|
/// </para>
|
||||||
|
/// <returns>String of last error message.</returns>
|
||||||
|
public static string GetLastError()
|
||||||
|
{
|
||||||
|
return Marshal.PtrToStringAnsi(Interop.PHYSFS_getLastError());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get platform-dependent dir separator string.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// This returns "\\" on win32, "/" on Unix, and ":" on MacOS.
|
||||||
|
/// It may be more than one character, depending on the platform, and your code should take that into account.
|
||||||
|
/// </para>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is only useful for setting up the search/write paths, since access into those dirs always use '/' (platform-independent notation)
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>Platform-dependent dir separator string</returns>
|
||||||
|
public static string GetDirSeparator()
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_getDirSeparator();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a file listing of a search path's directory.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// Matching directories are interpolated.
|
||||||
|
/// That is, if "C:\mydir" is in the search path and contains a directory "savegames" that contains "x.sav", "y.sav", and "z.sav",
|
||||||
|
/// and there is also a "C:\userdir" in the search path that has a "savegames" subdirectory with "w.sav", then the following code:
|
||||||
|
/// <code>
|
||||||
|
/// foreach(var file in PhysFS.EnumerateFiles("savegames"))
|
||||||
|
/// {
|
||||||
|
/// System.Console.WriteLine(" * We've got [{0}].", file);
|
||||||
|
/// }
|
||||||
|
/// </code>
|
||||||
|
/// Will print...
|
||||||
|
/// <code>
|
||||||
|
/// * We've got [x.sav].
|
||||||
|
/// * We've got [y.sav].
|
||||||
|
/// * We've got [z.sav].
|
||||||
|
/// * We've got [w.sav].
|
||||||
|
/// </code>
|
||||||
|
/// </para>
|
||||||
|
/// <param name="dir">Directory in platform-independent notation to enumerate.</param>
|
||||||
|
public static string[] EnumerateFiles(string dir)
|
||||||
|
{
|
||||||
|
var list = new List<string>();
|
||||||
|
EnumerateFilesCallback(dir, (d, o, f) =>
|
||||||
|
{
|
||||||
|
list.Add(f);
|
||||||
|
}, null);
|
||||||
|
return list.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get an enumeration of supported archive types.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// Get a list of archive types supported by this implementation of PhysicFS.
|
||||||
|
/// These are the file formats usable for search path entries.
|
||||||
|
/// This is for informational purposes only.
|
||||||
|
/// </para>
|
||||||
|
/// <remarks>
|
||||||
|
/// The extension listed is merely convention: if we list "ZIP", you can open a PkZip-compatible archive with an extension of "XYZ", if you like.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>An enumeration of supported archive types</returns>
|
||||||
|
public static IEnumerable<ArchiveInfo> SupportedArchiveTypes()
|
||||||
|
{
|
||||||
|
IntPtr archives = Interop.PHYSFS_supportedArchiveTypes();
|
||||||
|
IntPtr i;
|
||||||
|
for (i = archives; Marshal.ReadIntPtr(i) != IntPtr.Zero; i = IntPtr.Add(i, 1))
|
||||||
|
{
|
||||||
|
IntPtr ptr = Marshal.ReadIntPtr(i);
|
||||||
|
var info = new ArchiveInfo();
|
||||||
|
info = FromPtr<ArchiveInfo>(ptr);
|
||||||
|
yield return info;
|
||||||
|
}
|
||||||
|
Interop.PHYSFS_freeList(archives);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enable or disable following of symbolic links.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// Some physical filesystems and archives contain files that are just pointers to other files.
|
||||||
|
/// On the physical filesystem, opening such a link will (transparently) open the file that is pointed to.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// By default, PhysicsFS will check if a file is really a symlink during open calls and fail if it is.
|
||||||
|
/// Otherwise, the link could take you outside the write and search paths, and compromise security.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// If you want to take that risk, call this function with a true parameter.
|
||||||
|
/// Note that this is more for sandboxing a program's scripting language,
|
||||||
|
/// in case untrusted scripts try to compromise the system.
|
||||||
|
/// Generally speaking, a user could very well have a legitimate reason to set up a symlink,
|
||||||
|
/// so unless you feel there's a specific danger in allowing them, you should permit them
|
||||||
|
/// </para>
|
||||||
|
/// <remarks>
|
||||||
|
/// Symlinks are only explicitly checked when dealing with filenames in platform-independent notation.
|
||||||
|
/// That is, when setting up your search and write paths, etc, symlinks are never checked for.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="permit">true to permit symlinks, false to deny linking.</param>
|
||||||
|
public static void PermitSymbolicLinks(bool permit)
|
||||||
|
{
|
||||||
|
Interop.PHYSFS_permitSymbolicLinks(permit ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get an enumeration of paths to available CD-ROM drives.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// The dirs returned are platform-dependent ("D:\" on Win32, "/cdrom" or whatnot on Unix).
|
||||||
|
/// Dirs are only returned if there is a disc ready and accessible in the drive.
|
||||||
|
/// So if you've got two drives (D: and E:), and only E: has a disc in it, then that's all you get.
|
||||||
|
/// If the user inserts a disc in D: and you call this function again, you get both drives.
|
||||||
|
/// If, on a Unix box, the user unmounts a disc and remounts it elsewhere, the next call to this function will reflect that change.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// This function refers to "CD-ROM" media, but it really means "inserted disc media," such as DVD-ROM, HD-DVD, CDRW, and Blu-Ray discs.
|
||||||
|
/// It looks for filesystems, and as such won't report an audio CD, unless there's a mounted filesystem track on it.
|
||||||
|
/// </para>
|
||||||
|
/// <remarks>
|
||||||
|
/// This call may block while drives spin up. Be forewarned.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>An enumeration of paths to available CD-ROM drives.</returns>
|
||||||
|
public static string[] GetCdRomDirs()
|
||||||
|
{
|
||||||
|
var list = new List<string>();
|
||||||
|
GetCdRomDirsCallback((d, s) =>
|
||||||
|
{
|
||||||
|
list.Add(s);
|
||||||
|
}, null);
|
||||||
|
return list.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the path where the application resides.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// It is probably better to use managed methods for this.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetBaseDir()
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_getBaseDir();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the path where user's home directory resides.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// Get the "user dir". This is meant to be a suggestion of where a specific user of the system can store files.
|
||||||
|
/// On Unix, this is her home directory. On systems with no concept of multiple home directories (MacOS, win95),
|
||||||
|
/// this will default to something like "C:\mybasedir\users\username" where "username" will either be the login name,
|
||||||
|
/// or "default" if the platform doesn't support multiple users, either.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// You should probably use the user dir as the basis for your write dir, and also put it near the beginning of your search path.
|
||||||
|
/// </para>
|
||||||
|
/// <returns>String of user dir in platform-dependent notation.</returns>
|
||||||
|
public static string GetUserDir()
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_getUserDir();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get path where PhysicsFS will allow file writing.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// Get the current write dir. The default write dir is "".
|
||||||
|
/// </para>
|
||||||
|
/// <returns>String of write dir in platform-dependent notation, OR null IF NO WRITE PATH IS CURRENTLY SET</returns>
|
||||||
|
public static string GetWriteDir()
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_getWriteDir();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tell PhysicsFS where it may write files.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// Set a new write dir. This will override the previous setting.
|
||||||
|
/// </para>
|
||||||
|
/// <remarks>
|
||||||
|
/// This call will fail(and fail to change the write dir) if the current write dir still has files open in it.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="path">
|
||||||
|
/// The new directory to be the root of the write dir, specified in platform-dependent notation.
|
||||||
|
/// Setting to null disables the write dir, so no files can be opened for writing via PhysicsFS.
|
||||||
|
/// </param>
|
||||||
|
public static void SetWriteDir(string path)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_setWriteDir(path);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add an archive or directory to the search path.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newDir">Directory or archive to add to the path, in platform-dependent notation</param>
|
||||||
|
/// <param name="appendToPath">true to append to search path, false to prepend</param>
|
||||||
|
[Obsolete("AddToSearchPath is deprecated, please use Mount instead")]
|
||||||
|
public static void AddToSearchPath(string newDir, bool appendToPath)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_addToSearchPath(newDir, appendToPath ? 1 : 0);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove a directory or archive from the search path.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// This must be a(case-sensitive) match to a dir or archive already in the search path, specified in platform-dependent notation.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// This call will fail (and fail to remove from the path) if the element still has files open in it.
|
||||||
|
/// </para>
|
||||||
|
/// <param name="oldDir"> dir/archive to remove.</param>
|
||||||
|
public static void RemoveFromSearchPath(string oldDir)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_removeFromSearchPath(oldDir);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the current search path.
|
||||||
|
/// </summary>
|
||||||
|
public static string[] GetSearchPath()
|
||||||
|
{
|
||||||
|
//var dirs = Interop.PHYSFS_getSearchPath();
|
||||||
|
//return GenEnumerable(dirs);
|
||||||
|
var list = new List<string>();
|
||||||
|
GetSearchPathCallback((d, s) =>
|
||||||
|
{
|
||||||
|
list.Add(s);
|
||||||
|
}, null);
|
||||||
|
return list.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set up sane, default paths.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// The write dir will be set to "userdir/.organization/appName", which is created if it doesn't exist.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// The above is sufficient to make sure your program's configuration directory is separated from other clutter, and platform-independent.
|
||||||
|
/// The period before "mygame" even hides the directory on Unix systems.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// The search path will be:
|
||||||
|
/// <list type="bullet">
|
||||||
|
/// <item>
|
||||||
|
/// <description>
|
||||||
|
/// The Write Dir (created if it doesn't exist)
|
||||||
|
/// </description>
|
||||||
|
/// </item>
|
||||||
|
/// <item>
|
||||||
|
/// <description>
|
||||||
|
/// The Base Dir
|
||||||
|
/// </description>
|
||||||
|
/// </item>
|
||||||
|
/// <item>
|
||||||
|
/// <description>
|
||||||
|
/// All found CD-ROM dirs (optionally)
|
||||||
|
/// </description>
|
||||||
|
/// </item>
|
||||||
|
/// </list>
|
||||||
|
/// </para>
|
||||||
|
/// These directories are then searched for files ending with the extension (archiveExt), which,
|
||||||
|
/// if they are valid and supported archives, will also be added to the search path.
|
||||||
|
/// If you specified "PKG" for (archiveExt), and there's a file named data.PKG in the base dir, it'll be checked.
|
||||||
|
/// Archives can either be appended or prepended to the search path in alphabetical order,
|
||||||
|
/// regardless of which directories they were found in.
|
||||||
|
/// <para>
|
||||||
|
/// All of this can be accomplished from the application, but this just does it all for you. Feel free to add more to the search path manually, too.
|
||||||
|
/// </para>
|
||||||
|
/// <param name="organization">Name of your company/group/etc to be used as a dirname, so keep it small, and no-frills.</param>
|
||||||
|
/// <param name="appName">Program-specific name of your program, to separate it from other programs using PhysicsFS.</param>
|
||||||
|
/// <param name="archiveExt">
|
||||||
|
/// File extension used by your program to specify an archive.
|
||||||
|
/// For example, Quake 3 uses "pk3", even though they are just zipfiles.
|
||||||
|
/// Specify null to not dig out archives automatically.
|
||||||
|
/// Do not specify the '.' char; If you want to look for ZIP files, specify "ZIP" and not ".ZIP" ... the archive search is case-insensitive.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="includeCdRoms">
|
||||||
|
/// True to include CD-ROMs in the search path, and (if (archiveExt) != null) search them for archives.
|
||||||
|
/// This may cause a significant amount of blocking while discs are accessed, and if there are no discs in the drive (or even not mounted on Unix systems),
|
||||||
|
/// then they may not be made available anyhow. You may want to specify false and handle the disc setup yourself.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="archivesFirst">True to prepend the archives to the search path. False to append them. Ignored if !(archiveExt).</param>
|
||||||
|
public static void SetSaneConfig(string organization, string appName, string archiveExt, bool includeCdRoms, bool archivesFirst)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_setSaneConfig(organization, appName, archiveExt, includeCdRoms ? 1 : 0, archivesFirst ? 1 : 0);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a directory.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// This is specified in platform-independent notation in relation to the write dir.
|
||||||
|
/// All missing parent directories are also created if they don't exist.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// So if you've got the write dir set to "C:\mygame\writedir" and call Mkdir("downloads/maps")
|
||||||
|
/// then the directories "C:\mygame\writedir\downloads" and "C:\mygame\writedir\downloads\maps" will be created if possible.
|
||||||
|
/// If the creation of "maps" fails after we have successfully created "downloads",
|
||||||
|
/// then the function leaves the created directory behind and reports failure.
|
||||||
|
/// </para>
|
||||||
|
/// <param name="dirName">New dir to create.</param>
|
||||||
|
public static void Mkdir(string dirName)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_mkdir(dirName);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delete a file or directory.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>(filename) is specified in platform-independent notation in relation to the write dir.</para>
|
||||||
|
/// <para>A directory must be empty before this call can delete it.</para>
|
||||||
|
/// <para>Deleting a symlink will remove the link, not what it points to, regardless of whether you "permitSymLinks" or not.</para>
|
||||||
|
/// <para>
|
||||||
|
/// So if you've got the write dir set to "C:\mygame\writedir" and call Delete("downloads/maps/level1.map")
|
||||||
|
/// then the file "C:\mygame\writedir\downloads\maps\level1.map" is removed from the physical filesystem,
|
||||||
|
/// if it exists and the operating system permits the deletion.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// Note that on Unix systems, deleting a file may be successful,
|
||||||
|
/// but the actual file won't be removed until all processes that have an open filehandle to it (including your program) close their handles.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// Chances are, the bits that make up the file still exist,
|
||||||
|
/// they are just made available to be written over at a later point.
|
||||||
|
/// Don't consider this a security method or anything. :)
|
||||||
|
/// </para>
|
||||||
|
/// <param name="filename">Filename to delete.</param>
|
||||||
|
public static void Delete(string filename)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_delete(filename);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Figure out where in the search path a file resides.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// The file is specified in platform-independent notation.
|
||||||
|
/// The returned filename will be the element of the search path where the file was found, which may be a directory, or an archive.
|
||||||
|
/// Even if there are multiple matches in different parts of the search path, only the first one found is used, just like when opening a file.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// So, if you look for "maps/level1.map", and C:\mygame is in your search path and C:\mygame\maps\level1.map exists, then "C:\mygame" is returned.
|
||||||
|
/// </para>
|
||||||
|
/// <para>If a any part of a match is a symbolic link, and you've not explicitly permitted symlinks, then it will be ignored, and the search for a match will continue.</para>
|
||||||
|
/// <para>
|
||||||
|
/// If you specify a fake directory that only exists as a mount point, it'll be associated with the first archive mounted there,
|
||||||
|
/// even though that directory isn't necessarily contained in a real archive.
|
||||||
|
/// </para>
|
||||||
|
/// <param name="filename">File to look for.</param>
|
||||||
|
/// <returns>String of element of search path containing the the file in question. null if not found.</returns>
|
||||||
|
public static string GetRealDir(string filename)
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_getRealDir(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determine if a file exists in the search path.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>Reports true if there is an entry anywhere in the search path by the name of <paramref name="fname"/>.</para>
|
||||||
|
/// <para>
|
||||||
|
/// Note that entries that are symlinks are ignored if PhysFS.PermitSymbolicLinks(true) hasn't been called,
|
||||||
|
/// so you might end up further down in the search path than expected.
|
||||||
|
/// </para>
|
||||||
|
/// <param name="fname">Filename in platform-independent notation.</param>
|
||||||
|
/// <returns>True if filename exists. false otherwise.</returns>
|
||||||
|
public static bool Exists(string fname)
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_exists(fname) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determine if a file in the search path is really a directory.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>Determine if the first occurence of <paramref name="fname"/> in the search path is really a directory entry.</para>
|
||||||
|
/// <para>Note that entries that are symlinks are ignored if PhysFS.PermitSymbolicLinks(true) hasn't been called, so you might end up further down in the search path than expected.</para>
|
||||||
|
/// <param name="fname">Filename in platform-independent notation.</param>
|
||||||
|
/// <returns>True if filename exists and is a directory. False otherwise.</returns>
|
||||||
|
public static bool IsDirectory(string fname)
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_isDirectory(fname) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determine if a file in the search path is really a symbolic link.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>Determine if the first occurence of <paramref name="fname"/> in the search path is really a symbolic link.</para>
|
||||||
|
/// <para>Note that entries that are symlinks are ignored if PhysFS.PermitSymbolicLinks(true) hasn't been called, and as such, this function will always return false in that case.</para>
|
||||||
|
/// <param name="fname">Filename in platform-independent notation.</param>
|
||||||
|
/// <returns>True if filename exists and is a symlink. False otherwise.</returns>
|
||||||
|
public static bool IsSymbolicLink(string fname)
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_isSymbolicLink(fname) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the last modification time of a file.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// The modtime is returned as a number of seconds since the epoch (Jan 1, 1970).
|
||||||
|
/// The exact derivation and accuracy of this time depends on the particular archiver.
|
||||||
|
/// If there is no reasonable way to obtain this information for a particular archiver, or there was some sort of error, this function returns (-1).
|
||||||
|
/// </para>
|
||||||
|
/// <param name="fname">Filename to check, in platform-independent notation.</param>
|
||||||
|
/// <returns>Last modified time of the file. -1 if it can't be determined.</returns>
|
||||||
|
public static long GetLastModTime(string fname)
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_getLastModTime(fname);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determine if the PhysicsFS library is initialized.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// Once PhysFS.Init() returns successfully, this will return true.
|
||||||
|
/// Before a successful PhysFS.Init() and after PhysFS.Deinit() returns successfully, this will return false. This function is safe to call at any time.
|
||||||
|
/// </para>
|
||||||
|
/// <returns>True if library is initialized, false if library is not.</returns>
|
||||||
|
public static bool IsInit()
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_isInit() != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determine if the symbolic links are permitted.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// This reports the setting from the last call to PhysFS.PermitSymbolicLinks().
|
||||||
|
/// If PhysFS.PermitSymbolicLinks() hasn't been called since the library was last initialized, symbolic links are implicitly disabled.
|
||||||
|
/// </para>
|
||||||
|
/// <returns>True if symlinks are permitted, false if not.</returns>
|
||||||
|
public static bool SymbolicLinksPermitted()
|
||||||
|
{
|
||||||
|
return Interop.PHYSFS_symbolicLinksPermitted() != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetAllocator(Allocator allocator)
|
||||||
|
{
|
||||||
|
int err = Interop.PHYSFS_setAllocator(allocator);
|
||||||
|
ThrowException(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determine a mounted archive's mountpoint.
|
||||||
|
/// </summary>
|
||||||
|
/// <para>
|
||||||
|
/// You give this function the name of an archive or dir you successfully added to the search path, and it reports the location in the interpolated tree where it is mounted.
|
||||||
|
/// Files mounted with an empty mountpoint or through PhysFS.AddToSearchPath() will report "/".
|
||||||
|
/// </para>
|
||||||
|
/// <param name="dir">
|
||||||
|
/// Directory or archive previously added to the path, in platform-dependent notation.
|
||||||
|
/// This must match the string used when adding, even if your string would also reference the same file with a different string of characters.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>String of mount point if added to path</returns>
|
||||||
|
public static string GetMountPoint(string dir)
|
||||||
|
{
|
||||||
|
var s = Interop.PHYSFS_getMountPoint(dir);
|
||||||
|
if(s == null)
|
||||||
|
{
|
||||||
|
throw new PhysFSException();
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
static StringCallback WrapStringCallback<T>(Action<T, string> c)
|
||||||
|
{
|
||||||
|
return (d, s) =>
|
||||||
|
{
|
||||||
|
var obj = (T)GCHandle.FromIntPtr(d).Target;
|
||||||
|
c(obj, s);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void GetCdRomDirsCallback(StringCallback c, object data)
|
||||||
|
{
|
||||||
|
GCHandle objHandle = GCHandle.Alloc(data);
|
||||||
|
Interop.PHYSFS_getCdRomDirsCallback(c, GCHandle.ToIntPtr(objHandle));
|
||||||
|
objHandle.Free();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enumerate CD-ROM directories, using an application-defined callback.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">Type of data passed to callback</typeparam>
|
||||||
|
/// <param name="c">Callback function to notify about detected drives.</param>
|
||||||
|
/// <param name="data">Application-defined data passed to callback. Can be null.</param>
|
||||||
|
public static void GetCdRomDirsCallback<T>(Action<T, string> c, T data)
|
||||||
|
{
|
||||||
|
GetCdRomDirsCallback(WrapStringCallback(c), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void GetSearchPathCallback(StringCallback c, object data)
|
||||||
|
{
|
||||||
|
GCHandle objHandle = GCHandle.Alloc(data);
|
||||||
|
Interop.PHYSFS_getSearchPathCallback(c, GCHandle.ToIntPtr(objHandle));
|
||||||
|
objHandle.Free();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enumerate the search path, using an application-defined callback.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">Type of data passed to callback</typeparam>
|
||||||
|
/// <param name="c">Callback function to notify about search path elements.</param>
|
||||||
|
/// <param name="data">Application-defined data passed to callback. Can be null.</param>
|
||||||
|
public static void GetSearchPathCallback<T>(Action<T, string> c, T data)
|
||||||
|
{
|
||||||
|
GetSearchPathCallback(WrapStringCallback(c), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void EnumerateFilesCallback(string dir, EnumFilesCallback c, object data)
|
||||||
|
{
|
||||||
|
GCHandle objHandle = GCHandle.Alloc(data);
|
||||||
|
Interop.PHYSFS_enumerateFilesCallback(dir, c, GCHandle.ToIntPtr(objHandle));
|
||||||
|
objHandle.Free();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a file listing of a search path's directory, using an application-defined callback.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">Type of data passed to callbakc</typeparam>
|
||||||
|
/// <param name="dir">Directory, in platform-independent notation, to enumerate.</param>
|
||||||
|
/// <param name="c">Callback function to notify about search path elements.</param>
|
||||||
|
/// <param name="data">Application-defined data passed to callback. Can be null.</param>
|
||||||
|
public static void EnumerateFilesCallback<T>(string dir, Action<T, string, string> c, T data)
|
||||||
|
{
|
||||||
|
EnumerateFilesCallback(dir, (d, o, n) =>
|
||||||
|
{
|
||||||
|
var obj = (T)GCHandle.FromIntPtr(d).Target;
|
||||||
|
c(obj, o, n);
|
||||||
|
}, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,138 @@
|
||||||
|
using System;using System.IO;
|
||||||
|
|
||||||
|
namespace PhysFS
|
||||||
|
{
|
||||||
|
public enum OpenMode
|
||||||
|
{
|
||||||
|
Append,
|
||||||
|
Read,
|
||||||
|
Write
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PhysFSStream : Stream
|
||||||
|
{
|
||||||
|
IntPtr handle;
|
||||||
|
bool readOnly = false;
|
||||||
|
|
||||||
|
public PhysFSStream(string filename, OpenMode mode)
|
||||||
|
{
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case OpenMode.Append:
|
||||||
|
handle = PhysFS.LowLevel.OpenAppend(filename);
|
||||||
|
break;
|
||||||
|
case OpenMode.Read:
|
||||||
|
handle = PhysFS.LowLevel.OpenRead(filename);
|
||||||
|
readOnly = true;
|
||||||
|
break;
|
||||||
|
case OpenMode.Write:
|
||||||
|
handle = PhysFS.LowLevel.OpenAppend(filename);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanRead
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanSeek
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanWrite
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return !readOnly;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Flush()
|
||||||
|
{
|
||||||
|
PhysFS.LowLevel.Flush(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override long Length
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return PhysFS.LowLevel.FileLength(handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override long Position
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return PhysFS.LowLevel.Tell(handle);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
PhysFS.LowLevel.Seek(handle, (ulong)value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public long Read(byte[] buffer, uint offset, uint count)
|
||||||
|
{
|
||||||
|
return PhysFS.LowLevel.Read(handle, buffer, 1, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int Read(byte[] buffer, int offset, int count)
|
||||||
|
{
|
||||||
|
return (int)Read(buffer, (uint)offset, (uint)count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override long Seek(long offset, SeekOrigin origin)
|
||||||
|
{
|
||||||
|
long pos = 0;
|
||||||
|
if (origin == SeekOrigin.Begin)
|
||||||
|
pos = 0;
|
||||||
|
else if (origin == SeekOrigin.Current)
|
||||||
|
pos = PhysFS.LowLevel.Tell(handle);
|
||||||
|
else
|
||||||
|
pos = PhysFS.LowLevel.FileLength(handle);
|
||||||
|
|
||||||
|
PhysFS.LowLevel.Seek(handle, (ulong)(pos + offset));
|
||||||
|
return pos + offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetLength(long value)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public long Write(byte[] buffer, uint offset, uint count)
|
||||||
|
{
|
||||||
|
return PhysFS.LowLevel.Write(handle, buffer, 1, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Write(byte[] buffer, int offset, int count)
|
||||||
|
{
|
||||||
|
Write(buffer, (uint)offset, (uint)count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Close()
|
||||||
|
{
|
||||||
|
PhysFS.LowLevel.Close(handle);
|
||||||
|
handle = IntPtr.Zero;
|
||||||
|
base.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if(handle != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("SharpPhysFS")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("SharpPhysFS")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("1e8d0656-fbd5-4f97-b634-584943b13af2")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>PhysFS</RootNamespace>
|
||||||
|
<AssemblyName>SharpPhysFS</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="PhysFS.cs" />
|
||||||
|
<Compile Include="Interop.cs" />
|
||||||
|
<Compile Include="PhysFSStream.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
Loading…
Reference in New Issue