Unity: Allow version selection from asset file
This commit is contained in:
@@ -109,6 +109,9 @@ namespace Il2CppInspector.CLI
|
||||
[Option("unity-version", Required = false, HelpText = "Version of Unity used to create the input files, if known. Used to enhance Python, C++ and JSON output. If not specified, a close match will be inferred automatically.", Default = null)]
|
||||
public UnityVersion UnityVersion { get; set; }
|
||||
|
||||
[Option("unity-version-from-asset", Required = false, HelpText = "A Unity asset file used to determine the exact Unity version. Overrides --unity-version.", Default = null)]
|
||||
public string UnityVersionAsset { get; set; }
|
||||
|
||||
[Option("plugins", Required = false, HelpText = "Specify options for plugins. Enclose each plugin's configuration in quotes as follows: --plugins \"pluginone --option1 value1 --option2 value2\" \"plugintwo --option...\". Use --plugins <name> to get help on a specific plugin")]
|
||||
public IEnumerable<string> PluginOptions { get; set; }
|
||||
}
|
||||
@@ -192,6 +195,21 @@ namespace Il2CppInspector.CLI
|
||||
}
|
||||
}
|
||||
|
||||
// Check Unity asset
|
||||
if (options.UnityVersionAsset != null) {
|
||||
try {
|
||||
options.UnityVersion = UnityVersion.FromAssetFile(options.UnityVersionAsset);
|
||||
|
||||
Console.WriteLine("Unity asset file has version " + options.UnityVersion);
|
||||
}
|
||||
catch (FileNotFoundException) {
|
||||
Console.Error.WriteLine($"Unity asset file {options.UnityVersionAsset} does not exist");
|
||||
return 1;
|
||||
} catch (ArgumentException) {
|
||||
Console.Error.WriteLine("Could not determine Unity version from asset file - ignoring");
|
||||
}
|
||||
}
|
||||
|
||||
// Check excluded namespaces
|
||||
if (options.ExcludedNamespaces.Count() == 1 && options.ExcludedNamespaces.First().ToLower() == "none")
|
||||
options.ExcludedNamespaces = new List<string>();
|
||||
|
||||
Reference in New Issue
Block a user