INNER CODE UNIT · C#
selected
axmolengine/axmol · tools/bindings-generator/src/BatchGeneration.cs:139
var selected = files.FirstOrDefault(path =>
string.Equals(Path.GetFileNameWithoutExtension(path), normalized, StringComparison.OrdinalIgnoreCase));
if (selected is null)
throw new InvalidDataException($"Unknown binding module '{module}'. Available modules: " +
string.Join(", ", files.Select(x => Path.GetFileNameWithoutExtension(x))));
return new[] { selected };
}
private static ModuleConfiguration LoadConfiguration(string path, string repositoryRoot)
{
using var document = JsonDocument.Parse(File.ReadAllText(path));
var root = document.RootElement;
if (root.ValueKind != JsonValueKind.Object)
throw new InvalidDataException("The configuration root must be an object.");
foreach (var property in root.EnumerateObject())
{
if (!ConfigProperties.Contains(property.Name))
throw new InvalidDataException($"Unknown property '{property.Name}'.");