[Nnyeah] Improve error messages for missing required arguments (#14949)

This commit is contained in:
Chris Hamons 2022-05-10 09:07:05 -05:00 коммит произвёл GitHub
Родитель 569aef64b7
Коммит e6d4878fa5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 29 добавлений и 3 удалений

12
tools/nnyeah/nnyeah/Errors.Designer.cs сгенерированный
Просмотреть файл

@ -166,5 +166,17 @@ namespace Microsoft.MaciOS.Nnyeah {
return ResourceManager.GetString("E0013", resourceCulture);
}
}
internal static string E0014 {
get {
return ResourceManager.GetString("E0014", resourceCulture);
}
}
internal static string E0015 {
get {
return ResourceManager.GetString("E0015", resourceCulture);
}
}
}
}

Просмотреть файл

@ -84,5 +84,11 @@
<data name="E0013" xml:space="preserve">
<value>Error while attempting to map member {0} in old assembly. This member does not exist in the new assembly or has been renamed. Conversion can't continue. Your best option is to port the old assembly to .NET 6</value>
</data>
<data name="E0014" xml:space="preserve">
<value>File for conversion (--input) and output location (--output) are required options.</value>
</data>
<data name="E0015" xml:space="preserve">
<value>Support legacy and NET assemblies --xamarin-assembly and --microsoft-assembly are currently required options.</value>
</data>
</root>

Просмотреть файл

@ -34,10 +34,18 @@ namespace Microsoft.MaciOS.Nnyeah {
doHelp = true;
}
var badForMungingAssembly = infile is null || outfile is null;
var badForComparingAssemblies = xamarinAssembly is null || microsoftAssembly is null;
if (infile is null || outfile is null) {
Console.Error.WriteLine (Errors.E0014);
Environment.Exit (1);
}
if (doHelp || badForComparingAssemblies || badForMungingAssembly) {
// TODO - Long term this should default to files packaged within the tool but allow overrides
if (xamarinAssembly is null || microsoftAssembly is null) {
Console.Error.WriteLine (Errors.E0015);
Environment.Exit (1);
}
if (doHelp) {
PrintOptions (options, Console.Out);
Environment.Exit (0);
}