From 2d3dabe8af2ea4abc51f68891741db360ad11c75 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 17 Jul 2018 04:36:39 +0200 Subject: monogame-patcher: Restructure and add stub tests Mainly this is so we can prepare for running unit tests, so we get the latest version of NUnit and run the console test runner. Currently there is only a dummy test which always succeeds, but it's there so that we can fill out the boilerplate later. I also moved the option definitions into a separate file so they don't clutter up the main file. Signed-off-by: aszlig --- .../build-support/monogame-patcher/src/patcher.cs | 30 +--------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'pkgs/games/build-support/monogame-patcher/src/patcher.cs') diff --git a/pkgs/games/build-support/monogame-patcher/src/patcher.cs b/pkgs/games/build-support/monogame-patcher/src/patcher.cs index c1502ba1..794db98e 100644 --- a/pkgs/games/build-support/monogame-patcher/src/patcher.cs +++ b/pkgs/games/build-support/monogame-patcher/src/patcher.cs @@ -9,14 +9,6 @@ using Mono.Cecil; using CommandLine; -class GenericOptions -{ - [Option('i', "infile", Required=true, HelpText="Input file to transform.")] - public string inputFile { get; set; } - [Option('o', "outfile", HelpText="File to write transformed data to.")] - public string outputFile { get; set; } -} - class Command { protected string infile; protected string outfile; @@ -43,13 +35,6 @@ class Command { } } -[Verb("fix-filestreams", HelpText="Fix System.IO.FileStream constructors" - +" to open files read-only.")] -class FixFileStreamsCmd : GenericOptions { - [Value(0, Required=true, MetaName = "type", HelpText = "Types to patch.")] - public IEnumerable typesToPatch { get; set; } -}; - class FixFileStreams : Command { public FixFileStreams(FixFileStreamsCmd options) : base(options) { var filtered = this.module.Types @@ -99,16 +84,6 @@ class FixFileStreams : Command { } } -[Verb("replace-call", HelpText="Replace calls to types.")] -class ReplaceCallCmd : GenericOptions { - [Value(0, Min=2, Max=2, HelpText="Call to replace.")] - public IEnumerable replaceCall { get; set; } - - [Value(2, Required=true, MetaName = "type", HelpText = "Types to patch.")] - public IEnumerable typesToPatch { get; set; } - -}; - class ReplaceCall : Command { private string search; private string replace; @@ -156,11 +131,8 @@ class ReplaceCall : Command { } public class patcher { - public static int Main(string[] args) { - Parser.Default.ParseArguments< - GenericOptions, FixFileStreamsCmd, ReplaceCallCmd - >(args) + Parser.Default.ParseArguments(args) .WithParsed(opts => new FixFileStreams(opts)) .WithParsed(opts => new ReplaceCall(opts)); return 0; -- cgit 1.4.1