From 80150959cca81976819de3580ecbaa1467349e29 Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Wed, 22 May 2024 18:14:13 -0700 Subject: [PATCH] Bug fix - GetHeaderId --- Adaptation/Shared/Metrology/WS.cs | 24 ++++++++++++++++++------ Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Adaptation/Shared/Metrology/WS.cs b/Adaptation/Shared/Metrology/WS.cs index 4e43fa3..c49e61d 100644 --- a/Adaptation/Shared/Metrology/WS.cs +++ b/Adaptation/Shared/Metrology/WS.cs @@ -78,20 +78,32 @@ public partial class WS { foreach (Attachment attachment in headerAttachments) { - directory = Path.GetDirectoryName(attachment.HeaderIdDirectory) ?? throw new Exception(); - File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.AttachmentId, attachment.DestinationFileName), overwrite: true); - AttachFile(url, attachment); + directory = Path.Combine(Path.GetDirectoryName(attachment.HeaderIdDirectory), attachment.AttachmentId) ?? throw new Exception(); + if (!Directory.Exists(directory)) + _ = Directory.CreateDirectory(directory); + File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true); } } if (dataAttachments is not null) { foreach (Attachment attachment in dataAttachments) { - directory = Path.GetDirectoryName(attachment.HeaderIdDirectory) ?? throw new Exception(); - File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.AttachmentId, attachment.DestinationFileName), overwrite: true); - AttachFile(url, attachment); + directory = Path.Combine(Path.GetDirectoryName(attachment.HeaderIdDirectory.Replace("Header", "Data")), attachment.AttachmentId) ?? throw new Exception(); + if (!Directory.Exists(directory)) + _ = Directory.CreateDirectory(directory); + File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true); } } + if (headerAttachments is not null) + { + foreach (Attachment attachment in headerAttachments) + AttachFile(url, attachment); + } + if (dataAttachments is not null) + { + foreach (Attachment attachment in dataAttachments) + AttachFile(url, attachment); + } //MessageBox.Show(r.ToString()); } catch (Exception e) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 310cbc0..28bd2d8 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.52.0.0")] -[assembly: AssemblyFileVersion("2.52.0.0")] +[assembly: AssemblyVersion("2.56.0.0")] +[assembly: AssemblyFileVersion("2.56.0.0")]