| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
If there is a command line usage error, we really don't want the program
to return exit status 0 (success), so let's actually set the return
value on WithParsed().
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
| |
We really want to make sure that things were actually patched, so just
silently skipping everything is not an option.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
| |
If we want to replace a call with one that's not in a module which is
currently referenced by the target file we now have another command line
flag for replace-call (-a) where we can specify the additional DLL file.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
By default the assemblies are searched in the current working directory,
but when patching an assembly in some other directory than the current
the patcher will fail to resolve assemblies residing beneath the target
file.
So we just add the directory of the target file to the search path.
I also moved all of the assemblies in the test to be in a subdir so we
can verify that this indeed works and we won't regress in the future.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the command is not executed inside a terminal the value of
Console.WindowWidth is 0 and thus we will get an exception from
CommandLineParser:
Unhandled Exception:
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.Substring ...
at CommandLine.Text.HelpText.AddOption ...
...
So let's initialize the parser with settings and if WindowWidth is 0 we
just add 80 as the width.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So far we have searched for methods in two steps: First get all the
types and then find all of the constructors or method definitions.
The match for the actual method definition was done first for the type
and then again for the full definition of the method/constructor.
For the replace-call subcommand this also means that we don't have a
very good way to find the type, because if we wanted to keep doing this
in two steps we would need to parse the type name out of the one given
as the replacement string in replace-call.
So now we recurse through *all* the constructors and methods and do a
full match against the specified replacement string, both for
replace-call and for fix-filestreams.
Compared to the implementation so far we also do this just once instead
of every time we find a call or FileStream constructor.
I also overhauled the way we do testing, because in the end writing
tests using NUnit would introduce a lot of code churn because we need to
make a lot of external calls. The shell is especially useful for exactly
that and our tests are now just a plain shell script.
Signed-off-by: aszlig <aszlig@nix.build>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
I really would have preferred a simple Makefile, but with that we can't
use buildDotnetPackage and we also need to take care of butchering the
dependencies manually.
So I moved everything to src/ and added a csproj file to clean up most
of the cruft and just use buildDotnetPackage with minimal attributes.
In addition to that I also added assembly info, so that the command line
help will show the proper author name, copyright, yaddayadda...
Signed-off-by: aszlig <aszlig@nix.build>
|