Eradicate ☠ Mono ☠
Co-Authored-By: Gustas <37534529+punkpun@users.noreply.github.com>
This commit is contained in:
@@ -98,13 +98,10 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders
|
||||
if (metaStream != null)
|
||||
{
|
||||
string metaText;
|
||||
#if NET5_0_OR_GREATER
|
||||
using (metaStream)
|
||||
using (var metaReader = new StreamReader(metaStream, bufferSize: 64))
|
||||
metaText = metaReader.ReadToEnd();
|
||||
#else
|
||||
metaText = metaStream.ReadAllText();
|
||||
#endif
|
||||
|
||||
var meta = MetaRegex.Match(metaText);
|
||||
var crop = Rectangle.FromLTRB(
|
||||
ParseGroup(meta, "left"), ParseGroup(meta, "top"),
|
||||
|
||||
@@ -497,22 +497,4 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
Map.ActorDefinitions = Map.ActorDefinitions.Concat(nodes).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
#if !NET6_0_OR_GREATER
|
||||
public static class Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Only used for Mono builds. .NET 6 added the exact same thing.
|
||||
/// </summary>
|
||||
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
||||
{
|
||||
var knownKeys = new HashSet<TKey>();
|
||||
foreach (var element in source)
|
||||
{
|
||||
if (knownKeys.Add(keySelector(element)))
|
||||
yield return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user