From a75d588690b883f1e333221e1d6acca62643b393 Mon Sep 17 00:00:00 2001 From: thatcosmonaut Date: Thu, 16 Jan 2020 17:06:12 -0800 Subject: [PATCH] updating for latest PhysFS --- .gitignore | 2 + .vscode/launch.json | 27 ++++++ .vscode/tasks.json | 42 +++++++++ LICENSE.md | 5 +- SharpPhysFS/Interop.cs | 92 +++++++++---------- SharpPhysFS/PhysFS.cs | 28 +++--- SharpPhysFS/Properties/AssemblyInfo.cs | 36 -------- SharpPhysFS/SharpPhysFS.csproj | 97 +++----------------- Test/App.config | 7 -- Test/Properties/AssemblyInfo.cs | 36 -------- Test/Test.csproj | 107 ++-------------------- UnitTests/Properties/AssemblyInfo.cs | 36 -------- UnitTests/Tests.cs | 17 ++-- UnitTests/UnitTests.csproj | 120 ++----------------------- UnitTests/packages.config | 11 --- 15 files changed, 171 insertions(+), 492 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json delete mode 100644 SharpPhysFS/Properties/AssemblyInfo.cs delete mode 100644 Test/App.config delete mode 100644 Test/Properties/AssemblyInfo.cs delete mode 100644 UnitTests/Properties/AssemblyInfo.cs delete mode 100644 UnitTests/packages.config diff --git a/.gitignore b/.gitignore index b06e864..2c4d113 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5900d80 --- /dev/null +++ b/.vscode/launch.json @@ -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}" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..c1f935a --- /dev/null +++ b/.vscode/tasks.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md index f7b00b3..421e5b2 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -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. \ No newline at end of file +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. diff --git a/SharpPhysFS/Interop.cs b/SharpPhysFS/Interop.cs index 76818c0..58b7ad6 100644 --- a/SharpPhysFS/Interop.cs +++ b/SharpPhysFS/Interop.cs @@ -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); } } diff --git a/SharpPhysFS/PhysFS.cs b/SharpPhysFS/PhysFS.cs index f3fca75..4c88221 100644 --- a/SharpPhysFS/PhysFS.cs +++ b/SharpPhysFS/PhysFS.cs @@ -172,11 +172,16 @@ namespace SharpPhysFS /// /// /// Directory in platform-independent notation to enumerate. - public string[] EnumerateFiles(string dir) + public IEnumerable EnumerateFiles(string dir) { - var list = new List(); - 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); } /// @@ -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. diff --git a/SharpPhysFS/Properties/AssemblyInfo.cs b/SharpPhysFS/Properties/AssemblyInfo.cs deleted file mode 100644 index c96917e..0000000 --- a/SharpPhysFS/Properties/AssemblyInfo.cs +++ /dev/null @@ -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")] diff --git a/SharpPhysFS/SharpPhysFS.csproj b/SharpPhysFS/SharpPhysFS.csproj index a6da2b4..12235b4 100644 --- a/SharpPhysFS/SharpPhysFS.csproj +++ b/SharpPhysFS/SharpPhysFS.csproj @@ -1,92 +1,15 @@ - - - + - Debug - AnyCPU - {AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262} - Library - Properties + 1.0.0 + netstandard2.0 + .NET wrapper for PhysFS + SharpPhysFS SharpPhysFS + SharpPhysFS SharpPhysFS - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 + true true - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - true - - - true - bin\x64\Debug\ - DEBUG;TRACE - true - full - x64 - prompt - MinimumRecommendedRules.ruleset - - - bin\x64\Release\ - TRACE - true - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - - - true - bin\x86\Debug\ - DEBUG;TRACE - true - full - x86 - prompt - MinimumRecommendedRules.ruleset - - - bin\x86\Release\ - TRACE - true - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset - - - - - - - - - - - - - - \ No newline at end of file + + + diff --git a/Test/App.config b/Test/App.config deleted file mode 100644 index 24fcfab..0000000 --- a/Test/App.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Test/Properties/AssemblyInfo.cs b/Test/Properties/AssemblyInfo.cs deleted file mode 100644 index a897818..0000000 --- a/Test/Properties/AssemblyInfo.cs +++ /dev/null @@ -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")] diff --git a/Test/Test.csproj b/Test/Test.csproj index 761419c..2510a3c 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -1,106 +1,11 @@ - - - + - Debug - AnyCPU - {E1D09413-14F4-4C29-BD06-B6E7D38B80CD} + netcoreapp3.0 Exe - Properties - Test - Test - v4.5.2 - 512 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - true - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - true - - - true - bin\x86\Debug\ - DEBUG;TRACE - full - x86 - prompt - MinimumRecommendedRules.ruleset - true - - - bin\x86\Release\ - TRACE - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset - true + false + - - - - - - - - + - - - - - - - - - - {ad6aa182-8c7f-4f3a-aaef-7bd993d1d262} - SharpPhysFS - - - - - \ No newline at end of file + diff --git a/UnitTests/Properties/AssemblyInfo.cs b/UnitTests/Properties/AssemblyInfo.cs deleted file mode 100644 index c782e86..0000000 --- a/UnitTests/Properties/AssemblyInfo.cs +++ /dev/null @@ -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")] diff --git a/UnitTests/Tests.cs b/UnitTests/Tests.cs index 4bfd698..ca691c7 100644 --- a/UnitTests/Tests.cs +++ b/UnitTests/Tests.cs @@ -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()); } diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index fb2b45e..3315294 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -1,118 +1,14 @@ - - - - + - Debug - AnyCPU - {F1848CF4-B858-4F6D-A1CE-032633BE3C28} - Library - Properties - UnitTests - UnitTests - v4.5.2 - 512 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - x86 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - x86 - - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - - - true - bin\x86\Debug\ - DEBUG;TRACE - full - x86 - prompt - MinimumRecommendedRules.ruleset - - - bin\x86\Release\ - TRACE - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset + netcoreapp3.0 + false + - - - - - - - - - - ..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - - - ..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - - - ..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - - - ..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - + - - + + - - - - - - {ad6aa182-8c7f-4f3a-aaef-7bd993d1d262} - SharpPhysFS - - - - - - - - - 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}. - - - - \ No newline at end of file + diff --git a/UnitTests/packages.config b/UnitTests/packages.config deleted file mode 100644 index 8351e7b..0000000 --- a/UnitTests/packages.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file