Skip to content

Commit

Permalink
merge VersionMetadata property
Browse files Browse the repository at this point in the history
Type, MType, ReleaseTimeStr
  • Loading branch information
AlphaBs committed Nov 7, 2021
1 parent 8191b2f commit 3433493
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion CmlLib/Core/Version/MVersionCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,22 @@ public virtual void Merge(MVersionCollection from)
{
foreach (var item in from)
{
if (!Versions.Contains(item.Name))
var version = (MVersionMetadata?)Versions[item.Name];
if (version == null)
{
Versions[item.Name] = item;
}
else
{
if (string.IsNullOrEmpty(version.Type))
{
version.Type = item.Type;
version.MType = MVersionTypeConverter.FromString(item.Type);
}

if (string.IsNullOrEmpty(version.ReleaseTimeStr))
version.ReleaseTimeStr = item.ReleaseTimeStr;
}
}

if (this.MinecraftPath == null && from.MinecraftPath != null)
Expand Down

0 comments on commit 3433493

Please sign in to comment.