about summary refs log tree commit diff
path: root/pkgs/games/build-support/monogame-patcher/src/patcher.cs
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2018-07-17 04:36:39 +0200
committeraszlig <aszlig@nix.build>2018-07-19 06:35:13 +0200
commit2d3dabe8af2ea4abc51f68891741db360ad11c75 (patch)
tree6c178740ffd8552c2e928939e95f4397364a6e5f /pkgs/games/build-support/monogame-patcher/src/patcher.cs
parent3917a5e3c4b7784bf535eafb25e0a47662c0978a (diff)
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 <aszlig@nix.build>
Diffstat (limited to 'pkgs/games/build-support/monogame-patcher/src/patcher.cs')
-rw-r--r--pkgs/games/build-support/monogame-patcher/src/patcher.cs30
1 files changed, 1 insertions, 29 deletions
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<string> 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<string> replaceCall { get; set; }
-
-    [Value(2, Required=true, MetaName = "type", HelpText = "Types to patch.")]
-    public IEnumerable<string> 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<FixFileStreamsCmd, ReplaceCallCmd>(args)
             .WithParsed<FixFileStreamsCmd>(opts => new FixFileStreams(opts))
             .WithParsed<ReplaceCallCmd>(opts => new ReplaceCall(opts));
         return 0;