From ed17fedb0a08bc2bf2e891572349b58747d446b6 Mon Sep 17 00:00:00 2001 From: Neil South Date: Mon, 5 Jun 2023 16:53:28 +0100 Subject: [PATCH 1/2] fix for silly mistake Signed-off-by: Neil South --- src/TaskManager/Plug-ins/Email/EmailPlugin.cs | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/TaskManager/Plug-ins/Email/EmailPlugin.cs b/src/TaskManager/Plug-ins/Email/EmailPlugin.cs index beb3172d5..126ca1ebd 100644 --- a/src/TaskManager/Plug-ins/Email/EmailPlugin.cs +++ b/src/TaskManager/Plug-ins/Email/EmailPlugin.cs @@ -178,22 +178,30 @@ private async Task>> AddRawMetaFromFile(Dictiona foreach (var item in _includeMetadata) { - var values = new List(); - if (metadata.ContainsKey(item)) values = metadata[item]; - - DicomTag tag; + DicomTag? tag = null; try { tag = DicomDictionary.Default[item]; } catch (Exception) { - tag = DicomTag.Parse(item); + try + { + tag = DicomTag.Parse(item); + } + catch (Exception) { } } if (tag is not null) { - values.Add(dcmFile.Dataset.GetString(tag).Trim()); - metadata.Add(item, values); + var value = dcmFile.Dataset.GetString(tag).Trim(); + if (metadata.ContainsKey(item)) + { + metadata[item].Add(value); + } + else + { + metadata.Add(item, new List { value }); + }; } } } From 52a423eef8dcf26cdd77b2be357972c5e3ca84bd Mon Sep 17 00:00:00 2001 From: Neil South Date: Mon, 5 Jun 2023 17:06:03 +0100 Subject: [PATCH 2/2] fix code smells Signed-off-by: Neil South --- src/TaskManager/Plug-ins/Email/EmailPlugin.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/TaskManager/Plug-ins/Email/EmailPlugin.cs b/src/TaskManager/Plug-ins/Email/EmailPlugin.cs index 126ca1ebd..c29215111 100644 --- a/src/TaskManager/Plug-ins/Email/EmailPlugin.cs +++ b/src/TaskManager/Plug-ins/Email/EmailPlugin.cs @@ -189,7 +189,10 @@ private async Task>> AddRawMetaFromFile(Dictiona { tag = DicomTag.Parse(item); } - catch (Exception) { } + catch (Exception) + { + //empty on purpose + } } if (tag is not null) { @@ -201,7 +204,7 @@ private async Task>> AddRawMetaFromFile(Dictiona else { metadata.Add(item, new List { value }); - }; + } } } }