updating for latest PhysFS

pull/2/head
thatcosmonaut 2020-01-16 17:06:12 -08:00
parent 69143acb66
commit a75d588690
15 changed files with 171 additions and 492 deletions

2
.gitignore vendored
View File

@ -1,6 +1,8 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
lib/
# User-specific files
*.suo
*.user

27
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,27 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/UnitTests/bin/Debug/netcoreapp3.0/UnitTests.dll",
"args": [],
"cwd": "${workspaceFolder}/UnitTests",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}

42
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/UnitTests/UnitTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/UnitTests/UnitTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/UnitTests/UnitTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@ -1,4 +1,5 @@
# Copyright (c) 2017 Francesco Bertolaccini
# Copyright (c) 2020 Evan Hemsley
# Based on SharpPhysFS by Francesco Bertolaccini
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
@ -8,4 +9,4 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -64,139 +64,141 @@ namespace SharpPhysFS
static class Interop
{
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
private const string s_nativeLibName = "physfs";
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern void PHYSFS_getLinkedVersion(ref Version v);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_init(string argv0);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_deinit();
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_supportedArchiveTypes();
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern void PHYSFS_freeList(IntPtr h);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_getLastError();
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_getDirSeparator();
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern void PHYSFS_permitSymbolicLinks(int permit);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_getCdRomDirs();
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_getBaseDir();
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_getUserDir();
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_getWriteDir();
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_setWriteDir(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_addToSearchPath(string s, int i);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_removeFromSearchPath(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_getSearchPath();
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_setSaneConfig(string s1, string s2, string s3, int i1, int i2);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_mkdir(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_delete(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_getRealDir(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_enumerateFiles(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_exists(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_isDirectory(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_isSymbolicLink(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern long PHYSFS_getLastModTime(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_openWrite(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_openAppend(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_openRead(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_close(IntPtr ptr);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern long PHYSFS_read(IntPtr ptr1, IntPtr ptr2, uint i1, uint i2);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern long PHYSFS_write(IntPtr ptr1, IntPtr ptr2, uint i1, uint i2);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_eof(IntPtr ptr);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern long PHYSFS_tell(IntPtr ptr);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_seek(IntPtr ptr, ulong u);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern long PHYSFS_fileLength(IntPtr ptr);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_setBuffer(IntPtr ptr, ulong u);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_flush(IntPtr ptr);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_isInit();
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_symbolicLinksPermitted();
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_setAllocator(Allocator alloc);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern int PHYSFS_mount(string s1, string s2, int i);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern IntPtr PHYSFS_getMountPoint(string s);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern void PHYSFS_getCdRomDirsCallback(StringCallback c, IntPtr p);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern void PHYSFS_getSearchPathCallback(StringCallback c, IntPtr p);
[DllImport("physfs.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[DllImport(s_nativeLibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern void PHYSFS_enumerateFilesCallback(string s, EnumFilesCallback c, IntPtr p);
}
}

View File

@ -172,11 +172,16 @@ namespace SharpPhysFS
/// </code>
/// </para>
/// <param name="dir">Directory in platform-independent notation to enumerate.</param>
public string[] EnumerateFiles(string dir)
public IEnumerable<string> EnumerateFiles(string dir)
{
var list = new List<string>();
EnumerateFilesCallback(dir, (o, f) => list.Add(f));
return list.ToArray();
IntPtr files = Interop.PHYSFS_enumerateFiles(dir);
for (IntPtr ptr = files; Marshal.ReadIntPtr(ptr) != IntPtr.Zero; ptr = IntPtr.Add(ptr, IntPtr.Size))
{
var strPtr = (IntPtr)Marshal.PtrToStructure(ptr, typeof(IntPtr));
var str = Marshal.PtrToStringAnsi(strPtr);
if (System.IO.File.Exists(str)) { yield return str; } // the lib seems to be returning directories. boo!
}
Interop.PHYSFS_freeList(files);
}
/// <summary>
@ -586,7 +591,7 @@ namespace SharpPhysFS
public string GetMountPoint(string dir)
{
var s = Marshal.PtrToStringAnsi(Interop.PHYSFS_getMountPoint(dir));
if(s == null)
if (s == null)
{
throw new PhysFSException(this);
}
@ -601,7 +606,7 @@ namespace SharpPhysFS
c(obj, s);
};
}
void GetCdRomDirsCallback(StringCallback c, object data)
{
GCHandle objHandle = GCHandle.Alloc(data);
@ -632,7 +637,7 @@ namespace SharpPhysFS
{
Interop.PHYSFS_getCdRomDirsCallback((p, s) => c(s), IntPtr.Zero);
}
void GetSearchPathCallback(StringCallback c, object data)
{
GCHandle objHandle = GCHandle.Alloc(data);
@ -663,7 +668,7 @@ namespace SharpPhysFS
{
Interop.PHYSFS_getSearchPathCallback((p, s) => c(s), IntPtr.Zero);
}
void EnumerateFilesCallback(string dir, EnumFilesCallback c, object data)
{
GCHandle objHandle = GCHandle.Alloc(data);
@ -736,11 +741,12 @@ namespace SharpPhysFS
disposedValue = true;
}
}
~PhysFS() {
~PhysFS()
{
Dispose(false);
}
public void Dispose()
{
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.

View File

@ -1,36 +0,0 @@
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("Managed wrapper around PhysFS")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Francesco Bertolaccini")]
[assembly: AssemblyProduct("SharpPhysFS")]
[assembly: AssemblyCopyright("")]
[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("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]

View File

@ -1,92 +1,15 @@
<?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')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<Version>1.0.0</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>.NET wrapper for PhysFS</Description>
<PackageId>SharpPhysFS</PackageId>
<RootNamespace>SharpPhysFS</RootNamespace>
<Product>SharpPhysFS</Product>
<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>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<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>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="PhysFS.cs" />
<Compile Include="Interop.cs" />
<Compile Include="PhysFS.LowLevel.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>
<Import Project=".\build\copylibs.targets"/>
</Project>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<dllmap os="!windows" dll="physfs.dll" target="libphysfs.so" />
</configuration>

View File

@ -1,36 +0,0 @@
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("Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Test")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("e1d09413-14f4-4c29-bd06-b6e7d38b80cd")]
// 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")]

View File

@ -1,106 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.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')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E1D09413-14F4-4C29-BD06-B6E7D38B80CD}</ProjectGuid>
<TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Test</RootNamespace>
<AssemblyName>Test</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<IsPackable>false</IsPackable>
</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.Net.Http" />
<Reference Include="System.Xml" />
<ProjectReference Include="..\SharpPhysFS\SharpPhysFS.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SharpPhysFS\SharpPhysFS.csproj">
<Project>{ad6aa182-8c7f-4f3a-aaef-7bd993d1d262}</Project>
<Name>SharpPhysFS</Name>
</ProjectReference>
</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>
</Project>

View File

@ -1,36 +0,0 @@
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("UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTests")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[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("f1848cf4-b858-4f6d-a1ce-032633be3c28")]
// 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")]

View File

@ -16,7 +16,7 @@ namespace UnitTests
}
[Theory]
[InlineData(2, 1, 0)]
[InlineData(3, 0, 2)]
void VersionCheck(byte major, byte minor, byte patch)
{
using (var pfs = new PhysFS(""))
@ -79,9 +79,10 @@ namespace UnitTests
{
pfs.Mount("./", "/", false);
System.Console.WriteLine(Path.GetFullPath("./"));
var effectiveFiles = Directory.GetFiles("./").Select(x => Path.GetFileName(x)).ToArray();
Array.Sort(effectiveFiles);
var enumeratedFiles = pfs.EnumerateFiles("/");
var enumeratedFiles = pfs.EnumerateFiles("/").ToArray();
Array.Sort(enumeratedFiles);
Assert.Equal(effectiveFiles, enumeratedFiles);
@ -91,7 +92,7 @@ namespace UnitTests
[Fact]
void DriveEnumeration()
{
using(var pfs = new PhysFS(""))
using (var pfs = new PhysFS(""))
{
var effectiveCdDrives = DriveInfo.GetDrives()
.Where(x => x.DriveType == DriveType.CDRom)
@ -110,7 +111,7 @@ namespace UnitTests
[Fact]
void UserDirectory()
{
using(var pfs = new PhysFS(""))
using (var pfs = new PhysFS(""))
{
var userDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
var pfsUserDirectory = pfs.GetUserDir();
@ -121,7 +122,7 @@ namespace UnitTests
[Fact]
void DirectoryManipulation()
{
using(var pfs = new PhysFS(""))
using (var pfs = new PhysFS(""))
{
pfs.SetWriteDir("./");
Assert.Equal("./", pfs.GetWriteDir());
@ -141,8 +142,8 @@ namespace UnitTests
{
pfs.SetWriteDir("./");
pfs.Mount("./", "/", true);
using(var sw = new StreamWriter(pfs.OpenWrite("foo")))
using (var sw = new StreamWriter(pfs.OpenWrite("foo")))
{
sw.Write("hello, world! èòàùã こんにちは世界 你好世界");
}
@ -150,7 +151,7 @@ namespace UnitTests
Assert.True(File.Exists("./foo"));
var fileContent = File.ReadAllText("./foo");
using(var sr = new StreamReader(pfs.OpenRead("foo")))
using (var sr = new StreamReader(pfs.OpenRead("foo")))
{
Assert.Equal(fileContent, sr.ReadToEnd());
}

View File

@ -1,118 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F1848CF4-B858-4F6D-A1CE-032633BE3C28}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnitTests</RootNamespace>
<AssemblyName>UnitTests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</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>
<PlatformTarget>x86</PlatformTarget>
</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>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<TargetFramework>netcoreapp3.0</TargetFramework>
<IsPackable>false</IsPackable>
</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.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll</HintPath>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll</HintPath>
</Reference>
<ProjectReference Include="..\SharpPhysFS\SharpPhysFS.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="Tests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<PackageReference Include="xunit" Version="2.4.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SharpPhysFS\SharpPhysFS.csproj">
<Project>{ad6aa182-8c7f-4f3a-aaef-7bd993d1d262}</Project>
<Name>SharpPhysFS</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
</Project>
</Project>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="2.2.0" targetFramework="net452" />
<package id="xunit.abstractions" version="2.0.1" targetFramework="net452" />
<package id="xunit.assert" version="2.2.0" targetFramework="net452" />
<package id="xunit.core" version="2.2.0" targetFramework="net452" />
<package id="xunit.extensibility.core" version="2.2.0" targetFramework="net452" />
<package id="xunit.extensibility.execution" version="2.2.0" targetFramework="net452" />
<package id="xunit.runner.console" version="2.2.0" targetFramework="net452" developmentDependency="true" />
<package id="xunit.runner.visualstudio" version="2.2.0" targetFramework="net452" developmentDependency="true" />
</packages>