diff --git a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportGen1MapCommand.cs
similarity index 95%
rename from OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs
rename to OpenRA.Mods.Cnc/UtilityCommands/ImportGen1MapCommand.cs
index 70949644de..93066b32c3 100644
--- a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs
+++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportGen1MapCommand.cs
@@ -15,19 +15,20 @@ using System.IO;
using System.Linq;
using System.Text;
using OpenRA.FileSystem;
+using OpenRA.Mods.Common;
using OpenRA.Mods.Common.FileFormats;
using OpenRA.Mods.Common.Terrain;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;
-namespace OpenRA.Mods.Common.UtilityCommands
+namespace OpenRA.Mods.Cnc.UtilityCommands
{
- public abstract class ImportLegacyMapCommand
+ public abstract class ImportGen1MapCommand
{
public readonly int MapSize;
- protected ImportLegacyMapCommand(int mapSize)
+ protected ImportGen1MapCommand(int mapSize)
{
MapSize = mapSize;
}
@@ -451,4 +452,22 @@ namespace OpenRA.Mods.Common.UtilityCommands
}
}
}
+
+#if !NET6_0_OR_GREATER
+ public static class Extensions
+ {
+ ///
+ /// Only used for Mono builds. .NET 6 added the exact same thing.
+ ///
+ public static IEnumerable DistinctBy(this IEnumerable source, Func keySelector)
+ {
+ var knownKeys = new HashSet();
+ foreach (var element in source)
+ {
+ if (knownKeys.Add(keySelector(element)))
+ yield return element;
+ }
+ }
+ }
+#endif
}
diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertMapCommand.cs
similarity index 97%
rename from OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs
rename to OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertMapCommand.cs
index 8e283a2bba..4d6b0ca813 100644
--- a/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs
+++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertMapCommand.cs
@@ -16,14 +16,13 @@ using System.Linq;
using System.Text;
using OpenRA.Mods.Cnc.FileFormats;
using OpenRA.Mods.Common.FileFormats;
-using OpenRA.Mods.Common.UtilityCommands;
namespace OpenRA.Mods.Cnc.UtilityCommands
{
- class ImportRedAlertLegacyMapCommand : ImportLegacyMapCommand, IUtilityCommand
+ class ImportRedAlertMapCommand : ImportGen1MapCommand, IUtilityCommand
{
// TODO: 128x128 is probably not true for "mega maps" from the expansions.
- public ImportRedAlertLegacyMapCommand()
+ public ImportRedAlertMapCommand()
: base(128) { }
string IUtilityCommand.Name => "--import-ra-map";
diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnMapCommand.cs
similarity index 96%
rename from OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs
rename to OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnMapCommand.cs
index 29f8238d3c..84cd1ddfb6 100644
--- a/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs
+++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnMapCommand.cs
@@ -14,14 +14,13 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using OpenRA.Mods.Common.FileFormats;
-using OpenRA.Mods.Common.UtilityCommands;
namespace OpenRA.Mods.Cnc.UtilityCommands
{
- class ImportTiberianDawnLegacyMapCommand : ImportLegacyMapCommand, IUtilityCommand
+ class ImportTiberianDawnMapCommand : ImportGen1MapCommand, IUtilityCommand
{
// NOTE: 64x64 map size is a C&C95 engine limitation
- public ImportTiberianDawnLegacyMapCommand()
+ public ImportTiberianDawnMapCommand()
: base(64) { }
string IUtilityCommand.Name => "--import-td-map";
diff --git a/OpenRA.Mods.Common/UtilityCommands/Extensions.cs b/OpenRA.Mods.Common/UtilityCommands/Extensions.cs
deleted file mode 100644
index 73470b6d12..0000000000
--- a/OpenRA.Mods.Common/UtilityCommands/Extensions.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-#region Copyright & License Information
-/*
- * Copyright (c) The OpenRA Developers and Contributors
- * This file is part of OpenRA, which is free software. It is made
- * available to you under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version. For more
- * information, see COPYING.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-namespace OpenRA.Mods.Common.UtilityCommands
-{
- public static class Extensions
- {
- public static IEnumerable DistinctBy(this IEnumerable source, Func keySelector)
- {
- var knownKeys = new HashSet();
- foreach (var element in source)
- {
- if (knownKeys.Add(keySelector(element)))
- yield return element;
- }
- }
- }
-}