Replaced PhysFS.NET with a README pointing to more modern C# bindings.
This commit is contained in:
parent
2b060f8127
commit
cec3dad0aa
|
@ -1,58 +0,0 @@
|
||||||
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("")]
|
|
|
@ -1,113 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
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
|
|
|
@ -1,189 +0,0 @@
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,194 +0,0 @@
|
||||||
/* PhysFSFileStream.cs - (c)2003 Gregory S. Read */
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace PhysFS_NET
|
|
||||||
{
|
|
||||||
public enum PhysFSFileMode {Read, Write, Append};
|
|
||||||
|
|
||||||
// Our exception class we'll use for throwing all PhysFS API related exception
|
|
||||||
public class PhysFSException : IOException
|
|
||||||
{
|
|
||||||
public PhysFSException(string Message) : base(Message) {}
|
|
||||||
public PhysFSException() : base(PhysFS_DLL.PHYSFS_getLastError()) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
public unsafe class PhysFSFileStream : Stream
|
|
||||||
{
|
|
||||||
// ***Public properties***
|
|
||||||
public override bool CanRead
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// Reading is supported
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanSeek
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// Seek is supported
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanWrite
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// Writing is supported
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override long Length
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
long TempLength;
|
|
||||||
TempLength = PhysFS_DLL.PHYSFS_fileLength(pHandle);
|
|
||||||
|
|
||||||
// If call returned an error, throw an exception
|
|
||||||
if(TempLength == -1)
|
|
||||||
throw new PhysFSException();
|
|
||||||
|
|
||||||
return TempLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override long Position
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
long TempPosition;
|
|
||||||
TempPosition = PhysFS_DLL.PHYSFS_tell(pHandle);
|
|
||||||
|
|
||||||
// If call returned an error, throw an exception
|
|
||||||
if(TempPosition == -1)
|
|
||||||
throw new PhysFSException();
|
|
||||||
|
|
||||||
return TempPosition;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
// Seek from beginning of file using the position value
|
|
||||||
Seek(value, SeekOrigin.Begin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***Public methods***
|
|
||||||
public PhysFSFileStream(string FileName, PhysFSFileMode FileMode, ulong BufferSize)
|
|
||||||
{
|
|
||||||
// Open the specified file with the appropriate file access
|
|
||||||
switch(FileMode)
|
|
||||||
{
|
|
||||||
case PhysFSFileMode.Read:
|
|
||||||
pHandle = PhysFS_DLL.PHYSFS_openRead(FileName);
|
|
||||||
break;
|
|
||||||
case PhysFSFileMode.Write:
|
|
||||||
pHandle = PhysFS_DLL.PHYSFS_openWrite(FileName);
|
|
||||||
break;
|
|
||||||
case PhysFSFileMode.Append:
|
|
||||||
pHandle = PhysFS_DLL.PHYSFS_openAppend(FileName);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new PhysFSException("Invalid FileMode specified");
|
|
||||||
}
|
|
||||||
|
|
||||||
// If handle is null, an error occured, so raise an exception
|
|
||||||
//!!! Does object get created if exception is thrown?
|
|
||||||
if(pHandle == null)
|
|
||||||
throw new PhysFSException();
|
|
||||||
|
|
||||||
// Set buffer size, raise an exception if an error occured
|
|
||||||
if(PhysFS_DLL.PHYSFS_setBuffer(pHandle, BufferSize) == 0)
|
|
||||||
throw new PhysFSException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This constructor sets the buffer size to 0 if not specified
|
|
||||||
public PhysFSFileStream(string FileName, PhysFSFileMode FileMode) : this(FileName, FileMode, 0) {}
|
|
||||||
|
|
||||||
~PhysFSFileStream()
|
|
||||||
{
|
|
||||||
// Don't close the handle if they've specifically closed it already
|
|
||||||
if(!Closed)
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Flush()
|
|
||||||
{
|
|
||||||
if(PhysFS_DLL.PHYSFS_flush(pHandle) == 0)
|
|
||||||
throw new PhysFSException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int Read(byte[] buffer, int offset, int count)
|
|
||||||
{
|
|
||||||
long RetValue;
|
|
||||||
|
|
||||||
fixed(byte *pbytes = &buffer[offset])
|
|
||||||
{
|
|
||||||
// Read into our allocated pointer
|
|
||||||
RetValue = PhysFS_DLL.PHYSFS_read(pHandle, pbytes, sizeof(byte), (uint)count);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(RetValue == -1)
|
|
||||||
throw new PhysFSException();
|
|
||||||
|
|
||||||
// Return number of bytes read
|
|
||||||
// Note: This cast should be safe since we are only reading 'count' items, which
|
|
||||||
// is of type 'int'.
|
|
||||||
return (int)RetValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Write(byte[] buffer, int offset, int count)
|
|
||||||
{
|
|
||||||
long RetValue;
|
|
||||||
|
|
||||||
fixed(byte* pbytes = &buffer[offset])
|
|
||||||
{
|
|
||||||
// Write buffer
|
|
||||||
RetValue = PhysFS_DLL.PHYSFS_write(pHandle, pbytes, sizeof(byte), (uint)count);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(RetValue == -1)
|
|
||||||
throw new PhysFSException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override long Seek(long offset, SeekOrigin origin)
|
|
||||||
{
|
|
||||||
// Only seeking from beginning is supported by PhysFS API
|
|
||||||
if(origin != SeekOrigin.Begin)
|
|
||||||
throw new PhysFSException("Only seek origin of \"Begin\" is supported");
|
|
||||||
|
|
||||||
// Seek to specified offset, raise an exception if error occured
|
|
||||||
if(PhysFS_DLL.PHYSFS_seek(pHandle, (ulong)offset) == 0)
|
|
||||||
throw new PhysFSException();
|
|
||||||
|
|
||||||
// Since we always seek from beginning, the offset is always
|
|
||||||
// the absolute position.
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SetLength(long value)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException("SetLength method not supported in PhysFSFileStream objects.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Close()
|
|
||||||
{
|
|
||||||
// Close the handle
|
|
||||||
if(PhysFS_DLL.PHYSFS_close(pHandle) == 0)
|
|
||||||
throw new PhysFSException();
|
|
||||||
|
|
||||||
// File has been closed. Rock.
|
|
||||||
Closed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***Private variables***
|
|
||||||
private void *pHandle;
|
|
||||||
private bool Closed = false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,113 +0,0 @@
|
||||||
/* PhysFS_DLL - (c)2003 Gregory S. Read
|
|
||||||
* Internal class that provides direct access to the PhysFS DLL. It is
|
|
||||||
* not accessible outside of the PhysFS.NET assembly.
|
|
||||||
*/
|
|
||||||
using System.Collections;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace PhysFS_NET
|
|
||||||
{
|
|
||||||
internal class PhysFS_DLL
|
|
||||||
{
|
|
||||||
/* Static constructor
|
|
||||||
* Initializes the PhysFS API before any method is called in this class. This
|
|
||||||
* relieves the user from having to explicitly initialize the API.
|
|
||||||
* Parameters
|
|
||||||
* none
|
|
||||||
* Returns
|
|
||||||
* none
|
|
||||||
* Exceptions
|
|
||||||
* PhysFSException - An error occured in the PhysFS API
|
|
||||||
*/
|
|
||||||
static PhysFS_DLL()
|
|
||||||
{
|
|
||||||
if(PHYSFS_init("") == 0)
|
|
||||||
throw new PhysFSException();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* BytePPToArray
|
|
||||||
* Converts a C-style string array into a .NET managed string array
|
|
||||||
* Parameters
|
|
||||||
* C-style string array pointer returned from PhysFS
|
|
||||||
* Returns
|
|
||||||
* .NET managed string array
|
|
||||||
* Exceptions
|
|
||||||
* none
|
|
||||||
*/
|
|
||||||
public unsafe static string[] BytePPToArray(byte **bytearray)
|
|
||||||
{
|
|
||||||
byte** ptr;
|
|
||||||
byte* c;
|
|
||||||
string tempstr;
|
|
||||||
ArrayList MyArrayList = new ArrayList();
|
|
||||||
string[] RetArray;
|
|
||||||
|
|
||||||
for(ptr = bytearray; *ptr != null; ptr++)
|
|
||||||
{
|
|
||||||
tempstr = "";
|
|
||||||
for(c = *ptr; *c != 0; c++)
|
|
||||||
{
|
|
||||||
tempstr += (char)*c;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add string to our list
|
|
||||||
MyArrayList.Add(tempstr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return a normal array of the list
|
|
||||||
RetArray = new string[MyArrayList.Count];
|
|
||||||
MyArrayList.CopyTo(RetArray, 0);
|
|
||||||
return RetArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Name of DLL to import
|
|
||||||
private const string PHYSFS_DLLNAME = "physfs.dll";
|
|
||||||
|
|
||||||
// DLL import declarations
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_init(string argv0);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_deinit();
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe void PHYSFS_freeList(void *listVar);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern string PHYSFS_getLastError();
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern string PHYSFS_getDirSeparator();
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern void PHYSFS_permitSymbolicLinks(int allow);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe byte** PHYSFS_getCdRomDirs();
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern string PHYSFS_getBaseDir();
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern string PHYSFS_getUserDir();
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern string PHYSFS_getWriteDir();
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_setWriteDir(string newDir);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_addToSearchPath(string newDir, int appendToPath);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_removeFromSearchPath(string oldDir);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe byte** PHYSFS_getSearchPath();
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_setSaneConfig(string organization,
|
|
||||||
string appName,
|
|
||||||
string archiveExt,
|
|
||||||
int includeCdRoms,
|
|
||||||
int archivesFirst);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_mkdir(string dirName);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_delete(string filename);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern string PHYSFS_getRealDir(string filename);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe byte** PHYSFS_enumerateFiles(string dir);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_exists(string fname);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_isDirectory(string fname);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern int PHYSFS_isSymbolicLink(string fname);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe void* PHYSFS_openWrite(string filename);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe void* PHYSFS_openAppend(string filename);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe void* PHYSFS_openRead(string filename);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe int PHYSFS_close(void* handle);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe long PHYSFS_getLastModTime(string filename);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe long PHYSFS_read(void* handle,
|
|
||||||
void *buffer,
|
|
||||||
uint objSize,
|
|
||||||
uint objCount);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe long PHYSFS_write(void* handle,
|
|
||||||
void *buffer,
|
|
||||||
uint objSize,
|
|
||||||
uint objCount);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe int PHYSFS_eof(void* handle);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe long PHYSFS_tell(void* handle);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe int PHYSFS_seek(void* handle, ulong pos);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe long PHYSFS_fileLength(void* handle);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe int PHYSFS_setBuffer(void* handle, ulong bufsize);
|
|
||||||
[DllImport(PHYSFS_DLLNAME)] public static extern unsafe int PHYSFS_flush(void* handle);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
PhysFS.NET is a library that encapsulates the PhysFS API into a .NET assembly.
|
|
||||||
|
|
||||||
There are two class objects that are exposed in the assembly:
|
|
||||||
PhysFS.cs
|
|
||||||
This class exposes any non-filehandle specific functionality contained in
|
|
||||||
the PhysFS library.
|
|
||||||
PhysFSFileStream.cs
|
|
||||||
A System.IO.Stream derived class which provides file access via the
|
|
||||||
PhysFS API. Usage of this object is identical to a standard stream
|
|
||||||
object.
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
|
@ -1,58 +0,0 @@
|
||||||
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("")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("")]
|
|
||||||
[assembly: AssemblyCopyright("")]
|
|
||||||
[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("")]
|
|
|
@ -1,116 +0,0 @@
|
||||||
<VisualStudioProject>
|
|
||||||
<CSHARP
|
|
||||||
ProjectType = "Local"
|
|
||||||
ProductVersion = "7.0.9466"
|
|
||||||
SchemaVersion = "1.0"
|
|
||||||
ProjectGuid = "{9C1ECC6B-16C7-42B3-BF7C-8BA8D81BA980}"
|
|
||||||
>
|
|
||||||
<Build>
|
|
||||||
<Settings
|
|
||||||
ApplicationIcon = "App.ico"
|
|
||||||
AssemblyKeyContainerName = ""
|
|
||||||
AssemblyName = "TestApp"
|
|
||||||
AssemblyOriginatorKeyFile = ""
|
|
||||||
DefaultClientScript = "JScript"
|
|
||||||
DefaultHTMLPageLayout = "Grid"
|
|
||||||
DefaultTargetSchema = "IE50"
|
|
||||||
DelaySign = "false"
|
|
||||||
OutputType = "WinExe"
|
|
||||||
RootNamespace = "TestApp"
|
|
||||||
StartupObject = ""
|
|
||||||
>
|
|
||||||
<Config
|
|
||||||
Name = "Debug"
|
|
||||||
AllowUnsafeBlocks = "false"
|
|
||||||
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 = "false"
|
|
||||||
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.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"
|
|
||||||
/>
|
|
||||||
<Reference
|
|
||||||
Name = "System.XML"
|
|
||||||
AssemblyName = "System.Xml"
|
|
||||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
|
|
||||||
/>
|
|
||||||
<Reference
|
|
||||||
Name = "PhysFS.NET"
|
|
||||||
Project = "{C6205A43-3D4D-41E6-872C-96CD7BE55230}"
|
|
||||||
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
|
|
||||||
/>
|
|
||||||
</References>
|
|
||||||
</Build>
|
|
||||||
<Files>
|
|
||||||
<Include>
|
|
||||||
<File
|
|
||||||
RelPath = "App.ico"
|
|
||||||
BuildAction = "Content"
|
|
||||||
/>
|
|
||||||
<File
|
|
||||||
RelPath = "AssemblyInfo.cs"
|
|
||||||
BuildAction = "Compile"
|
|
||||||
/>
|
|
||||||
<File
|
|
||||||
RelPath = "TestAppForm.cs"
|
|
||||||
SubType = "Form"
|
|
||||||
BuildAction = "Compile"
|
|
||||||
/>
|
|
||||||
<File
|
|
||||||
RelPath = "TestAppForm.resx"
|
|
||||||
DependentUpon = "TestAppForm.cs"
|
|
||||||
BuildAction = "EmbeddedResource"
|
|
||||||
/>
|
|
||||||
</Include>
|
|
||||||
</Files>
|
|
||||||
</CSHARP>
|
|
||||||
</VisualStudioProject>
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 7.00
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp.csproj", "{9C1ECC6B-16C7-42B3-BF7C-8BA8D81BA980}"
|
|
||||||
EndProject
|
|
||||||
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
|
|
||||||
{9C1ECC6B-16C7-42B3-BF7C-8BA8D81BA980}.Debug.ActiveCfg = Debug|.NET
|
|
||||||
{9C1ECC6B-16C7-42B3-BF7C-8BA8D81BA980}.Debug.Build.0 = Debug|.NET
|
|
||||||
{9C1ECC6B-16C7-42B3-BF7C-8BA8D81BA980}.Release.ActiveCfg = Release|.NET
|
|
||||||
{9C1ECC6B-16C7-42B3-BF7C-8BA8D81BA980}.Release.Build.0 = Release|.NET
|
|
||||||
{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
|
|
|
@ -1,274 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Collections;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Data;
|
|
||||||
using System.IO;
|
|
||||||
using PhysFS_NET;
|
|
||||||
|
|
||||||
namespace TestApp
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Summary description for Form1.
|
|
||||||
/// </summary>
|
|
||||||
public class TestAppForm : System.Windows.Forms.Form
|
|
||||||
{
|
|
||||||
private System.Windows.Forms.Label label2;
|
|
||||||
private System.Windows.Forms.Button RefreshCDsButton;
|
|
||||||
private System.Windows.Forms.ListBox CDDrivesList;
|
|
||||||
private System.Windows.Forms.ListBox SearchPathList;
|
|
||||||
private System.Windows.Forms.Label label1;
|
|
||||||
private System.Windows.Forms.TextBox EnumFilesPath;
|
|
||||||
private System.Windows.Forms.ListBox EnumList;
|
|
||||||
private System.Windows.Forms.Label label3;
|
|
||||||
private System.Windows.Forms.TextBox NewSearchPathText;
|
|
||||||
private System.Windows.Forms.Button AddSearchPathButton;
|
|
||||||
private System.Windows.Forms.Button RemovePathButton;
|
|
||||||
private System.Windows.Forms.Button RefreshEnumList;
|
|
||||||
private System.Windows.Forms.Button RefreshSearchPathButton;
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.Container components = null;
|
|
||||||
|
|
||||||
public TestAppForm()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Required for Windows Form Designer support
|
|
||||||
//
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
//
|
|
||||||
// TODO: Add any constructor code after InitializeComponent call
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
protected override void Dispose( bool disposing )
|
|
||||||
{
|
|
||||||
if( disposing )
|
|
||||||
{
|
|
||||||
if (components != null)
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
base.Dispose( disposing );
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
|
||||||
this.RefreshCDsButton = new System.Windows.Forms.Button();
|
|
||||||
this.CDDrivesList = new System.Windows.Forms.ListBox();
|
|
||||||
this.SearchPathList = new System.Windows.Forms.ListBox();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.EnumFilesPath = new System.Windows.Forms.TextBox();
|
|
||||||
this.EnumList = new System.Windows.Forms.ListBox();
|
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
|
||||||
this.RefreshEnumList = new System.Windows.Forms.Button();
|
|
||||||
this.NewSearchPathText = new System.Windows.Forms.TextBox();
|
|
||||||
this.AddSearchPathButton = new System.Windows.Forms.Button();
|
|
||||||
this.RemovePathButton = new System.Windows.Forms.Button();
|
|
||||||
this.RefreshSearchPathButton = new System.Windows.Forms.Button();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
this.label2.Location = new System.Drawing.Point(8, 8);
|
|
||||||
this.label2.Name = "label2";
|
|
||||||
this.label2.Size = new System.Drawing.Size(136, 16);
|
|
||||||
this.label2.TabIndex = 2;
|
|
||||||
this.label2.Text = "Available CD-ROM Drives";
|
|
||||||
//
|
|
||||||
// RefreshCDsButton
|
|
||||||
//
|
|
||||||
this.RefreshCDsButton.Location = new System.Drawing.Point(8, 152);
|
|
||||||
this.RefreshCDsButton.Name = "RefreshCDsButton";
|
|
||||||
this.RefreshCDsButton.Size = new System.Drawing.Size(72, 24);
|
|
||||||
this.RefreshCDsButton.TabIndex = 4;
|
|
||||||
this.RefreshCDsButton.Text = "Refresh";
|
|
||||||
this.RefreshCDsButton.Click += new System.EventHandler(this.RefreshCDsButton_Click);
|
|
||||||
//
|
|
||||||
// CDDrivesList
|
|
||||||
//
|
|
||||||
this.CDDrivesList.Location = new System.Drawing.Point(8, 24);
|
|
||||||
this.CDDrivesList.Name = "CDDrivesList";
|
|
||||||
this.CDDrivesList.Size = new System.Drawing.Size(136, 121);
|
|
||||||
this.CDDrivesList.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// SearchPathList
|
|
||||||
//
|
|
||||||
this.SearchPathList.Location = new System.Drawing.Point(152, 24);
|
|
||||||
this.SearchPathList.Name = "SearchPathList";
|
|
||||||
this.SearchPathList.Size = new System.Drawing.Size(248, 95);
|
|
||||||
this.SearchPathList.TabIndex = 8;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.Location = new System.Drawing.Point(152, 8);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(136, 16);
|
|
||||||
this.label1.TabIndex = 10;
|
|
||||||
this.label1.Text = "Search Path";
|
|
||||||
//
|
|
||||||
// EnumFilesPath
|
|
||||||
//
|
|
||||||
this.EnumFilesPath.Location = new System.Drawing.Point(408, 128);
|
|
||||||
this.EnumFilesPath.Name = "EnumFilesPath";
|
|
||||||
this.EnumFilesPath.Size = new System.Drawing.Size(208, 20);
|
|
||||||
this.EnumFilesPath.TabIndex = 11;
|
|
||||||
this.EnumFilesPath.Text = "";
|
|
||||||
//
|
|
||||||
// EnumList
|
|
||||||
//
|
|
||||||
this.EnumList.Location = new System.Drawing.Point(408, 24);
|
|
||||||
this.EnumList.Name = "EnumList";
|
|
||||||
this.EnumList.Size = new System.Drawing.Size(208, 95);
|
|
||||||
this.EnumList.TabIndex = 12;
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
this.label3.Location = new System.Drawing.Point(408, 8);
|
|
||||||
this.label3.Name = "label3";
|
|
||||||
this.label3.Size = new System.Drawing.Size(136, 16);
|
|
||||||
this.label3.TabIndex = 13;
|
|
||||||
this.label3.Text = "Enumerate Files";
|
|
||||||
//
|
|
||||||
// RefreshEnumList
|
|
||||||
//
|
|
||||||
this.RefreshEnumList.Location = new System.Drawing.Point(544, 152);
|
|
||||||
this.RefreshEnumList.Name = "RefreshEnumList";
|
|
||||||
this.RefreshEnumList.Size = new System.Drawing.Size(72, 24);
|
|
||||||
this.RefreshEnumList.TabIndex = 14;
|
|
||||||
this.RefreshEnumList.Text = "Refresh";
|
|
||||||
this.RefreshEnumList.Click += new System.EventHandler(this.RefreshEnumList_Click);
|
|
||||||
//
|
|
||||||
// NewSearchPathText
|
|
||||||
//
|
|
||||||
this.NewSearchPathText.Location = new System.Drawing.Point(152, 128);
|
|
||||||
this.NewSearchPathText.Name = "NewSearchPathText";
|
|
||||||
this.NewSearchPathText.Size = new System.Drawing.Size(248, 20);
|
|
||||||
this.NewSearchPathText.TabIndex = 15;
|
|
||||||
this.NewSearchPathText.Text = "";
|
|
||||||
//
|
|
||||||
// AddSearchPathButton
|
|
||||||
//
|
|
||||||
this.AddSearchPathButton.Location = new System.Drawing.Point(152, 152);
|
|
||||||
this.AddSearchPathButton.Name = "AddSearchPathButton";
|
|
||||||
this.AddSearchPathButton.Size = new System.Drawing.Size(72, 24);
|
|
||||||
this.AddSearchPathButton.TabIndex = 9;
|
|
||||||
this.AddSearchPathButton.Text = "Add Path";
|
|
||||||
this.AddSearchPathButton.Click += new System.EventHandler(this.AddSearchPathButton_Click);
|
|
||||||
//
|
|
||||||
// RemovePathButton
|
|
||||||
//
|
|
||||||
this.RemovePathButton.Location = new System.Drawing.Point(232, 152);
|
|
||||||
this.RemovePathButton.Name = "RemovePathButton";
|
|
||||||
this.RemovePathButton.Size = new System.Drawing.Size(88, 24);
|
|
||||||
this.RemovePathButton.TabIndex = 16;
|
|
||||||
this.RemovePathButton.Text = "Remove Path";
|
|
||||||
this.RemovePathButton.Click += new System.EventHandler(this.RemovePathButton_Click);
|
|
||||||
//
|
|
||||||
// RefreshSearchPathButton
|
|
||||||
//
|
|
||||||
this.RefreshSearchPathButton.Location = new System.Drawing.Point(328, 152);
|
|
||||||
this.RefreshSearchPathButton.Name = "RefreshSearchPathButton";
|
|
||||||
this.RefreshSearchPathButton.Size = new System.Drawing.Size(72, 24);
|
|
||||||
this.RefreshSearchPathButton.TabIndex = 17;
|
|
||||||
this.RefreshSearchPathButton.Text = "Refresh";
|
|
||||||
this.RefreshSearchPathButton.Click += new System.EventHandler(this.RefreshSearchPathButton_Click);
|
|
||||||
//
|
|
||||||
// TestAppForm
|
|
||||||
//
|
|
||||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
|
||||||
this.ClientSize = new System.Drawing.Size(624, 309);
|
|
||||||
this.Controls.AddRange(new System.Windows.Forms.Control[] {
|
|
||||||
this.RefreshSearchPathButton,
|
|
||||||
this.RemovePathButton,
|
|
||||||
this.NewSearchPathText,
|
|
||||||
this.RefreshEnumList,
|
|
||||||
this.label3,
|
|
||||||
this.EnumList,
|
|
||||||
this.EnumFilesPath,
|
|
||||||
this.label1,
|
|
||||||
this.SearchPathList,
|
|
||||||
this.CDDrivesList,
|
|
||||||
this.RefreshCDsButton,
|
|
||||||
this.label2,
|
|
||||||
this.AddSearchPathButton});
|
|
||||||
this.Name = "TestAppForm";
|
|
||||||
this.Text = "PhysFS Test Application";
|
|
||||||
this.Load += new System.EventHandler(this.TestAppForm_Load);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
|
||||||
static void Main()
|
|
||||||
{
|
|
||||||
Application.Run(new TestAppForm());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TestAppForm_Load(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RefreshCDsButton_Click(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
// Clear ths listbox if it contains any items
|
|
||||||
CDDrivesList.Items.Clear();
|
|
||||||
// Add the items to the list
|
|
||||||
CDDrivesList.Items.AddRange(PhysFS.GetCDROMDrives());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RefreshSearchPathButton_Click(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
// Clear ths listbox if it contains any items
|
|
||||||
SearchPathList.Items.Clear();
|
|
||||||
// Add the items to the list
|
|
||||||
SearchPathList.Items.AddRange(PhysFS.GetSearchPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddSearchPathButton_Click(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
// Add search path
|
|
||||||
PhysFS.AddToSearchPath(NewSearchPathText.Text, false);
|
|
||||||
// Clear ths listbox if it contains any items
|
|
||||||
SearchPathList.Items.Clear();
|
|
||||||
// Add the items to the list
|
|
||||||
SearchPathList.Items.AddRange(PhysFS.GetSearchPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RemovePathButton_Click(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
if(SearchPathList.SelectedItem != null)
|
|
||||||
{
|
|
||||||
PhysFS.RemoveFromSearchPath(SearchPathList.SelectedItem.ToString());
|
|
||||||
// Clear ths listbox if it contains any items
|
|
||||||
SearchPathList.Items.Clear();
|
|
||||||
// Add the items to the list
|
|
||||||
SearchPathList.Items.AddRange(PhysFS.GetSearchPath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RefreshEnumList_Click(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
EnumList.Items.Clear();
|
|
||||||
EnumList.Items.AddRange(PhysFS.EnumerateFiles(EnumFilesPath.Text));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,102 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 1.3
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">1.3</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1">this is my long string</data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
[base64 mime encoded serialized .NET Framework object]
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>1.3</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<data name="$this.Name">
|
|
||||||
<value>TestAppForm</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
There used to be C# bindings in this directory, but they have been
|
||||||
|
unmaintained for many years.
|
||||||
|
|
||||||
|
Instead, there is a more modern PhysicsFS wrapper for .NET available.
|
||||||
|
|
||||||
|
You can find it at https://github.com/frabert/SharpPhysFS
|
||||||
|
|
||||||
|
Thanks to Francesco Bertolaccini for his efforts on that project!
|
||||||
|
|
||||||
|
--ryan.
|
||||||
|
|
Loading…
Reference in New Issue