mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-05-08 20:06:03 +03:00
Make custom types optional
This commit is contained in:
parent
67876c6532
commit
8c9068cc97
21 changed files with 189 additions and 59 deletions
|
@ -73,12 +73,12 @@ public class Program
|
|||
return templateReader.ReadTemplate();
|
||||
}
|
||||
|
||||
private static ICustomTypeDefinition ResolveCustomType(string name)
|
||||
private static Optional<ICustomTypeDefinition> ResolveCustomType(string name)
|
||||
{
|
||||
ICustomTypeDefinition[] allDefinedTypes =
|
||||
[
|
||||
new CustomClassDefinition() { Name = "a" },
|
||||
];
|
||||
return allDefinedTypes.FirstOrDefault(type => type.Name == name) ?? throw new InvalidOperationException();
|
||||
return allDefinedTypes.FirstOrDefault(ctd => ctd.Name == name) is ICustomTypeDefinition ctd ? new Optional<ICustomTypeDefinition>(ctd) : Optional<ICustomTypeDefinition>.Empty;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue