Change to use pattern matching

This commit is contained in:
teinarss
2021-02-28 19:00:32 +01:00
committed by reaperrr
parent 7c0e4b25ae
commit d60c05eff3
35 changed files with 63 additions and 122 deletions

View File

@@ -36,8 +36,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
var modData = Game.ModData = utility.ModData;
// HACK: We know that maps can only be oramap or folders, which are ReadWrite
var package = new Folder(Platform.EngineDir).OpenPackage(args[1], modData.ModFiles) as IReadWritePackage;
if (package == null)
var folder = new Folder(Platform.EngineDir);
if (!(folder.OpenPackage(args[1], modData.ModFiles) is IReadWritePackage package))
throw new FileNotFoundException(args[1]);
IEnumerable<UpdateRule> rules = null;