Add Test project

pull/2/head
Francesco Bertolaccini 2016-01-28 18:49:32 +01:00
parent 320e2018a8
commit f49799a889
4 changed files with 55 additions and 11 deletions

View File

@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{E1D09413-14F4-4C29-BD06-B6E7D38B80CD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -21,6 +23,10 @@ Global
{AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD6AA182-8C7F-4F3A-AAEF-7BD993D1D262}.Release|Any CPU.Build.0 = Release|Any CPU
{E1D09413-14F4-4C29-BD06-B6E7D38B80CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1D09413-14F4-4C29-BD06-B6E7D38B80CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1D09413-14F4-4C29-BD06-B6E7D38B80CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1D09413-14F4-4C29-BD06-B6E7D38B80CD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -8,17 +8,55 @@ namespace Test
{
class Program
{
static void Main(string[] args)
static void PrintSupportedArchives()
{
PhysFS.PhysFS.InitializeCallbacks();
PhysFS.PhysFS.Init("");
var ver = PhysFS.PhysFS.GetLinkedVersion();
Console.WriteLine("{0}.{1}.{2}", ver.major, ver.minor, ver.patch);
PhysFS.PhysFS.Mount("D:\\", "/", true);
var x = PhysFS.PhysFS.EnumerateFiles("/");
PhysFS.PhysFS.Deinit();
Console.ReadLine();
Console.Write("Supported archive types: ");
bool any = false;
foreach (var archive in PhysFS.PhysFS.SupportedArchiveTypes())
{
any = true;
Console.WriteLine("\n - {0}: {1}", archive.extension, archive.description);
Console.WriteLine(" Written by {0}", archive.author);
Console.Write(" {0}", archive.url);
}
if (!any)
{
Console.WriteLine("NONE.");
}
else
{
Console.WriteLine();
}
}
static void Main(string[] args)
{
try
{
PhysFS.PhysFS.InitializeCallbacks();
}
catch (PhysFS.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("");
var version = PhysFS.PhysFS.GetLinkedVersion();
Console.WriteLine("SharpPhysFS Test console");
Console.WriteLine("Loaded PhysFS version: {0}.{1}.{2}", version.major, version.minor, version.patch);
PrintSupportedArchives();
Console.WriteLine("Type 'help' for a list of commands");
while(true)
{
Console.Write("> ");
var input = Console.ReadLine();
}
PhysFS.PhysFS.Deinit();
}
}
}

View File

@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("64bc088f-bc9b-4c5f-b339-1e9d232ea3f5")]
[assembly: Guid("e1d09413-14f4-4c29-bd06-b6e7d38b80cd")]
// Version information for an assembly consists of the following four values:
//

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{64BC088F-BC9B-4C5F-B339-1E9D232EA3F5}</ProjectGuid>
<ProjectGuid>{E1D09413-14F4-4C29-BD06-B6E7D38B80CD}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Test</RootNamespace>