|
|
|
@ -12,7 +12,7 @@ namespace Test
|
|
|
|
|
{
|
|
|
|
|
Console.Write("Supported archive types: ");
|
|
|
|
|
bool any = false;
|
|
|
|
|
foreach (var archive in PhysFS.PhysFS.SupportedArchiveTypes())
|
|
|
|
|
foreach (var archive in SharpPhysFS.PhysFS.SupportedArchiveTypes())
|
|
|
|
|
{
|
|
|
|
|
any = true;
|
|
|
|
|
Console.WriteLine("\n - {0}: {1}", archive.extension, archive.description);
|
|
|
|
@ -101,7 +101,7 @@ namespace Test
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -113,7 +113,7 @@ namespace Test
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var f in PhysFS.PhysFS.EnumerateFiles(args[0]))
|
|
|
|
|
foreach (var f in SharpPhysFS.PhysFS.EnumerateFiles(args[0]))
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(" - {0}", f);
|
|
|
|
|
}
|
|
|
|
@ -122,19 +122,19 @@ namespace Test
|
|
|
|
|
|
|
|
|
|
static bool GetLastError(string[] args)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(PhysFS.PhysFS.GetLastError());
|
|
|
|
|
Console.WriteLine(SharpPhysFS.PhysFS.GetLastError());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool GetDirSeparator(string[] args)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(PhysFS.PhysFS.GetDirSeparator());
|
|
|
|
|
Console.WriteLine(SharpPhysFS.PhysFS.GetDirSeparator());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool GetCdRomDirectories(string[] args)
|
|
|
|
|
{
|
|
|
|
|
foreach(var d in PhysFS.PhysFS.GetCdRomDirs())
|
|
|
|
|
foreach(var d in SharpPhysFS.PhysFS.GetCdRomDirs())
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(" - {0}", d);
|
|
|
|
|
}
|
|
|
|
@ -143,7 +143,7 @@ namespace Test
|
|
|
|
|
|
|
|
|
|
static bool GetSearchPath(string[] args)
|
|
|
|
|
{
|
|
|
|
|
foreach (var d in PhysFS.PhysFS.GetSearchPath())
|
|
|
|
|
foreach (var d in SharpPhysFS.PhysFS.GetSearchPath())
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(" - {0}", d);
|
|
|
|
|
}
|
|
|
|
@ -152,19 +152,19 @@ namespace Test
|
|
|
|
|
|
|
|
|
|
static bool GetBaseDirectory(string[] args)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(PhysFS.PhysFS.GetBaseDir());
|
|
|
|
|
Console.WriteLine(SharpPhysFS.PhysFS.GetBaseDir());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool GetUserDirectory(string[] args)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(PhysFS.PhysFS.GetUserDir());
|
|
|
|
|
Console.WriteLine(SharpPhysFS.PhysFS.GetUserDir());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool GetWriteDirectory(string[] args)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(PhysFS.PhysFS.GetWriteDir());
|
|
|
|
|
Console.WriteLine(SharpPhysFS.PhysFS.GetWriteDir());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -175,7 +175,7 @@ namespace Test
|
|
|
|
|
Console.WriteLine("Usage: setwritedir <dir>");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
PhysFS.PhysFS.SetWriteDir(args[0]);
|
|
|
|
|
SharpPhysFS.PhysFS.SetWriteDir(args[0]);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -191,7 +191,7 @@ namespace Test
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Usage: permitsymlinks <true/false>");
|
|
|
|
|
}
|
|
|
|
|
PhysFS.PhysFS.PermitSymbolicLinks(permit);
|
|
|
|
|
SharpPhysFS.PhysFS.PermitSymbolicLinks(permit);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -205,7 +205,7 @@ namespace Test
|
|
|
|
|
bool includeCdRoms, 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
|
|
|
|
|
{
|
|
|
|
@ -221,7 +221,7 @@ namespace Test
|
|
|
|
|
Console.WriteLine("Usage: mkdir <dir>");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
PhysFS.PhysFS.Mkdir(args[0]);
|
|
|
|
|
SharpPhysFS.PhysFS.Mkdir(args[0]);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -232,7 +232,7 @@ namespace Test
|
|
|
|
|
Console.WriteLine("Usage: delete <dir>");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
PhysFS.PhysFS.Delete(args[0]);
|
|
|
|
|
SharpPhysFS.PhysFS.Delete(args[0]);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -243,7 +243,7 @@ namespace Test
|
|
|
|
|
Console.WriteLine("Usage: getrealdir <dir>");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
Console.WriteLine(PhysFS.PhysFS.GetRealDir(args[0]));
|
|
|
|
|
Console.WriteLine(SharpPhysFS.PhysFS.GetRealDir(args[0]));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -254,7 +254,7 @@ namespace Test
|
|
|
|
|
Console.WriteLine("Usage: exists <file>");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
Console.WriteLine(PhysFS.PhysFS.Exists(args[0]));
|
|
|
|
|
Console.WriteLine(SharpPhysFS.PhysFS.Exists(args[0]));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -265,7 +265,7 @@ namespace Test
|
|
|
|
|
Console.WriteLine("Usage: isdir <path>");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
Console.WriteLine(PhysFS.PhysFS.IsDirectory(args[0]));
|
|
|
|
|
Console.WriteLine(SharpPhysFS.PhysFS.IsDirectory(args[0]));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -276,7 +276,7 @@ namespace Test
|
|
|
|
|
Console.WriteLine("Usage: issymlink <path>");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
Console.WriteLine(PhysFS.PhysFS.IsSymbolicLink(args[0]));
|
|
|
|
|
Console.WriteLine(SharpPhysFS.PhysFS.IsSymbolicLink(args[0]));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -287,7 +287,7 @@ namespace Test
|
|
|
|
|
Console.WriteLine("Usage: cat <file>");
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
@ -301,7 +301,7 @@ namespace Test
|
|
|
|
|
Console.WriteLine("Usage: filelength <file>");
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
@ -314,17 +314,17 @@ namespace Test
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
PhysFS.PhysFS.InitializeCallbacks();
|
|
|
|
|
SharpPhysFS.PhysFS.InitializeCallbacks();
|
|
|
|
|
}
|
|
|
|
|
catch (PhysFS.PhysFSLibNotFound)
|
|
|
|
|
catch (SharpPhysFS.PhysFSLibNotFound)
|
|
|
|
|
{
|
|
|
|
|
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?");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
PhysFS.PhysFS.Init("");
|
|
|
|
|
SharpPhysFS.PhysFS.Init("");
|
|
|
|
|
|
|
|
|
|
var version = PhysFS.PhysFS.GetLinkedVersion();
|
|
|
|
|
var version = SharpPhysFS.PhysFS.GetLinkedVersion();
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("SharpPhysFS Test console");
|
|
|
|
|
Console.WriteLine("Loaded PhysFS version: {0}.{1}.{2}", version.major, version.minor, version.patch);
|
|
|
|
@ -380,7 +380,7 @@ namespace Test
|
|
|
|
|
Console.WriteLine("Done.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (PhysFS.PhysFSException e)
|
|
|
|
|
catch (SharpPhysFS.PhysFSException e)
|
|
|
|
|
{
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.Red;
|
|
|
|
|
Console.Error.WriteLine("ERROR: {0}", e.Message);
|
|
|
|
@ -394,7 +394,7 @@ namespace Test
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PhysFS.PhysFS.Deinit();
|
|
|
|
|
SharpPhysFS.PhysFS.Deinit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|