Change default namespace to SharpPhysFS
parent
bf96f3fd9c
commit
774c2b8897
|
@ -2,7 +2,7 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace PhysFS
|
namespace SharpPhysFS
|
||||||
{
|
{
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public delegate int InitDelegate();
|
public delegate int InitDelegate();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace PhysFS
|
namespace SharpPhysFS
|
||||||
{
|
{
|
||||||
public class PhysFSException : Exception
|
public class PhysFSException : Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace PhysFS
|
namespace SharpPhysFS
|
||||||
{
|
{
|
||||||
public enum OpenMode
|
public enum OpenMode
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<ProjectGuid>{AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262}</ProjectGuid>
|
<ProjectGuid>{AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>PhysFS</RootNamespace>
|
<RootNamespace>SharpPhysFS</RootNamespace>
|
||||||
<AssemblyName>SharpPhysFS</AssemblyName>
|
<AssemblyName>SharpPhysFS</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Test
|
||||||
{
|
{
|
||||||
Console.Write("Supported archive types: ");
|
Console.Write("Supported archive types: ");
|
||||||
bool any = false;
|
bool any = false;
|
||||||
foreach (var archive in PhysFS.PhysFS.SupportedArchiveTypes())
|
foreach (var archive in SharpPhysFS.PhysFS.SupportedArchiveTypes())
|
||||||
{
|
{
|
||||||
any = true;
|
any = true;
|
||||||
Console.WriteLine("\n - {0}: {1}", archive.extension, archive.description);
|
Console.WriteLine("\n - {0}: {1}", archive.extension, archive.description);
|
||||||
|
@ -101,7 +101,7 @@ namespace Test
|
||||||
Console.WriteLine("append can only be true or false");
|
Console.WriteLine("append can only be true or false");
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysFS.PhysFS.Mount(args[0], args[1], append);
|
SharpPhysFS.PhysFS.Mount(args[0], args[1], append);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ namespace Test
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var f in PhysFS.PhysFS.EnumerateFiles(args[0]))
|
foreach (var f in SharpPhysFS.PhysFS.EnumerateFiles(args[0]))
|
||||||
{
|
{
|
||||||
Console.WriteLine(" - {0}", f);
|
Console.WriteLine(" - {0}", f);
|
||||||
}
|
}
|
||||||
|
@ -122,19 +122,19 @@ namespace Test
|
||||||
|
|
||||||
static bool GetLastError(string[] args)
|
static bool GetLastError(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine(PhysFS.PhysFS.GetLastError());
|
Console.WriteLine(SharpPhysFS.PhysFS.GetLastError());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetDirSeparator(string[] args)
|
static bool GetDirSeparator(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine(PhysFS.PhysFS.GetDirSeparator());
|
Console.WriteLine(SharpPhysFS.PhysFS.GetDirSeparator());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetCdRomDirectories(string[] args)
|
static bool GetCdRomDirectories(string[] args)
|
||||||
{
|
{
|
||||||
foreach(var d in PhysFS.PhysFS.GetCdRomDirs())
|
foreach(var d in SharpPhysFS.PhysFS.GetCdRomDirs())
|
||||||
{
|
{
|
||||||
Console.WriteLine(" - {0}", d);
|
Console.WriteLine(" - {0}", d);
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ namespace Test
|
||||||
|
|
||||||
static bool GetSearchPath(string[] args)
|
static bool GetSearchPath(string[] args)
|
||||||
{
|
{
|
||||||
foreach (var d in PhysFS.PhysFS.GetSearchPath())
|
foreach (var d in SharpPhysFS.PhysFS.GetSearchPath())
|
||||||
{
|
{
|
||||||
Console.WriteLine(" - {0}", d);
|
Console.WriteLine(" - {0}", d);
|
||||||
}
|
}
|
||||||
|
@ -152,19 +152,19 @@ namespace Test
|
||||||
|
|
||||||
static bool GetBaseDirectory(string[] args)
|
static bool GetBaseDirectory(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine(PhysFS.PhysFS.GetBaseDir());
|
Console.WriteLine(SharpPhysFS.PhysFS.GetBaseDir());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetUserDirectory(string[] args)
|
static bool GetUserDirectory(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine(PhysFS.PhysFS.GetUserDir());
|
Console.WriteLine(SharpPhysFS.PhysFS.GetUserDir());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetWriteDirectory(string[] args)
|
static bool GetWriteDirectory(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine(PhysFS.PhysFS.GetWriteDir());
|
Console.WriteLine(SharpPhysFS.PhysFS.GetWriteDir());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ namespace Test
|
||||||
Console.WriteLine("Usage: setwritedir <dir>");
|
Console.WriteLine("Usage: setwritedir <dir>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PhysFS.PhysFS.SetWriteDir(args[0]);
|
SharpPhysFS.PhysFS.SetWriteDir(args[0]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ namespace Test
|
||||||
{
|
{
|
||||||
Console.WriteLine("Usage: permitsymlinks <true/false>");
|
Console.WriteLine("Usage: permitsymlinks <true/false>");
|
||||||
}
|
}
|
||||||
PhysFS.PhysFS.PermitSymbolicLinks(permit);
|
SharpPhysFS.PhysFS.PermitSymbolicLinks(permit);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ namespace Test
|
||||||
bool includeCdRoms, archivesFirst;
|
bool includeCdRoms, archivesFirst;
|
||||||
if(bool.TryParse(args[3], out includeCdRoms) && bool.TryParse(args[4], out archivesFirst))
|
if(bool.TryParse(args[3], out includeCdRoms) && bool.TryParse(args[4], out archivesFirst))
|
||||||
{
|
{
|
||||||
PhysFS.PhysFS.SetSaneConfig(args[0], args[1], args[2], includeCdRoms, archivesFirst);
|
SharpPhysFS.PhysFS.SetSaneConfig(args[0], args[1], args[2], includeCdRoms, archivesFirst);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -221,7 +221,7 @@ namespace Test
|
||||||
Console.WriteLine("Usage: mkdir <dir>");
|
Console.WriteLine("Usage: mkdir <dir>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PhysFS.PhysFS.Mkdir(args[0]);
|
SharpPhysFS.PhysFS.Mkdir(args[0]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ namespace Test
|
||||||
Console.WriteLine("Usage: delete <dir>");
|
Console.WriteLine("Usage: delete <dir>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PhysFS.PhysFS.Delete(args[0]);
|
SharpPhysFS.PhysFS.Delete(args[0]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ namespace Test
|
||||||
Console.WriteLine("Usage: getrealdir <dir>");
|
Console.WriteLine("Usage: getrealdir <dir>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Console.WriteLine(PhysFS.PhysFS.GetRealDir(args[0]));
|
Console.WriteLine(SharpPhysFS.PhysFS.GetRealDir(args[0]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ namespace Test
|
||||||
Console.WriteLine("Usage: exists <file>");
|
Console.WriteLine("Usage: exists <file>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Console.WriteLine(PhysFS.PhysFS.Exists(args[0]));
|
Console.WriteLine(SharpPhysFS.PhysFS.Exists(args[0]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ namespace Test
|
||||||
Console.WriteLine("Usage: isdir <path>");
|
Console.WriteLine("Usage: isdir <path>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Console.WriteLine(PhysFS.PhysFS.IsDirectory(args[0]));
|
Console.WriteLine(SharpPhysFS.PhysFS.IsDirectory(args[0]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ namespace Test
|
||||||
Console.WriteLine("Usage: issymlink <path>");
|
Console.WriteLine("Usage: issymlink <path>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Console.WriteLine(PhysFS.PhysFS.IsSymbolicLink(args[0]));
|
Console.WriteLine(SharpPhysFS.PhysFS.IsSymbolicLink(args[0]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ namespace Test
|
||||||
Console.WriteLine("Usage: cat <file>");
|
Console.WriteLine("Usage: cat <file>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
using (var reader = new System.IO.StreamReader(new PhysFS.PhysFSStream(args[0], PhysFS.OpenMode.Read)))
|
using (var reader = new System.IO.StreamReader(new SharpPhysFS.PhysFSStream(args[0], SharpPhysFS.OpenMode.Read)))
|
||||||
{
|
{
|
||||||
Console.WriteLine(reader.ReadToEnd());
|
Console.WriteLine(reader.ReadToEnd());
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ namespace Test
|
||||||
Console.WriteLine("Usage: filelength <file>");
|
Console.WriteLine("Usage: filelength <file>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
using (var stream = new PhysFS.PhysFSStream(args[0], PhysFS.OpenMode.Read))
|
using (var stream = new SharpPhysFS.PhysFSStream(args[0], SharpPhysFS.OpenMode.Read))
|
||||||
{
|
{
|
||||||
Console.WriteLine(stream.Length);
|
Console.WriteLine(stream.Length);
|
||||||
}
|
}
|
||||||
|
@ -314,17 +314,17 @@ namespace Test
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PhysFS.PhysFS.InitializeCallbacks();
|
SharpPhysFS.PhysFS.InitializeCallbacks();
|
||||||
}
|
}
|
||||||
catch (PhysFS.PhysFSLibNotFound)
|
catch (SharpPhysFS.PhysFSLibNotFound)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
Console.Error.WriteLine("ERROR: PhysFS could not be loaded. Are you sure it is installed or a suitable module is in your working directory?");
|
Console.Error.WriteLine("ERROR: PhysFS could not be loaded. Are you sure it is installed or a suitable module is in your working directory?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PhysFS.PhysFS.Init("");
|
SharpPhysFS.PhysFS.Init("");
|
||||||
|
|
||||||
var version = PhysFS.PhysFS.GetLinkedVersion();
|
var version = SharpPhysFS.PhysFS.GetLinkedVersion();
|
||||||
|
|
||||||
Console.WriteLine("SharpPhysFS Test console");
|
Console.WriteLine("SharpPhysFS Test console");
|
||||||
Console.WriteLine("Loaded PhysFS version: {0}.{1}.{2}", version.major, version.minor, version.patch);
|
Console.WriteLine("Loaded PhysFS version: {0}.{1}.{2}", version.major, version.minor, version.patch);
|
||||||
|
@ -380,7 +380,7 @@ namespace Test
|
||||||
Console.WriteLine("Done.");
|
Console.WriteLine("Done.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PhysFS.PhysFSException e)
|
catch (SharpPhysFS.PhysFSException e)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
Console.Error.WriteLine("ERROR: {0}", e.Message);
|
Console.Error.WriteLine("ERROR: {0}", e.Message);
|
||||||
|
@ -394,7 +394,7 @@ namespace Test
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysFS.PhysFS.Deinit();
|
SharpPhysFS.PhysFS.Deinit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue