Extract invariant instantiation info extension method

This commit is contained in:
Bartłomiej Dach
2021-05-12 22:42:26 +02:00
parent 4464204e33
commit 1b579dd838
5 changed files with 37 additions and 32 deletions

View File

@ -26,6 +26,7 @@ using JetBrains.Annotations;
using osu.Framework.Extensions;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Testing;
using osu.Game.Extensions;
using osu.Game.Rulesets.Filter;
using osu.Game.Screens.Ranking.Statistics;
@ -135,7 +136,7 @@ namespace osu.Game.Rulesets
Name = Description,
ShortName = ShortName,
ID = (this as ILegacyRuleset)?.LegacyID,
InstantiationInfo = GetType().AssemblyQualifiedName,
InstantiationInfo = GetType().GetInvariantInstantiationInfo(),
Available = true,
};
}

View File

@ -3,7 +3,6 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Newtonsoft.Json;
using osu.Framework.Testing;
@ -18,20 +17,7 @@ namespace osu.Game.Rulesets
public string ShortName { get; set; }
private string instantiationInfo;
public string InstantiationInfo
{
get => instantiationInfo;
set => instantiationInfo = abbreviateInstantiationInfo(value);
}
private string abbreviateInstantiationInfo(string value)
{
// exclude version onwards, matching only on namespace and type.
// this is mainly to allow for new versions of already loaded rulesets to "upgrade" from old.
return string.Join(',', value.Split(',').Take(2));
}
public string InstantiationInfo { get; set; }
[JsonIgnore]
public bool Available { get; set; }