From 34334934ec0996af454b3ff1d01b5f03020073c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=84=B8=EC=9D=B8?= Date: Sun, 7 Nov 2021 18:41:39 +0900 Subject: [PATCH] merge VersionMetadata property Type, MType, ReleaseTimeStr --- CmlLib/Core/Version/MVersionCollection.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CmlLib/Core/Version/MVersionCollection.cs b/CmlLib/Core/Version/MVersionCollection.cs index b89fb1c..368ae93 100644 --- a/CmlLib/Core/Version/MVersionCollection.cs +++ b/CmlLib/Core/Version/MVersionCollection.cs @@ -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)