From 452c5d31777620cef083cb6bf8e17303f2c37e15 Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 1 Apr 2023 01:32:15 +0200 Subject: [PATCH] Removed TagType.EMPTY --- Server/RegionConverter.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Server/RegionConverter.cs b/Server/RegionConverter.cs index 2148529..7dc63b3 100644 --- a/Server/RegionConverter.cs +++ b/Server/RegionConverter.cs @@ -120,8 +120,9 @@ public class RegionConverter currentTags.TryAdd(Tag.TagType.id, Convert.ToUInt64(wayReader.GetAttribute("id")!)); if (wayReader.Name == "tag") { - Tag wayTag = Tag.ConvertToTag(wayReader.GetAttribute("k")!, wayReader.GetAttribute("v")!); - currentTags.TryAdd(wayTag.key, wayTag.value); + Tag? wayTag = Tag.ConvertToTag(wayReader.GetAttribute("k")!, wayReader.GetAttribute("v")!); + if(wayTag is not null) + currentTags.TryAdd(wayTag.key, wayTag.value); } else if (wayReader.Name == "nd") { @@ -193,8 +194,13 @@ public class RegionConverter string tagsRegionPath = Path.Combine(outputPath, regionHash.ToString(), tagsFileName); regionTagsFileStreams.Add(regionHash, new FileStream(tagsRegionPath, FileMode.OpenOrCreate)); } + + ulong id = currentTags[Tag.TagType.id]; + TagManager tm = new TagManager(); + foreach(KeyValuePair kv in currentTags) + tm.AddTag(id, kv); #pragma warning disable SYSLIB0011 - bFormatter.Serialize(regionTagsFileStreams[regionHash], currentTags); + bFormatter.Serialize(regionTagsFileStreams[regionHash], tm); #pragma warning restore SYSLIB0011 } } \ No newline at end of file