From 7aa950748713fa296ea36387e8de1ba35b4196c6 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 17 Jul 2018 06:39:10 +0200 Subject: monogame-patcher: Improve values for replace-call Using an IEnumerable for the search and replace arguments isn't really a very good idea, because it makes command line usage very annoying and messes up the usage description. I originally made this an IEnumerable because I wanted to have a way to specify multiple replacements, but we can simply run the patcher twice or more times. Signed-off-by: aszlig --- pkgs/games/build-support/monogame-patcher/src/options.cs | 8 +++++--- pkgs/games/build-support/monogame-patcher/src/patcher.cs | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'pkgs/games/build-support') diff --git a/pkgs/games/build-support/monogame-patcher/src/options.cs b/pkgs/games/build-support/monogame-patcher/src/options.cs index ebe1f75b..32a8403e 100644 --- a/pkgs/games/build-support/monogame-patcher/src/options.cs +++ b/pkgs/games/build-support/monogame-patcher/src/options.cs @@ -19,10 +19,12 @@ class FixFileStreamsCmd : GenericOptions { [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(0, Required=true, HelpText="Method call to replace.")] + public string replaceMethod { get; set; } + + [Value(1, Required=true, HelpText="The replacement method.")] + public string replacementMethod { get; set; } [Value(2, Required=true, MetaName = "type", HelpText = "Types to patch.")] public IEnumerable typesToPatch { get; set; } - }; diff --git a/pkgs/games/build-support/monogame-patcher/src/patcher.cs b/pkgs/games/build-support/monogame-patcher/src/patcher.cs index c9046f0a..cac60250 100644 --- a/pkgs/games/build-support/monogame-patcher/src/patcher.cs +++ b/pkgs/games/build-support/monogame-patcher/src/patcher.cs @@ -97,8 +97,8 @@ class ReplaceCall : Command { private MethodReference replace; public ReplaceCall(ReplaceCallCmd options) : base(options) { - this.search = options.replaceCall.ToList()[0]; - this.replace = this.find_method_ref(options.replaceCall.ToList()[1]); + this.search = options.replaceMethod; + this.replace = this.find_method_ref(options.replacementMethod); var filtered = this.module.Types .Where(p => options.typesToPatch.Contains(p.Name)); -- cgit 1.4.1