diff --git a/Adaptation/.vscode/settings.json b/Adaptation/.vscode/settings.json index 44f94bc..ce34bc2 100644 --- a/Adaptation/.vscode/settings.json +++ b/Adaptation/.vscode/settings.json @@ -26,25 +26,25 @@ ], "coverage-gutters.coverageBaseDir": "../../../../MET08AWCT/05_TestResults/TestResults/**", "workbench.colorCustomizations": { - "activityBar.activeBackground": "#5d8f9e", + "activityBar.activeBackground": "#4547ab", "activityBar.activeBorder": "#dacec5", - "activityBar.background": "#5d8f9e", - "activityBar.foreground": "#15202b", - "activityBar.inactiveForeground": "#15202b99", - "activityBarBadge.background": "#78476d", + "activityBar.background": "#4547ab", + "activityBar.foreground": "#e7e7e7", + "activityBar.inactiveForeground": "#e7e7e799", + "activityBarBadge.background": "#2d1213", "activityBarBadge.foreground": "#e7e7e7", - "sash.hoverBorder": "#5d8f9e", - "statusBar.background": "#4a727e", + "sash.hoverBorder": "#4547ab", + "statusBar.background": "#363887", "statusBar.foreground": "#e7e7e7", - "statusBarItem.hoverBackground": "#5d8f9e", - "statusBarItem.remoteBackground": "#4a727e", + "statusBarItem.hoverBackground": "#4547ab", + "statusBarItem.remoteBackground": "#363887", "statusBarItem.remoteForeground": "#e7e7e7", - "titleBar.activeBackground": "#4a727e", + "titleBar.activeBackground": "#363887", "titleBar.activeForeground": "#e7e7e7", - "titleBar.inactiveBackground": "#4a727e99", + "titleBar.inactiveBackground": "#36388799", "titleBar.inactiveForeground": "#e7e7e799", "commandCenter.border": "#e7e7e799" }, - "peacock.color": "#4a727e", + "peacock.color": "#363887", "cSpell.enabled": false } \ No newline at end of file diff --git a/Adaptation/.vscode/tasks.json b/Adaptation/.vscode/tasks.json index d334771..77e77d8 100644 --- a/Adaptation/.vscode/tasks.json +++ b/Adaptation/.vscode/tasks.json @@ -57,7 +57,7 @@ { "label": "File-Folder-Helper AOT s M .Kanbn Tasks", "type": "shell", - "command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s M T:/MET08AWCT/06_SourceCode/MET08AWCT/Adaptation -s T:/MET08AWCT/06_SourceCode/MET08AWCT/Adaptation/.kanbn/tasks", + "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s M T:/MET08AWCT/06_SourceCode/MET08AWCT/Adaptation -s T:/MET08AWCT/06_SourceCode/MET08AWCT/Adaptation/.kanbn/tasks", "problemMatcher": [] }, { diff --git a/Adaptation/Shared/FileRead.cs b/Adaptation/Shared/FileRead.cs index 3652d07..464ef0b 100644 --- a/Adaptation/Shared/FileRead.cs +++ b/Adaptation/Shared/FileRead.cs @@ -571,16 +571,99 @@ public class FileRead : Properties.IFileRead } } + internal static List GetDirectoryNames(string directory) + { +#nullable enable + List results = new(); + string? fileName; + string? checkDirectory = directory; + string? pathRoot = Path.GetPathRoot(directory); + string extension = Path.GetExtension(directory); + if (string.IsNullOrEmpty(pathRoot)) + throw new NullReferenceException(nameof(pathRoot)); + if (Directory.Exists(directory)) + { + fileName = Path.GetFileName(directory); + if (!string.IsNullOrEmpty(fileName)) + results.Add(fileName); + } + else if ((string.IsNullOrEmpty(extension) || extension.Length > 3) && !File.Exists(directory)) + { + fileName = Path.GetFileName(directory); + if (!string.IsNullOrEmpty(fileName)) + results.Add(fileName); + } + for (int i = 0; i < int.MaxValue; i++) + { + checkDirectory = Path.GetDirectoryName(checkDirectory); + if (string.IsNullOrEmpty(checkDirectory) || checkDirectory == pathRoot) + break; + fileName = Path.GetFileName(checkDirectory); + if (string.IsNullOrEmpty(fileName)) + continue; + results.Add(fileName); + } + results.Add(pathRoot); + results.Reverse(); + return results; +#nullable disable + } + + private string GetJobIdDirectory(string path) + { + string result; + List directoryNames = GetDirectoryNames(path); + if (!directoryNames.Contains(_Logistics.JobID)) + result = Path.GetDirectoryName(path); + else + { + result = string.Empty; + foreach (string directoryName in directoryNames) + { + result = Path.Combine(result, directoryName); + if (directoryName == _Logistics.JobID) + break; + } + } + return result; + } + + private static void DeleteEmptyTopDirectories(string rootDirectory) + { + if (Directory.Exists(rootDirectory)) + { + string[] files; + string[] directories; + string[] subDirectories = Directory.GetDirectories(rootDirectory, "*", SearchOption.TopDirectoryOnly); + foreach (string subDirectory in subDirectories) + { + files = Directory.GetFiles(subDirectory, "*", SearchOption.AllDirectories); + if (files.Length > 0) + continue; + directories = Directory.GetDirectories(subDirectory, "*", SearchOption.TopDirectoryOnly); + if (directories.Length > 0) + continue; + try + { Directory.Delete(subDirectory); } + catch (UnauthorizedAccessException) + { + new DirectoryInfo(subDirectory).Attributes = FileAttributes.Normal; + Directory.Delete(subDirectory); + } + } + } + } + private void Shared1811(string to, FileInfo sourceFile) { if (!_IsDuplicator && _FileConnectorConfiguration.SourceFileFilter != "*" && sourceFile.Exists && sourceFile.Length < _MinFileLength) { string directoryName = Path.GetFileName(to); - string jobIdDirectory = Path.GetDirectoryName(to); + string jobIdDirectory = GetJobIdDirectory(to); DateTime dateTime = DateTime.Now.AddMinutes(-15); string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}{@"\"}{_Logistics.DateTimeFromSequence:yyyy-MM-dd}"; - string destinationDirectory = string.Concat(jobIdDirectory, @"\_ Ignore 100 bytes\", weekDirectory, @"\", directoryName); + string destinationDirectory = Path.Combine(jobIdDirectory, "_ Ignore 100 bytes", weekDirectory, directoryName); if (!Directory.Exists(destinationDirectory)) _ = Directory.CreateDirectory(destinationDirectory); File.Move(sourceFile.FullName, string.Concat(destinationDirectory, @"\", sourceFile.Name)); @@ -605,6 +688,7 @@ public class FileRead : Properties.IFileRead } } catch (Exception) { throw; } + DeleteEmptyTopDirectories(jobIdDirectory); } } diff --git a/Adaptation/Shared/Test.cs b/Adaptation/Shared/Test.cs index 3aa3552..169f05b 100644 --- a/Adaptation/Shared/Test.cs +++ b/Adaptation/Shared/Test.cs @@ -14,6 +14,7 @@ public enum Test CandelaPSL = 38, CandelaVerify = 37, CDE = 24, + Climatec = 54, //Largest CV = 3, DailyRPMAverage = 19, DailyRPMPLRatio = 20, @@ -38,7 +39,7 @@ public enum Test RPMPLRatio = 17, RPMXY = 15, SP1 = 8, - SRP2100 = 53, //Largest + SRP2100 = 53, Tencor = 7, UV = 35, VerificationLehighton = 14, diff --git a/Adaptation/_Tests/CreateSelfDescription/Development/v2.52.0/WC6INCH1-EQPT.cs b/Adaptation/_Tests/CreateSelfDescription/Development/v2.52.0/WC6INCH1-EQPT.cs index 4a0fd3d..eece662 100644 --- a/Adaptation/_Tests/CreateSelfDescription/Development/v2.52.0/WC6INCH1-EQPT.cs +++ b/Adaptation/_Tests/CreateSelfDescription/Development/v2.52.0/WC6INCH1-EQPT.cs @@ -18,7 +18,7 @@ public class WC6INCH1_EQPT : EAFLoggingUnitTesting internal static string DummyRoot { get; private set; } internal static WC6INCH1_EQPT EAFLoggingUnitTesting { get; private set; } - static WC6INCH1_EQPT() => DummyRoot = @"\\messdv002.na.infineon.com\Candela\EC_Characterization_Si\Dummy"; + static WC6INCH1_EQPT() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy"; public WC6INCH1_EQPT() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false) { diff --git a/MET08AWCT.csproj b/MET08AWCT.csproj index b63dc16..9671ad7 100644 --- a/MET08AWCT.csproj +++ b/MET08AWCT.csproj @@ -4,7 +4,7 @@ Debug AnyCPU - {54729740-EA41-4EDC-9730-3C2690A289D2} + {30B8F054-382B-42D6-8D06-FDE42B0BB4A7} 10.0 Library Properties