From f49799a889dd2cfe9f33d5fe45f675f512d0a3b8 Mon Sep 17 00:00:00 2001 From: Francesco Bertolaccini Date: Thu, 28 Jan 2016 18:49:32 +0100 Subject: [PATCH] Add Test project --- SharpPhysFS.sln | 6 ++++ Test/Program.cs | 56 +++++++++++++++++++++++++++------ Test/Properties/AssemblyInfo.cs | 2 +- Test/Test.csproj | 2 +- 4 files changed, 55 insertions(+), 11 deletions(-) diff --git a/SharpPhysFS.sln b/SharpPhysFS.sln index b89ce99..aeacdfb 100644 --- a/SharpPhysFS.sln +++ b/SharpPhysFS.sln @@ -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 diff --git a/Test/Program.cs b/Test/Program.cs index 102d802..da901ae 100644 --- a/Test/Program.cs +++ b/Test/Program.cs @@ -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(); + } } } diff --git a/Test/Properties/AssemblyInfo.cs b/Test/Properties/AssemblyInfo.cs index 2b8428f..a897818 100644 --- a/Test/Properties/AssemblyInfo.cs +++ b/Test/Properties/AssemblyInfo.cs @@ -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: // diff --git a/Test/Test.csproj b/Test/Test.csproj index 84f9293..e691970 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -4,7 +4,7 @@ Debug AnyCPU - {64BC088F-BC9B-4C5F-B339-1E9D232EA3F5} + {E1D09413-14F4-4C29-BD06-B6E7D38B80CD} Exe Properties Test