Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,275 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
|
||
// | ||
// 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("PhysFS.NET")] | ||
[assembly: AssemblyDescription("PhysFS Bindings for .NET")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("PhysFS.NET")] | ||
[assembly: AssemblyCopyright("(c)2003 Gregory S. Read")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// | ||
// 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 Revision and Build Numbers | ||
// by using the '*' as shown below: | ||
|
||
[assembly: AssemblyVersion("1.0.*")] | ||
|
||
// | ||
// In order to sign your assembly you must specify a key to use. Refer to the | ||
// Microsoft .NET Framework documentation for more information on assembly signing. | ||
// | ||
// Use the attributes below to control which key is used for signing. | ||
// | ||
// Notes: | ||
// (*) If no key is specified, the assembly is not signed. | ||
// (*) KeyName refers to a key that has been installed in the Crypto Service | ||
// Provider (CSP) on your machine. KeyFile refers to a file which contains | ||
// a key. | ||
// (*) If the KeyFile and the KeyName values are both specified, the | ||
// following processing occurs: | ||
// (1) If the KeyName can be found in the CSP, that key is used. | ||
// (2) If the KeyName does not exist and the KeyFile does exist, the key | ||
// in the KeyFile is installed into the CSP and used. | ||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. | ||
// When specifying the KeyFile, the location of the KeyFile should be | ||
// relative to the project output directory which is | ||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is | ||
// located in the project directory, you would specify the AssemblyKeyFile | ||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] | ||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework | ||
// documentation for more information on this. | ||
// | ||
[assembly: AssemblyDelaySign(false)] | ||
[assembly: AssemblyKeyFile("")] | ||
[assembly: AssemblyKeyName("")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<VisualStudioProject> | ||
<CSHARP | ||
ProjectType = "Local" | ||
ProductVersion = "7.0.9466" | ||
SchemaVersion = "1.0" | ||
ProjectGuid = "{C6205A43-3D4D-41E6-872C-96CD7BE55230}" | ||
> | ||
<Build> | ||
<Settings | ||
ApplicationIcon = "" | ||
AssemblyKeyContainerName = "" | ||
AssemblyName = "PhysFS.NET" | ||
AssemblyOriginatorKeyFile = "" | ||
DefaultClientScript = "JScript" | ||
DefaultHTMLPageLayout = "Grid" | ||
DefaultTargetSchema = "IE50" | ||
DelaySign = "false" | ||
OutputType = "Library" | ||
RootNamespace = "PhysFS.NET" | ||
StartupObject = "" | ||
> | ||
<Config | ||
Name = "Debug" | ||
AllowUnsafeBlocks = "true" | ||
BaseAddress = "285212672" | ||
CheckForOverflowUnderflow = "false" | ||
ConfigurationOverrideFile = "" | ||
DefineConstants = "DEBUG;TRACE" | ||
DocumentationFile = "" | ||
DebugSymbols = "true" | ||
FileAlignment = "4096" | ||
IncrementalBuild = "true" | ||
Optimize = "false" | ||
OutputPath = "bin\Debug\" | ||
RegisterForComInterop = "false" | ||
RemoveIntegerChecks = "false" | ||
TreatWarningsAsErrors = "false" | ||
WarningLevel = "4" | ||
/> | ||
<Config | ||
Name = "Release" | ||
AllowUnsafeBlocks = "true" | ||
BaseAddress = "285212672" | ||
CheckForOverflowUnderflow = "false" | ||
ConfigurationOverrideFile = "" | ||
DefineConstants = "TRACE" | ||
DocumentationFile = "" | ||
DebugSymbols = "false" | ||
FileAlignment = "4096" | ||
IncrementalBuild = "false" | ||
Optimize = "true" | ||
OutputPath = "bin\Release\" | ||
RegisterForComInterop = "false" | ||
RemoveIntegerChecks = "false" | ||
TreatWarningsAsErrors = "false" | ||
WarningLevel = "4" | ||
/> | ||
</Settings> | ||
<References> | ||
<Reference | ||
Name = "System" | ||
AssemblyName = "System" | ||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll" | ||
/> | ||
<Reference | ||
Name = "System.Data" | ||
AssemblyName = "System.Data" | ||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll" | ||
/> | ||
<Reference | ||
Name = "System.XML" | ||
AssemblyName = "System.Xml" | ||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" | ||
/> | ||
<Reference | ||
Name = "System.Drawing" | ||
AssemblyName = "System.Drawing" | ||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll" | ||
/> | ||
<Reference | ||
Name = "System.Windows.Forms" | ||
AssemblyName = "System.Windows.Forms" | ||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll" | ||
/> | ||
</References> | ||
</Build> | ||
<Files> | ||
<Include> | ||
<File | ||
RelPath = "AssemblyInfo.cs" | ||
SubType = "Code" | ||
BuildAction = "Compile" | ||
/> | ||
<File | ||
RelPath = "PhysFS.cs" | ||
SubType = "Code" | ||
BuildAction = "Compile" | ||
/> | ||
<File | ||
RelPath = "PhysFS_DLL.cs" | ||
SubType = "Code" | ||
BuildAction = "Compile" | ||
/> | ||
<File | ||
RelPath = "PhysFSFileStream.cs" | ||
SubType = "Code" | ||
BuildAction = "Compile" | ||
/> | ||
</Include> | ||
</Files> | ||
</CSHARP> | ||
</VisualStudioProject> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Microsoft Visual Studio Solution File, Format Version 7.00 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysFS.NET", "PhysFS.NET.csproj", "{C6205A43-3D4D-41E6-872C-96CD7BE55230}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfiguration) = preSolution | ||
ConfigName.0 = Debug | ||
ConfigName.1 = Release | ||
EndGlobalSection | ||
GlobalSection(ProjectDependencies) = postSolution | ||
EndGlobalSection | ||
GlobalSection(ProjectConfiguration) = postSolution | ||
{C6205A43-3D4D-41E6-872C-96CD7BE55230}.Debug.ActiveCfg = Debug|.NET | ||
{C6205A43-3D4D-41E6-872C-96CD7BE55230}.Debug.Build.0 = Debug|.NET | ||
{C6205A43-3D4D-41E6-872C-96CD7BE55230}.Release.ActiveCfg = Release|.NET | ||
{C6205A43-3D4D-41E6-872C-96CD7BE55230}.Release.Build.0 = Release|.NET | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityAddIns) = postSolution | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
/* PhysFS.cs - (c)2003 Gregory S. Read | ||
* Provides access to PhysFS API calls not specific to file handle access. | ||
*/ | ||
using System; | ||
|
||
namespace PhysFS_NET | ||
{ | ||
public class PhysFS | ||
{ | ||
/* Initialize | ||
* Inits the PhysFS API. This normally does not need to be called unless | ||
* the API has been manually deinitialized since the PhysFS_DLL class | ||
* initializes just before the first call is made into the DLL. | ||
* Parameters | ||
* none | ||
* Returns | ||
* none | ||
* Exceptions | ||
* PhysFSException - An error occured in the PhysFS API | ||
*/ | ||
public static void Initialize() | ||
{ | ||
// Initialize the physfs library, raise an exception if error | ||
if(PhysFS_DLL.PHYSFS_init("") == 0) | ||
throw new PhysFSException(); | ||
} | ||
|
||
/* Deinitialize | ||
* Deinits the PhysFS API. It is recommended that this method be called | ||
* by the application before exiting in order to gracefully deallocate | ||
* resources and close all filehandles, etc. | ||
* Parameters | ||
* none | ||
* Returns | ||
* none | ||
* Exceptions | ||
* PhysFSException - An error occured in the PhysFS API | ||
*/ | ||
public static void Deinitialize() | ||
{ | ||
// Deinit, raise an exception if an error occured | ||
if(PhysFS_DLL.PHYSFS_deinit() == 0) | ||
throw new PhysFSException(); | ||
} | ||
|
||
/* BaseDir | ||
* Gets the base directory configured for PhysFS. See the PhysFS API | ||
* documentation for more information. | ||
* Parameters | ||
* none | ||
* Returns | ||
* A string value representing the Base Directory | ||
* Exceptions | ||
* none | ||
*/ | ||
public static string BaseDir | ||
{ | ||
get | ||
{ | ||
// Return the current base directory | ||
return PhysFS_DLL.PHYSFS_getBaseDir(); | ||
} | ||
} | ||
|
||
/* WriteDir | ||
* Gets or sets the write directory configured for PhysFS. See the PhysFS API | ||
* documentation for more information. | ||
* Parameters | ||
* set - Path to set the WriteDir property to | ||
* Returns | ||
* A string value representing the Write Directory | ||
* Exceptions | ||
* PhysFSException - An error occured in the PhysFS API when | ||
* settings the write directory. | ||
*/ | ||
public static string WriteDir | ||
{ | ||
get | ||
{ | ||
// Return the current write directory | ||
return PhysFS_DLL.PHYSFS_getWriteDir(); | ||
} | ||
set | ||
{ | ||
// Set the write directory and raise an exception if an error occured | ||
if(PhysFS_DLL.PHYSFS_setWriteDir(value) == 0) | ||
throw new PhysFSException(); | ||
} | ||
} | ||
|
||
/* UserDir | ||
* Gets or sets the write directory configured for PhysFS. See the PhysFS API | ||
* documentation for more information. | ||
* Parameters | ||
* set - Path to set the WriteDir property to | ||
* Returns | ||
* A string value representing the Write Directory | ||
* Exceptions | ||
* PhysFSException - An error occured in the PhysFS API when | ||
* settings the write directory. | ||
*/ | ||
public static string UserDir | ||
{ | ||
get | ||
{ | ||
// Return the current user directory | ||
return PhysFS_DLL.PHYSFS_getUserDir(); | ||
} | ||
} | ||
public static void AddToSearchPath(string NewDir, bool Append) | ||
{ | ||
if(PhysFS_DLL.PHYSFS_addToSearchPath(NewDir, Append?1:0) == 0) | ||
throw new PhysFSException(); | ||
} | ||
public static void RemoveFromSearchPath(string OldDir) | ||
{ | ||
if(PhysFS_DLL.PHYSFS_removeFromSearchPath(OldDir) == 0) | ||
throw new PhysFSException(); | ||
} | ||
public unsafe static string[] GetSearchPath() | ||
{ | ||
byte** p; // Searchpath list from PhysFS dll | ||
string[] pathlist; // List converted to an array | ||
|
||
// Get the CDROM drive listing | ||
p = PhysFS_DLL.PHYSFS_getSearchPath(); | ||
// Convert the C-style array to a .NET style array | ||
pathlist = PhysFS_DLL.BytePPToArray(p); | ||
// Free the original list since we're done with it | ||
PhysFS_DLL.PHYSFS_freeList(p); | ||
|
||
return pathlist; | ||
} | ||
public unsafe static string[] GetCDROMDrives() | ||
{ | ||
byte** p; // CDROM list from PhysFS dll | ||
string[] cdromlist; // List converted to an array | ||
|
||
// Get the CDROM drive listing | ||
p = PhysFS_DLL.PHYSFS_getCdRomDirs(); | ||
// Convert the C-style array to a .NET style array | ||
cdromlist = PhysFS_DLL.BytePPToArray(p); | ||
// Free the original list since we're done with it | ||
PhysFS_DLL.PHYSFS_freeList(p); | ||
|
||
return cdromlist; | ||
} | ||
public static void MkDir(string Dirname) | ||
{ | ||
if(PhysFS_DLL.PHYSFS_mkdir(Dirname) == 0) | ||
throw new PhysFSException(); | ||
} | ||
public static void Delete(string Filename) | ||
{ | ||
if(PhysFS_DLL.PHYSFS_delete(Filename) == 0) | ||
throw new PhysFSException(); | ||
} | ||
public static string GetRealDir(string Filename) | ||
{ | ||
string RetValue; | ||
|
||
RetValue = PhysFS_DLL.PHYSFS_getRealDir(Filename); | ||
if(RetValue == null) | ||
throw new PhysFSException("File not found in search path."); | ||
|
||
// Return the real file path of the specified filename | ||
return RetValue; | ||
} | ||
public unsafe static string[] EnumerateFiles(string Dirname) | ||
{ | ||
byte** p; // File list from PhysFS dll | ||
string[] filelist; // List converted to an array | ||
|
||
// Get the CDROM drive listing | ||
p = PhysFS_DLL.PHYSFS_enumerateFiles(Dirname); | ||
// Convert the C-style array to a .NET style array | ||
filelist = PhysFS_DLL.BytePPToArray(p); | ||
// Free the original list since we're done with it | ||
PhysFS_DLL.PHYSFS_freeList(p); | ||
|
||
return filelist; | ||
} | ||
public static bool IsDirectory(string Filename) | ||
{ | ||
// Return true if non-zero, otherwise return false | ||
return (PhysFS_DLL.PHYSFS_isDirectory(Filename) == 0)?false:true; | ||
} | ||
} | ||
} |
Oops, something went wrong.