diff --git a/Adaptation/FileHandlers/RsM/ProcessData.cs b/Adaptation/FileHandlers/RsM/ProcessData.cs index f5b94e2..58e4351 100644 --- a/Adaptation/FileHandlers/RsM/ProcessData.cs +++ b/Adaptation/FileHandlers/RsM/ProcessData.cs @@ -93,7 +93,7 @@ public class ProcessData : IProcessData reactor = defaultReactor; else reactor = segments[0]; - if (segments.Length <= 1 || !int.TryParse(segments[1], out int rdsValue) || rdsValue < 99) + if (segments.Length <= 1 || !int.TryParse(segments[1].Replace("QP", string.Empty), out int rdsValue) || rdsValue < 99) rds = defaultRDS; else rds = segments[1]; @@ -193,7 +193,7 @@ public class ProcessData : IProcessData title = title.Substring(2); run = title; string[] segments = title.Split('-'); - bool hasRDS = Regex.IsMatch(title, "[-]?[0-9]{5,}[-]?"); + bool hasRDS = Regex.IsMatch(title, "[-]?([QP][0-9]{4,}|[0-9]{5,})[-]?"); (reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, text, title, segments, hasRDS); (layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments, hasRDS); zone = GetZone(segments); diff --git a/Adaptation/FileHandlers/txt/ProcessData.cs b/Adaptation/FileHandlers/txt/ProcessData.cs index 9d755df..f036fe3 100644 --- a/Adaptation/FileHandlers/txt/ProcessData.cs +++ b/Adaptation/FileHandlers/txt/ProcessData.cs @@ -250,7 +250,7 @@ public class ProcessData : IProcessData reactor = defaultReactor; else reactor = segments[0]; - if (segments.Length <= 1 || !int.TryParse(segments[1], out int rdsValue) || rdsValue < 99) + if (segments.Length <= 1 || !int.TryParse(segments[1].Replace("QP", string.Empty), out int rdsValue) || rdsValue < 99) rds = defaultRDS; else rds = segments[1]; @@ -352,7 +352,7 @@ public class ProcessData : IProcessData title = title.Substring(2); run = title; string[] segments = title.Split('-'); - bool hasRDS = Regex.IsMatch(title, "[-]?[0-9]{5,}[-]?"); + bool hasRDS = Regex.IsMatch(title, "[-]?([QP][0-9]{4,}|[0-9]{5,})[-]?"); (reactor, rds) = GetReactorAndRDS(defaultReactor, defaultRDS, text, title, segments, hasRDS); (layer, psn) = GetLayerAndPSN(defaultLayer, defaultPSN, segments, hasRDS); zone = GetZone(segments); diff --git a/Adaptation/MET08RESIMAPCDE.Tests.csproj b/Adaptation/MET08RESIMAPCDE.Tests.csproj index 8968960..bd62fe1 100644 --- a/Adaptation/MET08RESIMAPCDE.Tests.csproj +++ b/Adaptation/MET08RESIMAPCDE.Tests.csproj @@ -34,7 +34,7 @@ - + NU1701 NU1701 NU1701 @@ -43,7 +43,7 @@ NU1701 NU1701 - + diff --git a/Adaptation/_Tests/Static/RsM.cs b/Adaptation/_Tests/Static/RsM.cs index cb6e641..d641787 100644 --- a/Adaptation/_Tests/Static/RsM.cs +++ b/Adaptation/_Tests/Static/RsM.cs @@ -143,6 +143,14 @@ public class RsM : LoggingUnitTesting, IDisposable Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); + descriptor = FileHandlers.RsM.ProcessData.GetDescriptor("75-QP1414-SPLIT4"); + Assert.IsTrue(!string.IsNullOrEmpty(descriptor.Run)); + Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); + Assert.IsTrue(descriptor.PSN is "SPLIT4"); + Assert.IsTrue(descriptor.RDS is "QP1414"); + Assert.IsTrue(descriptor.Reactor is "75"); + Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); + Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } diff --git a/Adaptation/_Tests/Static/txt.cs b/Adaptation/_Tests/Static/txt.cs index 636c91e..c4dbf1e 100644 --- a/Adaptation/_Tests/Static/txt.cs +++ b/Adaptation/_Tests/Static/txt.cs @@ -136,6 +136,14 @@ public class TXT : LoggingUnitTesting, IDisposable Assert.IsTrue(string.IsNullOrEmpty(descriptor.Reactor)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); + descriptor = FileHandlers.txt.ProcessData.GetDescriptor("75-QP1414-SPLIT4"); + Assert.IsTrue(!string.IsNullOrEmpty(descriptor.Title)); + Assert.IsTrue(string.IsNullOrEmpty(descriptor.Layer)); + Assert.IsTrue(descriptor.PSN is "SPLIT4"); + Assert.IsTrue(descriptor.RDS is "QP1414"); + Assert.IsTrue(descriptor.Reactor is "75"); + Assert.IsTrue(string.IsNullOrEmpty(descriptor.Zone)); + Assert.IsTrue(string.IsNullOrEmpty(descriptor.Employee)); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); }