Add helper classes for XML parsing and directory zipping
- Implemented ArrayOfRuntimeInstanceStatusReport and related classes for XML deserialization. - Added methods to download XML data, parse it, and serialize it to JSON format. - Created functionality to zip run directories based on specified patterns and delete original files. - Enhanced logging for better traceability during file processing and zipping operations.
This commit is contained in:
26
.vscode/launch.json
vendored
26
.vscode/launch.json
vendored
@ -11,6 +11,32 @@
|
||||
"preLaunchTask": "Build",
|
||||
"program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Folder-Helper.dll",
|
||||
"args": [
|
||||
"s",
|
||||
"X",
|
||||
"D:/Tmp",
|
||||
"Day-Helper-2025-11-13",
|
||||
"http://messa08ec.infineon.com:9003/StatusQueryV2/instance/statuses",
|
||||
"Status-Query-V2-Instance-Statuses",
|
||||
"s",
|
||||
"X",
|
||||
"\\\\mesfs.infineon.com\\EC_Characterization_Si\\_Archive-2024\\BIORAD2\\2024_Week_01\\2024-01-01\\-TMID-_2024-01-01_06;05_AM_822702806",
|
||||
"Day-Helper-2025-11-14",
|
||||
"*.pdsf",
|
||||
"yyyy-MM-dd",
|
||||
"yyyy_Week_##",
|
||||
"s",
|
||||
"X",
|
||||
"D:/Tmp",
|
||||
"Day-Helper-2025-06-02",
|
||||
"infineon\\MESPhares",
|
||||
"BACKLOG~BIORAD2~BIORAD3~BIORAD4~BIORAD5~CDE4~CDE5~CDE6~DEP08CEPIEPSILON~DEP08SIASM~DEP08SIHTRPLC~EC~HGCV1~HGCV2~HGCV3~MESAFIBACKLOG~MET06AWCT~MET08ANLYSDIFAAST230~MET08AWCT~MET08DDUPSFS6420~MET08DDUPSP1TBI~MET08RESIHGCV~MET08RESIMAPCDE~MET08RESISRP2100~MET08THFTIRQS408M~MET08THFTIRSTRATUS~METCLIMATEC~R29~R32~R36~R47~R55~R57~R61~R62~R65~R70~R72~R73~R74~R75~R77~SP101~SPV01~SRP~TENCOR1~TENCOR2~TENCOR3~TRENDLOG~WC6INCH1~WC6INCH2~WC6INCH3~WC6INCH4~WC8INCH1~WC8INCH2~WC8INCH3",
|
||||
"s",
|
||||
"X",
|
||||
"D:/ProgramData/EC_Characterization_Si/Dummy/DEP08CEPIEPSILON/WorkWeek",
|
||||
"Day-Helper-2025-11-11",
|
||||
"*.json",
|
||||
"D:/ProgramData/EC_Characterization_Si/Dummy/DEP08CEPIEPSILON/WorkWeekOrder",
|
||||
"D:/ProgramData/EC_Characterization_Si/Dummy/DEP08CEPIEPSILON/WorkWeekOrderWithFiltered",
|
||||
"s",
|
||||
"X",
|
||||
"D:/ProgramData/EC_Characterization_Si/Dummy/DEP08CEPIEPSILON/JavaScriptObjectNotation",
|
||||
|
||||
15
.vscode/settings.json
vendored
15
.vscode/settings.json
vendored
@ -24,6 +24,7 @@
|
||||
"BIORAD",
|
||||
"BIRT",
|
||||
"CHIL",
|
||||
"CLHI",
|
||||
"DEAT",
|
||||
"digi",
|
||||
"endianness",
|
||||
@ -32,11 +33,13 @@
|
||||
"FAMS",
|
||||
"Gatus",
|
||||
"GIVN",
|
||||
"HCLHI",
|
||||
"HGCV",
|
||||
"HUSB",
|
||||
"Immich",
|
||||
"INDI",
|
||||
"Infineon",
|
||||
"JOBID",
|
||||
"Kanban",
|
||||
"kanbn",
|
||||
"Kofax",
|
||||
@ -45,20 +48,32 @@
|
||||
"mesfs",
|
||||
"mestsa",
|
||||
"mklink",
|
||||
"NDIL",
|
||||
"netrm",
|
||||
"NINJ",
|
||||
"NpgSql",
|
||||
"NSFX",
|
||||
"NSRC",
|
||||
"NSRCS",
|
||||
"OBJE",
|
||||
"onenote",
|
||||
"PDFC",
|
||||
"PDIL",
|
||||
"pdsf",
|
||||
"Permyriad",
|
||||
"pged",
|
||||
"Phares",
|
||||
"PINJ",
|
||||
"PPEXECNAME",
|
||||
"PPID",
|
||||
"PPSTEPNAME",
|
||||
"PSRCS",
|
||||
"Renci",
|
||||
"Reparse",
|
||||
"Rijndael",
|
||||
"SCRLOAD",
|
||||
"Serilog",
|
||||
"SRCS",
|
||||
"startable",
|
||||
"SUBM",
|
||||
"SURN",
|
||||
|
||||
@ -120,14 +120,14 @@ internal static partial class Helper20250601 {
|
||||
}
|
||||
}
|
||||
responseAfter = stringBuilder.ToString();
|
||||
cellNames = responseAfter.Split(new string[] { "CellName" }, StringSplitOptions.None);
|
||||
cellNames = responseAfter.Split(["CellName"], StringSplitOptions.None);
|
||||
foreach (string segment in cellNames) {
|
||||
if (stop) {
|
||||
break;
|
||||
}
|
||||
key = string.Empty;
|
||||
state = string.Empty;
|
||||
segments = segment.Split(new string[] { "WindowsName" }, StringSplitOptions.None);
|
||||
segments = segment.Split(["WindowsName"], StringSplitOptions.None);
|
||||
if (segments.Length != 2) {
|
||||
continue;
|
||||
}
|
||||
@ -321,9 +321,9 @@ internal static partial class Helper20250601 {
|
||||
}
|
||||
}
|
||||
if (errorDescription != "a") {
|
||||
string[] segments = record.Text.Split(new string[] { "ErrorDescription" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] segments = record.Text.Split(["ErrorDescription"], StringSplitOptions.RemoveEmptyEntries);
|
||||
if (segments.Length > 1) {
|
||||
segments = segments[1].Split(new string[] { "Info" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
segments = segments[1].Split(["Info"], StringSplitOptions.RemoveEmptyEntries);
|
||||
errorDescription = segments[0].Trim();
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,14 +120,14 @@ internal static partial class Helper20250602 {
|
||||
}
|
||||
}
|
||||
responseAfter = stringBuilder.ToString();
|
||||
cellNames = responseAfter.Split(new string[] { "CellName" }, StringSplitOptions.None);
|
||||
cellNames = responseAfter.Split(["CellName"], StringSplitOptions.None);
|
||||
foreach (string segment in cellNames) {
|
||||
if (stop) {
|
||||
break;
|
||||
}
|
||||
key = string.Empty;
|
||||
state = string.Empty;
|
||||
segments = segment.Split(new string[] { "WindowsName" }, StringSplitOptions.None);
|
||||
segments = segment.Split(["WindowsName"], StringSplitOptions.None);
|
||||
if (segments.Length != 2) {
|
||||
continue;
|
||||
}
|
||||
@ -340,9 +340,9 @@ internal static partial class Helper20250602 {
|
||||
}
|
||||
}
|
||||
if (errorDescription != "a") {
|
||||
string[] segments = record.Text.Split(new string[] { "ErrorDescription" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] segments = record.Text.Split(["ErrorDescription"], StringSplitOptions.RemoveEmptyEntries);
|
||||
if (segments.Length > 1) {
|
||||
segments = segments[1].Split(new string[] { "Info" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
segments = segments[1].Split(["Info"], StringSplitOptions.RemoveEmptyEntries);
|
||||
errorDescription = segments[0].Trim();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
@ -57,10 +57,12 @@ internal static partial class Helper20250701 {
|
||||
string markdown;
|
||||
string checkFile;
|
||||
FileInfo fileInfo;
|
||||
string weekOfYear;
|
||||
string? pipeTable;
|
||||
string? collections;
|
||||
string? directoryName;
|
||||
string checkDirectory;
|
||||
Calendar calendar = new CultureInfo("en-US").Calendar;
|
||||
foreach (string directory in directories) {
|
||||
if (sizeFilter < 987654321 && Path.GetFileName(directory).Contains('-')) {
|
||||
continue;
|
||||
@ -75,8 +77,9 @@ internal static partial class Helper20250701 {
|
||||
if (string.IsNullOrEmpty(directoryName)) {
|
||||
continue;
|
||||
}
|
||||
weekOfYear = $"{fileInfo.LastWriteTime.Year}_Week_{calendar.GetWeekOfYear(fileInfo.LastWriteTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
|
||||
if (fileInfo.Length > sizeFilter && !directoryName.StartsWith('Z')) {
|
||||
checkDirectory = Path.Combine(sourceDirectory, $"Z{directoryName}");
|
||||
checkDirectory = Path.Combine(sourceDirectory, $"Z{directoryName}", weekOfYear);
|
||||
if (!Directory.Exists(checkDirectory)) {
|
||||
_ = Directory.CreateDirectory(checkDirectory);
|
||||
}
|
||||
@ -87,7 +90,7 @@ internal static partial class Helper20250701 {
|
||||
File.Move(file, checkFile);
|
||||
continue;
|
||||
}
|
||||
checkDirectory = Path.Combine(destinationDirectory, directoryName);
|
||||
checkDirectory = Path.Combine(destinationDirectory, directoryName, weekOfYear);
|
||||
if (!Directory.Exists(checkDirectory)) {
|
||||
_ = Directory.CreateDirectory(checkDirectory);
|
||||
}
|
||||
|
||||
@ -7,11 +7,6 @@ namespace File_Folder_Helper.ADO2025.PI6;
|
||||
|
||||
internal static partial class Helper20250709 {
|
||||
|
||||
// [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
// [JsonSerializable(typeof(JsonElement[]))]
|
||||
// internal partial class Helper20250709JsonElementSourceGenerationContext : JsonSerializerContext {
|
||||
// }
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
[JsonSerializable(typeof(Raw))]
|
||||
private partial class RawSourceGenerationContext : JsonSerializerContext {
|
||||
@ -124,22 +119,6 @@ internal static partial class Helper20250709 {
|
||||
[property: JsonPropertyName("LL2WafersIn")] long? LL2WafersIn,
|
||||
[property: JsonPropertyName("LL2WfrCnt")] long? LL2WfrCnt,
|
||||
[property: JsonPropertyName("ProcessState")] long? ProcessState);
|
||||
// [property: JsonPropertyName("A_BASIC_TYPE")] string? ABasicType,
|
||||
// [property: JsonPropertyName("A_INFO")] string? AInfo,
|
||||
// [property: JsonPropertyName("A_INFO2")] string? AInfo2,
|
||||
// [property: JsonPropertyName("A_JOBID")] string? AJobid,
|
||||
// [property: JsonPropertyName("A_LAYER")] string? ALayer,
|
||||
// [property: JsonPropertyName("A_LAYER2")] string? ALayer2,
|
||||
// [property: JsonPropertyName("A_MES_ENTITY")] string? AMesEntity,
|
||||
// [property: JsonPropertyName("A_MID")] string? AMID,
|
||||
// [property: JsonPropertyName("A_NULL_DATA")] string? ANullData,
|
||||
// [property: JsonPropertyName("A_PPID")] string? APPID,
|
||||
// [property: JsonPropertyName("A_PROCESS_JOBID")] string? AProcessJobid,
|
||||
// [property: JsonPropertyName("A_PRODUCT")] string? AProduct,
|
||||
// [property: JsonPropertyName("A_SEQUENCE")] string? ASequence,
|
||||
// [property: JsonPropertyName("A_WAFER_ID")] string? AWaferId,
|
||||
// [property: JsonPropertyName("A_WAFER_POS")] string? AWaferPos
|
||||
// cspell::enable,
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, NumberHandling = JsonNumberHandling.AllowReadingFromString)]
|
||||
[JsonSerializable(typeof(Reactor))]
|
||||
|
||||
@ -57,8 +57,8 @@ internal static partial class Helper20251022 {
|
||||
FileInfo fileInfo;
|
||||
string[] segments;
|
||||
string weekOfYear;
|
||||
Calendar calendar = new CultureInfo("en-US").Calendar;
|
||||
List<string>? collection;
|
||||
Calendar calendar = new CultureInfo("en-US").Calendar;
|
||||
foreach (string directory in directories) {
|
||||
files = Directory.GetFiles(directory, searchPattern, SearchOption.TopDirectoryOnly);
|
||||
files = files.OrderBy(l => l).ThenBy(l => l.Length).ToArray();
|
||||
|
||||
296
ADO2025/PI8/.editorconfig
Normal file
296
ADO2025/PI8/.editorconfig
Normal file
@ -0,0 +1,296 @@
|
||||
[*.md]
|
||||
end_of_line = crlf
|
||||
file_header_template = unset
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = false
|
||||
root = true
|
||||
tab_width = 2
|
||||
[*.csproj]
|
||||
end_of_line = crlf
|
||||
file_header_template = unset
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = false
|
||||
root = true
|
||||
tab_width = 2
|
||||
[*.cs]
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = true
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
csharp_new_line_before_catch = false
|
||||
csharp_new_line_before_else = false
|
||||
csharp_new_line_before_finally = false
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = none
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
csharp_prefer_braces = true
|
||||
csharp_prefer_qualified_reference = true:error
|
||||
csharp_prefer_simple_default_expression = true:warning
|
||||
csharp_prefer_simple_using_statement = true:warning
|
||||
csharp_prefer_static_local_function = true:warning
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = false
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
|
||||
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
|
||||
csharp_style_allow_embedded_statements_on_same_line_experimental = true
|
||||
csharp_style_conditional_delegate_call = true
|
||||
csharp_style_deconstructed_variable_declaration = false
|
||||
csharp_style_expression_bodied_accessors = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_constructors = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_indexers = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_local_functions = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_methods = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_operators = when_on_single_line:warning
|
||||
csharp_style_expression_bodied_properties = when_on_single_line:warning
|
||||
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
|
||||
csharp_style_inlined_variable_declaration = false
|
||||
csharp_style_namespace_declarations = file_scoped:warning
|
||||
csharp_style_pattern_local_over_anonymous_function = true:warning
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:warning
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
|
||||
csharp_style_prefer_index_operator = true:warning
|
||||
csharp_style_prefer_not_pattern = true:warning
|
||||
csharp_style_prefer_null_check_over_type_check = true
|
||||
csharp_style_prefer_pattern_matching = true:warning
|
||||
csharp_style_prefer_range_operator = true:warning
|
||||
csharp_style_prefer_switch_expression = true:warning
|
||||
csharp_style_throw_expression = true
|
||||
csharp_style_unused_value_assignment_preference = discard_variable:warning
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:warning
|
||||
csharp_style_var_elsewhere = false:warning
|
||||
csharp_style_var_for_built_in_types = false:warning
|
||||
csharp_style_var_when_type_is_apparent = false:warning
|
||||
csharp_using_directive_placement = outside_namespace
|
||||
dotnet_analyzer_diagnostic.category-Design.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Documentation.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Globalization.severity = none
|
||||
dotnet_analyzer_diagnostic.category-Interoperability.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Maintainability.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Naming.severity = none
|
||||
dotnet_analyzer_diagnostic.category-Performance.severity = none
|
||||
dotnet_analyzer_diagnostic.category-Reliability.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Security.severity = error
|
||||
dotnet_analyzer_diagnostic.category-SingleFile.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Style.severity = error
|
||||
dotnet_analyzer_diagnostic.category-Usage.severity = error
|
||||
dotnet_code_quality_unused_parameters = all
|
||||
dotnet_code_quality_unused_parameters = non_public
|
||||
dotnet_code_quality.CAXXXX.api_surface = private, internal
|
||||
dotnet_diagnostic.CA1001.severity = error # CA1001: Types that own disposable fields should be disposable
|
||||
dotnet_diagnostic.CA1051.severity = error # CA1051: Do not declare visible instance fields
|
||||
dotnet_diagnostic.CA1511.severity = warning # CA1511: Use 'ArgumentException.ThrowIfNullOrEmpty' instead of explicitly throwing a new exception instance
|
||||
dotnet_diagnostic.CA1513.severity = warning # Use 'ObjectDisposedException.ThrowIf' instead of explicitly throwing a new exception instance
|
||||
dotnet_diagnostic.CA1825.severity = warning # CA1825: Avoid zero-length array allocations
|
||||
dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
|
||||
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
|
||||
dotnet_diagnostic.CA1860.severity = error # CA1860: Prefer comparing 'Count' to 0 rather than using 'Any()', both for clarity and for performance
|
||||
dotnet_diagnostic.CA1862.severity = warning # CA1862: Prefer using 'string.Equals(string, StringComparison)' to perform a case-insensitive comparison, but keep in mind that this might cause subtle changes in behavior, so make sure to conduct thorough testing after applying the suggestion, or if culturally sensitive comparison is not required, consider using 'StringComparison.OrdinalIgnoreCase'
|
||||
dotnet_diagnostic.CA1869.severity = none # CA1869: Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead.
|
||||
dotnet_diagnostic.CA2201.severity = none # CA2201: Exception type System.NullReferenceException is reserved by the runtime
|
||||
dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template should not vary between calls to 'LoggerExtensions.LogInformation(ILogger, string?, params object?[])'
|
||||
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
|
||||
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
|
||||
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
|
||||
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
|
||||
dotnet_diagnostic.IDE0010.severity = none # Add missing cases to switch statement (IDE0010)
|
||||
dotnet_diagnostic.IDE0028.severity = error # IDE0028: Collection initialization can be simplified
|
||||
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
|
||||
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
|
||||
dotnet_diagnostic.IDE0048.severity = none # Parentheses preferences (IDE0047 and IDE0048)
|
||||
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
|
||||
dotnet_diagnostic.IDE0051.severity = error # Private member '' is unused [, ]
|
||||
dotnet_diagnostic.IDE0058.severity = warning # IDE0058: Expression value is never used
|
||||
dotnet_diagnostic.IDE0060.severity = error # IDE0060: Remove unused parameter
|
||||
dotnet_diagnostic.IDE0074.severity = warning # IDE0074: Use compound assignment
|
||||
dotnet_diagnostic.IDE0130.severity = none # Namespace does not match folder structure (IDE0130)
|
||||
dotnet_diagnostic.IDE0270.severity = warning # IDE0270: Null check can be simplified
|
||||
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]csharp(IDE0290)
|
||||
dotnet_diagnostic.IDE0300.severity = error # IDE0300: Collection initialization can be simplified
|
||||
dotnet_diagnostic.IDE0301.severity = error #IDE0301: Collection initialization can be simplified
|
||||
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
|
||||
dotnet_naming_rule.class_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.class_should_be_pascal_case.symbols = class
|
||||
dotnet_naming_rule.delegate_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate
|
||||
dotnet_naming_rule.enum_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum
|
||||
dotnet_naming_rule.event_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.event_should_be_pascal_case.symbols = event
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||
dotnet_naming_rule.method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.method_should_be_pascal_case.symbols = method
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||
dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method
|
||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning
|
||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field
|
||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning
|
||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field
|
||||
dotnet_naming_rule.property_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.property_should_be_pascal_case.symbols = property
|
||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning
|
||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field
|
||||
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field
|
||||
dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field
|
||||
dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method
|
||||
dotnet_naming_rule.struct_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct
|
||||
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||
dotnet_naming_style.begins_with_i.required_suffix =
|
||||
dotnet_naming_style.begins_with_i.word_separator =
|
||||
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||
dotnet_naming_style.pascal_case.required_prefix =
|
||||
dotnet_naming_style.pascal_case.required_suffix =
|
||||
dotnet_naming_style.pascal_case.word_separator =
|
||||
dotnet_naming_style.private_of_internal_field.capitalization = pascal_case
|
||||
dotnet_naming_style.private_of_internal_field.required_prefix = _
|
||||
dotnet_naming_style.private_of_internal_field.required_suffix =
|
||||
dotnet_naming_style.private_of_internal_field.word_separator =
|
||||
dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.abstract_method.applicable_kinds = method
|
||||
dotnet_naming_symbols.abstract_method.required_modifiers = abstract
|
||||
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.class.applicable_kinds = class
|
||||
dotnet_naming_symbols.class.required_modifiers =
|
||||
dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.delegate.applicable_kinds = delegate
|
||||
dotnet_naming_symbols.delegate.required_modifiers =
|
||||
dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.enum.applicable_kinds = enum
|
||||
dotnet_naming_symbols.enum.required_modifiers =
|
||||
dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.event.applicable_kinds = event
|
||||
dotnet_naming_symbols.event.required_modifiers =
|
||||
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interface.required_modifiers =
|
||||
dotnet_naming_symbols.method.applicable_accessibilities = public
|
||||
dotnet_naming_symbols.method.applicable_kinds = method
|
||||
dotnet_naming_symbols.method.required_modifiers =
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
dotnet_naming_symbols.private_method.applicable_accessibilities = private
|
||||
dotnet_naming_symbols.private_method.applicable_kinds = method
|
||||
dotnet_naming_symbols.private_method.required_modifiers =
|
||||
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
|
||||
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
|
||||
dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected
|
||||
dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static
|
||||
dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.property.applicable_kinds = property
|
||||
dotnet_naming_symbols.property.required_modifiers =
|
||||
dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
|
||||
dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_or_protected_field.required_modifiers =
|
||||
dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.static_field.applicable_kinds = field
|
||||
dotnet_naming_symbols.static_field.required_modifiers = static
|
||||
dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.static_method.applicable_kinds = method
|
||||
dotnet_naming_symbols.static_method.required_modifiers = static
|
||||
dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.struct.applicable_kinds = struct
|
||||
dotnet_naming_symbols.struct.required_modifiers =
|
||||
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
|
||||
dotnet_naming_symbols.types.required_modifiers =
|
||||
dotnet_remove_unnecessary_suppression_exclusions = 0
|
||||
dotnet_separate_import_directive_groups = false
|
||||
dotnet_sort_system_directives_first = false
|
||||
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
|
||||
dotnet_style_allow_statement_immediately_after_block_experimental = true
|
||||
dotnet_style_coalesce_expression = true
|
||||
dotnet_style_collection_initializer = true:warning
|
||||
dotnet_style_explicit_tuple_names = true:warning
|
||||
dotnet_style_namespace_match_folder = true
|
||||
dotnet_style_null_propagation = true:warning
|
||||
dotnet_style_object_initializer = true:warning
|
||||
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true
|
||||
dotnet_style_predefined_type_for_member_access = true:warning
|
||||
dotnet_style_prefer_auto_properties = true:warning
|
||||
dotnet_style_prefer_compound_assignment = true:warning
|
||||
dotnet_style_prefer_conditional_expression_over_assignment = false
|
||||
dotnet_style_prefer_conditional_expression_over_return = false
|
||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
|
||||
dotnet_style_prefer_inferred_tuple_names = true:warning
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true:warning
|
||||
dotnet_style_prefer_simplified_interpolation = true
|
||||
dotnet_style_qualification_for_event = false:error
|
||||
dotnet_style_qualification_for_field = false
|
||||
dotnet_style_qualification_for_method = false:error
|
||||
dotnet_style_qualification_for_property = false:error
|
||||
dotnet_style_readonly_field = true:warning
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members
|
||||
end_of_line = crlf
|
||||
file_header_template = unset
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = false
|
||||
root = true
|
||||
tab_width = 4
|
||||
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822
|
||||
# https://github.com/dotnet/aspnetcore/blob/main/.editorconfig
|
||||
# https://github.com/dotnet/project-system/blob/main/.editorconfig
|
||||
646
ADO2025/PI8/Helper-2025-11-11.cs
Normal file
646
ADO2025/PI8/Helper-2025-11-11.cs
Normal file
@ -0,0 +1,646 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.ADO2025.PI8;
|
||||
|
||||
internal static partial class Helper20251111 {
|
||||
|
||||
private record Record([property: JsonPropertyName("Time")] decimal? Time, // Time
|
||||
[property: JsonPropertyName("A_LOGISTICS")] int? A_LOGISTICS, // A_LOGISTICS
|
||||
[property: JsonPropertyName("id12")] decimal? Id12, // CenterTemp
|
||||
[property: JsonPropertyName("id13")] decimal? Id13, // CenterSetPoint
|
||||
[property: JsonPropertyName("id15")] decimal? Id15, // FrontTemp
|
||||
[property: JsonPropertyName("id16")] decimal? Id16, // FrontSetPoint
|
||||
[property: JsonPropertyName("id18")] decimal? Id18, // SideTemp
|
||||
[property: JsonPropertyName("id19")] decimal? Id19, // SideSetPoint
|
||||
[property: JsonPropertyName("id21")] decimal? Id21, // RearTemp
|
||||
[property: JsonPropertyName("id22")] decimal? Id22, // RearSetPoint
|
||||
[property: JsonPropertyName("id25")] decimal? Id25, // N2H2SetPoint
|
||||
[property: JsonPropertyName("id26")] decimal? Id26, // N2H2Flow
|
||||
[property: JsonPropertyName("id29")] decimal? Id29, // HCLHISetPoint
|
||||
[property: JsonPropertyName("id37")] decimal? Id37, // NSRCSetPoint
|
||||
[property: JsonPropertyName("id38")] decimal? Id38, // NSRCFlow
|
||||
[property: JsonPropertyName("id39")] decimal? Id39, // NDILSetPoint
|
||||
[property: JsonPropertyName("id40")] decimal? Id40, // NDILFlow
|
||||
[property: JsonPropertyName("id41")] decimal? Id41, // NINJSetPoint
|
||||
[property: JsonPropertyName("id42")] decimal? Id42, // NINJFlow
|
||||
[property: JsonPropertyName("id27")] decimal? Id27, // HCLSetPoint
|
||||
[property: JsonPropertyName("id28")] decimal? Id28, // HCLFlow
|
||||
[property: JsonPropertyName("id30")] decimal? Id30, // HCLHIFlow
|
||||
[property: JsonPropertyName("id61")] decimal? Id61, // ROTSetPoint
|
||||
[property: JsonPropertyName("id62")] decimal? Id62, // ROTSpeed
|
||||
[property: JsonPropertyName("id173")] decimal? Id173, // LVC1Carrier
|
||||
[property: JsonPropertyName("id58")] decimal? Id58, // LVC1Flow
|
||||
[property: JsonPropertyName("id172")] decimal? Id172, // LVC1Ratio
|
||||
[property: JsonPropertyName("id57")] decimal? Id57, // LVC1SetPoint
|
||||
[property: JsonPropertyName("id193")] decimal? Id193, // SCRLOAD4
|
||||
[property: JsonPropertyName("id183")] decimal? Id183, // SCRDrive4
|
||||
[property: JsonPropertyName("vp93")] int? VP93, // ProcessState
|
||||
[property: JsonPropertyName("vp154")] int? VP154, // SystemState
|
||||
[property: JsonPropertyName("vp78")] int? VP78, // LL1State
|
||||
[property: JsonPropertyName("vp83")] int? VP83, // LL2State
|
||||
[property: JsonPropertyName("vp176")] int? VP176, // TotalWaferCount
|
||||
[property: JsonPropertyName("vp79")] int? VP79, // LL1Init
|
||||
[property: JsonPropertyName("vp81")] int? VP81, // LL1WafersIn
|
||||
[property: JsonPropertyName("vp82")] int? VP82, // LL1WfrCnt
|
||||
[property: JsonPropertyName("vp84")] int? VP84, // LL2Init
|
||||
[property: JsonPropertyName("vp86")] int? VP86, // LL2WafersIn
|
||||
[property: JsonPropertyName("vp87")] int? VP87, // LL2WfrCnt
|
||||
[property: JsonPropertyName("vp80")] string? VP80, // LL1LotId
|
||||
[property: JsonPropertyName("vp85")] string? VP85, // LL2LotId
|
||||
[property: JsonPropertyName("vp153")] string? VP153, // PPSTEPNAME
|
||||
[property: JsonPropertyName("vp221")] string? VP221, // LeftDefaultRecipe
|
||||
[property: JsonPropertyName("vp222")] string? VP222, // RightDefaultRecipe
|
||||
[property: JsonPropertyName("vp223")] string? VP223, // RecipeCompleteMsg
|
||||
[property: JsonPropertyName("NUM_DATA_ROWS")] int? NUM_DATA_ROWS, // NUM_DATA_ROWS
|
||||
[property: JsonPropertyName("NUM_DATA_COLUMNS")] int? NUM_DATA_COLUMNS, // NUM_DATA_COLUMNS
|
||||
[property: JsonPropertyName("START_TIME_FORMAT")] string? START_TIME_FORMAT, // START_TIME_FORMAT
|
||||
[property: JsonPropertyName("START_TIME")] string? START_TIME, // START_TIME
|
||||
[property: JsonPropertyName("LOGISTICS_COLUMN")] string? LOGISTICS_COLUMN, // LOGISTICS_COLUMN
|
||||
[property: JsonPropertyName("A_BASIC_TYPE")] string? A_BASIC_TYPE, // A_BASIC_TYPE
|
||||
[property: JsonPropertyName("A_INFO")] string? A_INFO, // A_INFO
|
||||
[property: JsonPropertyName("A_INFO2")] string? A_INFO2, // A_INFO2
|
||||
[property: JsonPropertyName("A_JOBID")] string? A_JOBID, // A_JOBID
|
||||
[property: JsonPropertyName("A_LAYER")] string? A_LAYER, // A_LAYER
|
||||
[property: JsonPropertyName("A_LAYER2")] string? A_LAYER2, // A_LAYER2
|
||||
[property: JsonPropertyName("A_MES_ENTITY")] string? A_MES_ENTITY, // A_MES_ENTITY
|
||||
[property: JsonPropertyName("A_MID")] string? A_MID, // A_MID
|
||||
[property: JsonPropertyName("A_NULL_DATA")] string? A_NULL_DATA, // A_NULL_DATA
|
||||
[property: JsonPropertyName("A_PPID")] string? A_PPID, // A_PPID
|
||||
[property: JsonPropertyName("A_PROCESS_JOBID")] string? A_PROCESS_JOBID, // A_PROCESS_JOBID
|
||||
[property: JsonPropertyName("A_PRODUCT")] string? A_PRODUCT, // A_PRODUCT
|
||||
[property: JsonPropertyName("A_SEQUENCE")] string? A_SEQUENCE, // A_SEQUENCE
|
||||
[property: JsonPropertyName("A_WADER_ID")] string? A_WADER_ID, // A_WADER_ID
|
||||
[property: JsonPropertyName("A_WAFER_POS")] string? A_WAFER_POS, // A_WAFER_POS
|
||||
[property: JsonPropertyName("id31")] decimal? Id31, // PSRCSetPoint
|
||||
[property: JsonPropertyName("id32")] decimal? Id32, // PSRCFlow
|
||||
[property: JsonPropertyName("id33")] decimal? Id33, // PDILSetPoint
|
||||
[property: JsonPropertyName("id34")] decimal? Id34, // PDILFlow
|
||||
[property: JsonPropertyName("id35")] decimal? Id35, // PINJSetPoint
|
||||
[property: JsonPropertyName("id36")] decimal? Id36, // PINJFlow
|
||||
[property: JsonPropertyName("vp96")] string? VP96, // PPEXECNAME
|
||||
[property: JsonPropertyName("A_CHAMBER")] string? A_CHAMBER, // A_CHAMBER
|
||||
[property: JsonPropertyName("A_SLOT")] string? A_SLOT) { // A_SLOT
|
||||
|
||||
internal static ReadOnlyCollection<Record> GetCollection(string file) {
|
||||
List<Record> results = [];
|
||||
string json;
|
||||
Record? result;
|
||||
string? text = File.ReadAllText(file);
|
||||
JsonElement[]? jsonElements = JsonSerializer.Deserialize(text, Helper20251111JsonElementArraySourceGenerationContext.Default.JsonElementArray);
|
||||
if (jsonElements is not null && jsonElements.Length > 0) {
|
||||
foreach (JsonElement jsonElement in jsonElements) {
|
||||
json = jsonElement.ToString();
|
||||
if (json.Contains("vp153\":\"\"")) {
|
||||
continue;
|
||||
}
|
||||
result = JsonSerializer.Deserialize(jsonElement, Helper20251111RecordSourceGenerationContext.Default.Record);
|
||||
if (result is null) {
|
||||
continue;
|
||||
}
|
||||
results.Add(result);
|
||||
}
|
||||
}
|
||||
return results.AsReadOnly();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = false, DefaultIgnoreCondition = JsonIgnoreCondition.Never, NumberHandling = JsonNumberHandling.AllowReadingFromString)]
|
||||
[JsonSerializable(typeof(Record))]
|
||||
private partial class Helper20251111RecordSourceGenerationContext : JsonSerializerContext {
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = false, DefaultIgnoreCondition = JsonIgnoreCondition.Never, NumberHandling = JsonNumberHandling.AllowReadingFromString)]
|
||||
[JsonSerializable(typeof(Record[]))]
|
||||
private partial class Helper20251111RecordArraySourceGenerationContext : JsonSerializerContext {
|
||||
}
|
||||
|
||||
private record RecordWith([property: JsonPropertyName("Point")] int Point,
|
||||
[property: JsonPropertyName("Time")] decimal? Time,
|
||||
[property: JsonPropertyName("A_LOGISTICS")] int? A_LOGISTICS,
|
||||
[property: JsonPropertyName("CenterTemp")] decimal? Id12,
|
||||
[property: JsonPropertyName("CenterSetPoint")] decimal? Id13,
|
||||
[property: JsonPropertyName("CenterDevFromSetpoint")] decimal? CenterDevFromSetpoint,
|
||||
[property: JsonPropertyName("FrontTemp")] decimal? Id15,
|
||||
[property: JsonPropertyName("FrontSetPoint")] decimal? Id16,
|
||||
[property: JsonPropertyName("FrontDevFromSetpoint")] decimal? FrontDevFromSetpoint,
|
||||
[property: JsonPropertyName("SideTemp")] decimal? Id18,
|
||||
[property: JsonPropertyName("SideSetPoint")] decimal? Id19,
|
||||
[property: JsonPropertyName("SideDevFromSetpoint")] decimal? SideDevFromSetpoint,
|
||||
[property: JsonPropertyName("RearTemp")] decimal? Id21,
|
||||
[property: JsonPropertyName("RearSetPoint")] decimal? Id22,
|
||||
[property: JsonPropertyName("RearDevFromSetpoint")] decimal? RearDevFromSetpoint,
|
||||
[property: JsonPropertyName("N2H2SetPoint")] decimal? Id25,
|
||||
[property: JsonPropertyName("N2H2Flow")] decimal? Id26,
|
||||
[property: JsonPropertyName("N2H2DevFromSetpoint")] decimal? N2H2DevFromSetpoint,
|
||||
[property: JsonPropertyName("N2H2PercentDevFromSetpoint")] decimal? N2H2PercentDevFromSetpoint,
|
||||
[property: JsonPropertyName("HCLHISetPoint")] decimal? Id29,
|
||||
[property: JsonPropertyName("NSRCSetPoint")] decimal? Id37,
|
||||
[property: JsonPropertyName("NSRCFlow")] decimal? Id38,
|
||||
[property: JsonPropertyName("NSRCSDevFromSetpoint")] decimal? NSRCSDevFromSetpoint,
|
||||
[property: JsonPropertyName("NSRCSPercentDevFromSetpoint")] decimal? NSRCSPercentDevFromSetpoint,
|
||||
[property: JsonPropertyName("NDILSetPoint")] decimal? Id39,
|
||||
[property: JsonPropertyName("NDILFlow")] decimal? Id40,
|
||||
[property: JsonPropertyName("NDILDevFromSetpoint")] decimal? NDILDevFromSetpoint,
|
||||
[property: JsonPropertyName("NDILPercentDevFromSetpoint")] decimal? NDILPercentDevFromSetpoint,
|
||||
[property: JsonPropertyName("NINJSetPoint")] decimal? Id41,
|
||||
[property: JsonPropertyName("NINJFlow")] decimal? Id42,
|
||||
[property: JsonPropertyName("NINJDevFromSetpoint")] decimal? NINJDevFromSetpoint,
|
||||
[property: JsonPropertyName("NINJPercentDevFromSetpoint")] decimal? NINJPercentDevFromSetpoint,
|
||||
[property: JsonPropertyName("HCLSetPoint")] decimal? Id27,
|
||||
[property: JsonPropertyName("HCLFlow")] decimal? Id28,
|
||||
[property: JsonPropertyName("HCLHIFlow")] decimal? Id30,
|
||||
[property: JsonPropertyName("HCLHIDevFromSetpoint")] decimal? HCLHIDevFromSetpoint,
|
||||
[property: JsonPropertyName("HCLHIPercentDevFromSetpoint")] decimal? HCLHIPercentDevFromSetpoint,
|
||||
[property: JsonPropertyName("HCLDevFromSetpoint")] decimal? HCLDevFromSetpoint,
|
||||
[property: JsonPropertyName("HCLPercentDevFromSetpoint")] decimal? HCLPercentDevFromSetpoint,
|
||||
[property: JsonPropertyName("ROTSetPoint")] decimal? Id61,
|
||||
[property: JsonPropertyName("ROTSpeed")] decimal? Id62,
|
||||
[property: JsonPropertyName("ROTDevFromSetpoint")] decimal? ROTDevFromSetpoint,
|
||||
[property: JsonPropertyName("LVC1Carrier")] decimal? Id173,
|
||||
[property: JsonPropertyName("LVC1Flow")] decimal? Id58,
|
||||
[property: JsonPropertyName("LVC1Ratio")] decimal? Id172,
|
||||
[property: JsonPropertyName("LVC1SetPoint")] decimal? Id57,
|
||||
[property: JsonPropertyName("LVCDevFromSetpoint")] decimal? LVCDevFromSetpoint,
|
||||
[property: JsonPropertyName("LVCPercentDevFromSetpoint")] decimal? LVCPercentDevFromSetpoint,
|
||||
[property: JsonPropertyName("SCRLOAD4")] decimal? Id193,
|
||||
[property: JsonPropertyName("SCRDrive4")] decimal? Id183,
|
||||
[property: JsonPropertyName("ProcessState")] int? VP93,
|
||||
[property: JsonPropertyName("SystemState")] int? VP154,
|
||||
[property: JsonPropertyName("LL1State")] int? VP78,
|
||||
[property: JsonPropertyName("LL2State")] int? VP83,
|
||||
[property: JsonPropertyName("TotalWaferCount")] int? VP176,
|
||||
[property: JsonPropertyName("LL1Init")] int? VP79,
|
||||
[property: JsonPropertyName("LL1WafersIn")] int? VP81,
|
||||
[property: JsonPropertyName("LL1WfrCnt")] int? VP82,
|
||||
[property: JsonPropertyName("LL2Init")] int? VP84,
|
||||
[property: JsonPropertyName("LL2WafersIn")] int? VP86,
|
||||
[property: JsonPropertyName("LL2WfrCnt")] int? VP87,
|
||||
[property: JsonPropertyName("LL1LotId")] string? VP80,
|
||||
[property: JsonPropertyName("LL2LotId")] string? VP85,
|
||||
[property: JsonPropertyName("PPSTEPNAME")] string? VP153,
|
||||
[property: JsonPropertyName("LeftDefaultRecipe")] string? VP221,
|
||||
[property: JsonPropertyName("RightDefaultRecipe")] string? VP222,
|
||||
[property: JsonPropertyName("RecipeCompleteMsg")] string? VP223,
|
||||
[property: JsonPropertyName("NUM_DATA_ROWS")] int? NUM_DATA_ROWS,
|
||||
[property: JsonPropertyName("NUM_DATA_COLUMNS")] int? NUM_DATA_COLUMNS,
|
||||
[property: JsonPropertyName("START_TIME_FORMAT")] string? START_TIME_FORMAT,
|
||||
[property: JsonPropertyName("START_TIME")] string? START_TIME,
|
||||
[property: JsonPropertyName("LOGISTICS_COLUMN")] string? LOGISTICS_COLUMN,
|
||||
[property: JsonPropertyName("A_BASIC_TYPE")] string? A_BASIC_TYPE,
|
||||
[property: JsonPropertyName("A_INFO")] string? A_INFO,
|
||||
[property: JsonPropertyName("A_INFO2")] string? A_INFO2,
|
||||
[property: JsonPropertyName("A_JOBID")] string? A_JOBID,
|
||||
[property: JsonPropertyName("A_LAYER")] string? A_LAYER,
|
||||
[property: JsonPropertyName("A_LAYER2")] string? A_LAYER2,
|
||||
[property: JsonPropertyName("A_MES_ENTITY")] string? A_MES_ENTITY,
|
||||
[property: JsonPropertyName("A_MID")] string? A_MID,
|
||||
[property: JsonPropertyName("A_NULL_DATA")] string? A_NULL_DATA,
|
||||
[property: JsonPropertyName("A_PPID")] string? A_PPID,
|
||||
[property: JsonPropertyName("A_PROCESS_JOBID")] string? A_PROCESS_JOBID,
|
||||
[property: JsonPropertyName("A_PRODUCT")] string? A_PRODUCT,
|
||||
[property: JsonPropertyName("A_SEQUENCE")] string? A_SEQUENCE,
|
||||
[property: JsonPropertyName("A_WADER_ID")] string? A_WADER_ID,
|
||||
[property: JsonPropertyName("A_WAFER_POS")] string? A_WAFER_POS,
|
||||
[property: JsonPropertyName("PSRCSetPoint")] decimal? Id31,
|
||||
[property: JsonPropertyName("PSRCFlow")] decimal? Id32,
|
||||
[property: JsonPropertyName("PSRCSDevFromSetpoint")] decimal? PSRCSDevFromSetpoint,
|
||||
[property: JsonPropertyName("PSRCSPercentDevFromSetpoint")] decimal? PSRCSPercentDevFromSetpoint,
|
||||
[property: JsonPropertyName("PDILSetPoint")] decimal? Id33,
|
||||
[property: JsonPropertyName("PDILFlow")] decimal? Id34,
|
||||
[property: JsonPropertyName("PDILDevFromSetpoint")] decimal? PDILDevFromSetpoint,
|
||||
[property: JsonPropertyName("PDILPercentDevFromSetpoint")] decimal? PDILPercentDevFromSetpoint,
|
||||
[property: JsonPropertyName("PINJSetPoint")] decimal? Id35,
|
||||
[property: JsonPropertyName("PINJFlow")] decimal? Id36,
|
||||
[property: JsonPropertyName("PINJDevFromSetpoint")] decimal? PINJDevFromSetpoint,
|
||||
[property: JsonPropertyName("PINJPercentDevFromSetpoint")] decimal? PINJPercentDevFromSetpoint,
|
||||
[property: JsonPropertyName("PPEXECNAME")] string? VP96,
|
||||
[property: JsonPropertyName("A_CHAMBER")] string? A_CHAMBER,
|
||||
[property: JsonPropertyName("A_SLOT")] string? A_SLOT) {
|
||||
|
||||
internal static RecordWith Get(int i, Record record) {
|
||||
RecordWith result;
|
||||
int point = i + 1;
|
||||
decimal? centerDevFromSetpoint = (record.Id12 is not null && record.Id13 is not null) ? Math.Round(record.Id12.Value - record.Id13.Value, 6) : null;
|
||||
decimal? frontDevFromSetpoint = (record.Id15 is not null && record.Id16 is not null) ? Math.Round(record.Id15.Value - record.Id16.Value, 6) : null;
|
||||
decimal? sideDevFromSetpoint = (record.Id18 is not null && record.Id19 is not null) ? Math.Round(record.Id18.Value - record.Id19.Value, 6) : null;
|
||||
decimal? rearDevFromSetpoint = (record.Id21 is not null && record.Id22 is not null) ? Math.Round(record.Id21.Value - record.Id22.Value, 6) : null;
|
||||
decimal? n2H2DevFromSetpoint = (record.Id26 is not null && record.Id25 is not null) ? Math.Round(record.Id26.Value - record.Id25.Value, 6) : null;
|
||||
decimal? n2H2PercentDevFromSetpoint = (record.Id26 is not null && record.Id25 is not null && record.Id25 != 0) ? Math.Round((record.Id26.Value - record.Id25.Value) / record.Id25.Value * 100, 6) : null;
|
||||
decimal? nSRCSDevFromSetpoint = (record.Id38 is not null && record.Id37 is not null) ? Math.Round(record.Id38.Value - record.Id37.Value, 6) : null;
|
||||
decimal? nSRCSPercentDevFromSetpoint = (record.Id38 is not null && record.Id37 is not null && record.Id37 != 0) ? Math.Round((record.Id38.Value - record.Id37.Value) / record.Id37.Value * 100, 6) : null;
|
||||
decimal? nDILDevFromSetpoint = (record.Id40 is not null && record.Id39 is not null) ? Math.Round(record.Id40.Value - record.Id39.Value, 6) : null;
|
||||
decimal? nDILPercentDevFromSetpoint = (record.Id40 is not null && record.Id39 is not null && record.Id39 != 0) ? Math.Round((record.Id40.Value - record.Id39.Value) / record.Id39.Value * 100, 6) : null;
|
||||
decimal? nINJDevFromSetpoint = (record.Id42 is not null && record.Id41 is not null) ? Math.Round(record.Id42.Value - record.Id41.Value, 6) : null;
|
||||
decimal? nINJPercentDevFromSetpoint = (record.Id42 is not null && record.Id41 is not null && record.Id41 != 0) ? Math.Round((record.Id42.Value - record.Id41.Value) / record.Id41.Value * 100, 6) : null;
|
||||
decimal? pSRCSDevFromSetpoint = (record.Id32 is not null && record.Id31 is not null) ? Math.Round(record.Id32.Value - record.Id31.Value, 6) : null;
|
||||
decimal? pSRCSPercentDevFromSetpoint = (record.Id32 is not null && record.Id31 is not null && record.Id31 != 0) ? Math.Round((record.Id32.Value - record.Id31.Value) / record.Id31.Value * 100, 6) : null;
|
||||
decimal? pDILDevFromSetpoint = (record.Id34 is not null && record.Id33 is not null) ? Math.Round(record.Id34.Value - record.Id33.Value, 6) : null;
|
||||
decimal? pDILPercentDevFromSetpoint = (record.Id34 is not null && record.Id33 is not null && record.Id33 != 0) ? Math.Round((record.Id34.Value - record.Id33.Value) / record.Id33.Value * 100, 6) : null;
|
||||
decimal? pINJDevFromSetpoint = (record.Id36 is not null && record.Id35 is not null) ? Math.Round(record.Id36.Value - record.Id35.Value, 6) : null;
|
||||
decimal? pINJPercentDevFromSetpoint = (record.Id36 is not null && record.Id35 is not null && record.Id35 != 0) ? Math.Round((record.Id36.Value - record.Id35.Value) / record.Id35.Value * 100, 6) : null;
|
||||
decimal? hCLHIDevFromSetpoint = (record.Id30 is not null && record.Id29 is not null) ? Math.Round(record.Id30.Value - record.Id29.Value, 6) : null;
|
||||
decimal? hCLHIPercentDevFromSetpoint = (record.Id30 is not null && record.Id29 is not null && record.Id29 != 0) ? Math.Round((record.Id30.Value - record.Id29.Value) / record.Id29.Value * 100, 6) : null;
|
||||
decimal? hCLDevFromSetpoint = (record.Id28 is not null && record.Id27 is not null) ? Math.Round(record.Id28.Value - record.Id27.Value, 6) : null;
|
||||
decimal? hCLPercentDevFromSetpoint = (record.Id28 is not null && record.Id27 is not null && record.Id27 != 0) ? Math.Round((record.Id28.Value - record.Id27.Value) / record.Id27.Value * 100, 6) : null;
|
||||
decimal? rOTDevFromSetpoint = (record.Id62 is not null && record.Id61 is not null) ? Math.Round(record.Id62.Value - record.Id61.Value, 6) : null;
|
||||
decimal? lVCDevFromSetpoint = (record.Id58 is not null && record.Id57 is not null) ? Math.Round(record.Id58.Value - record.Id57.Value, 6) : null;
|
||||
decimal? lVCPercentDevFromSetpoint = (record.Id58 is not null && record.Id57 is not null && record.Id57 != 0) ? Math.Round((record.Id58.Value - record.Id57.Value) / record.Id57.Value * 100, 6) : null;
|
||||
if (record.VP223 == "FINISHED: 8/17/2025 0:01:30 CT10_15PH.6_3.0") {
|
||||
if (record.VP223 == "") { }
|
||||
}
|
||||
|
||||
result = new(Point: point,
|
||||
Time: record.Time,
|
||||
A_LOGISTICS: record.A_LOGISTICS,
|
||||
Id12: record.Id12,
|
||||
Id13: record.Id13,
|
||||
CenterDevFromSetpoint: centerDevFromSetpoint,
|
||||
Id15: record.Id15,
|
||||
Id16: record.Id16,
|
||||
FrontDevFromSetpoint: frontDevFromSetpoint,
|
||||
Id18: record.Id18,
|
||||
Id19: record.Id19,
|
||||
SideDevFromSetpoint: sideDevFromSetpoint,
|
||||
Id21: record.Id21,
|
||||
Id22: record.Id22,
|
||||
RearDevFromSetpoint: rearDevFromSetpoint,
|
||||
Id25: record.Id25,
|
||||
Id26: record.Id26,
|
||||
N2H2DevFromSetpoint: n2H2DevFromSetpoint,
|
||||
N2H2PercentDevFromSetpoint: n2H2PercentDevFromSetpoint,
|
||||
Id29: record.Id29,
|
||||
Id37: record.Id37,
|
||||
Id38: record.Id38,
|
||||
NSRCSDevFromSetpoint: nSRCSDevFromSetpoint,
|
||||
NSRCSPercentDevFromSetpoint: nSRCSPercentDevFromSetpoint,
|
||||
Id39: record.Id39,
|
||||
Id40: record.Id40,
|
||||
NDILDevFromSetpoint: nDILDevFromSetpoint,
|
||||
NDILPercentDevFromSetpoint: nDILPercentDevFromSetpoint,
|
||||
Id41: record.Id41,
|
||||
Id42: record.Id42,
|
||||
NINJDevFromSetpoint: nINJDevFromSetpoint,
|
||||
NINJPercentDevFromSetpoint: nINJPercentDevFromSetpoint,
|
||||
Id27: record.Id27,
|
||||
Id28: record.Id28,
|
||||
Id30: record.Id30,
|
||||
HCLHIDevFromSetpoint: hCLHIDevFromSetpoint,
|
||||
HCLHIPercentDevFromSetpoint: hCLHIPercentDevFromSetpoint,
|
||||
HCLDevFromSetpoint: hCLDevFromSetpoint,
|
||||
HCLPercentDevFromSetpoint: hCLPercentDevFromSetpoint,
|
||||
Id61: record.Id61,
|
||||
Id62: record.Id62,
|
||||
ROTDevFromSetpoint: rOTDevFromSetpoint,
|
||||
Id173: record.Id173,
|
||||
Id58: record.Id58,
|
||||
Id172: record.Id172,
|
||||
Id57: record.Id57,
|
||||
LVCDevFromSetpoint: lVCDevFromSetpoint,
|
||||
LVCPercentDevFromSetpoint: lVCPercentDevFromSetpoint,
|
||||
Id193: record.Id193,
|
||||
Id183: record.Id183,
|
||||
VP93: record.VP93,
|
||||
VP154: record.VP154,
|
||||
VP78: record.VP78,
|
||||
VP83: record.VP83,
|
||||
VP176: record.VP176,
|
||||
VP79: record.VP79,
|
||||
VP81: record.VP81,
|
||||
VP82: record.VP82,
|
||||
VP84: record.VP84,
|
||||
VP86: record.VP86,
|
||||
VP87: record.VP87,
|
||||
VP80: record.VP80,
|
||||
VP85: record.VP85,
|
||||
VP153: record.VP153,
|
||||
VP221: record.VP221,
|
||||
VP222: record.VP222,
|
||||
VP223: record.VP223,
|
||||
NUM_DATA_ROWS: record.NUM_DATA_ROWS,
|
||||
NUM_DATA_COLUMNS: record.NUM_DATA_COLUMNS,
|
||||
START_TIME_FORMAT: record.START_TIME_FORMAT,
|
||||
START_TIME: record.START_TIME,
|
||||
LOGISTICS_COLUMN: record.LOGISTICS_COLUMN,
|
||||
A_BASIC_TYPE: record.A_BASIC_TYPE,
|
||||
A_INFO: record.A_INFO,
|
||||
A_INFO2: record.A_INFO2,
|
||||
A_JOBID: record.A_JOBID,
|
||||
A_LAYER: record.A_LAYER,
|
||||
A_LAYER2: record.A_LAYER2,
|
||||
A_MES_ENTITY: record.A_MES_ENTITY,
|
||||
A_MID: record.A_MID,
|
||||
A_NULL_DATA: record.A_NULL_DATA,
|
||||
A_PPID: record.A_PPID,
|
||||
A_PROCESS_JOBID: record.A_PROCESS_JOBID,
|
||||
A_PRODUCT: record.A_PRODUCT,
|
||||
A_SEQUENCE: record.A_SEQUENCE,
|
||||
A_WADER_ID: record.A_WADER_ID,
|
||||
A_WAFER_POS: record.A_WAFER_POS,
|
||||
Id31: record.Id31,
|
||||
Id32: record.Id32,
|
||||
PSRCSDevFromSetpoint: pSRCSDevFromSetpoint,
|
||||
PSRCSPercentDevFromSetpoint: pSRCSPercentDevFromSetpoint,
|
||||
Id33: record.Id33,
|
||||
Id34: record.Id34,
|
||||
PDILDevFromSetpoint: pDILDevFromSetpoint,
|
||||
PDILPercentDevFromSetpoint: pDILPercentDevFromSetpoint,
|
||||
Id35: record.Id35,
|
||||
Id36: record.Id36,
|
||||
PINJDevFromSetpoint: pINJDevFromSetpoint,
|
||||
PINJPercentDevFromSetpoint: pINJPercentDevFromSetpoint,
|
||||
VP96: record.VP96,
|
||||
A_CHAMBER: record.A_CHAMBER,
|
||||
A_SLOT: record.A_SLOT);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static ReadOnlyCollection<RecordWith> GetCollection(ReadOnlyCollection<Record> records, bool skipPPStepNameNullData) {
|
||||
List<RecordWith> results = [];
|
||||
RecordWith result;
|
||||
for (int i = 0; i < records.Count; i++) {
|
||||
if (string.IsNullOrEmpty(records[i].VP153) && skipPPStepNameNullData) {
|
||||
continue;
|
||||
}
|
||||
result = Get(i, records[i]);
|
||||
results.Add(result);
|
||||
}
|
||||
return results.AsReadOnly();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = false)]
|
||||
[JsonSerializable(typeof(JsonElement[]))]
|
||||
private partial class Helper20251111JsonElementArraySourceGenerationContext : JsonSerializerContext {
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = false, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, NumberHandling = JsonNumberHandling.AllowReadingFromString)]
|
||||
[JsonSerializable(typeof(RecordWith[]))]
|
||||
private partial class Helper20251111RecordWithArraySourceGenerationContext : JsonSerializerContext {
|
||||
}
|
||||
|
||||
internal static void AddAndSortWorkWeekFiles(ILogger<Worker> logger, List<string> args) {
|
||||
logger.LogInformation(args[0]);
|
||||
logger.LogInformation(args[1]);
|
||||
logger.LogInformation(args[2]);
|
||||
logger.LogInformation(args[3]);
|
||||
logger.LogInformation(args[4]);
|
||||
string searchPattern = args[2];
|
||||
const bool skipPPStepNameNullData = true;
|
||||
string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]);
|
||||
string destinationDirectory = Path.GetFullPath(args[3].Split('~')[0]);
|
||||
string destinationDirectoryB = Path.GetFullPath(args[4].Split('~')[0]);
|
||||
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.TopDirectoryOnly);
|
||||
AddAndSortWorkWeekFiles(logger, destinationDirectory, destinationDirectoryB, skipPPStepNameNullData, files);
|
||||
}
|
||||
|
||||
private static void AddAndSortWorkWeekFiles(ILogger<Worker> logger, string destinationDirectory, string destinationDirectoryB, bool skipPPStepNameNullData, string[] files) {
|
||||
string json;
|
||||
string fileName;
|
||||
string? jsonOld;
|
||||
string checkFile;
|
||||
ReadOnlyCollection<Record> records;
|
||||
ReadOnlyCollection<RecordWith> recordsWith;
|
||||
if (!Directory.Exists(destinationDirectory)) {
|
||||
_ = Directory.CreateDirectory(destinationDirectory);
|
||||
}
|
||||
if (!Directory.Exists(destinationDirectoryB)) {
|
||||
_ = Directory.CreateDirectory(destinationDirectoryB);
|
||||
}
|
||||
foreach (string file in files) {
|
||||
try {
|
||||
logger.LogInformation("Processing {file}", file);
|
||||
records = Record.GetCollection(file);
|
||||
if (records.Count == 0) {
|
||||
logger.LogWarning("result.Count == 0");
|
||||
continue;
|
||||
}
|
||||
fileName = Path.GetFileName(file);
|
||||
checkFile = Path.Combine(destinationDirectory, fileName);
|
||||
json = JsonSerializer.Serialize(records.ToArray(), Helper20251111RecordArraySourceGenerationContext.Default.RecordArray);
|
||||
jsonOld = File.Exists(checkFile) ? File.ReadAllText(checkFile) : null;
|
||||
if (!string.IsNullOrEmpty(jsonOld) && jsonOld == json) {
|
||||
logger.LogInformation("{fileName} has no changes", checkFile);
|
||||
} else {
|
||||
File.WriteAllText(checkFile, json);
|
||||
WriteCsvFile(checkFile, records);
|
||||
}
|
||||
recordsWith = RecordWith.GetCollection(records, skipPPStepNameNullData);
|
||||
checkFile = Path.Combine(destinationDirectoryB, fileName);
|
||||
json = JsonSerializer.Serialize(recordsWith.ToArray(), Helper20251111RecordWithArraySourceGenerationContext.Default.RecordWithArray);
|
||||
jsonOld = File.Exists(checkFile) ? File.ReadAllText(checkFile) : null;
|
||||
if (!string.IsNullOrEmpty(jsonOld) && jsonOld == json) {
|
||||
logger.LogInformation("{fileName} has no changes", checkFile);
|
||||
} else {
|
||||
File.WriteAllText(checkFile, json);
|
||||
WriteCsvFile(checkFile, recordsWith);
|
||||
}
|
||||
} catch {
|
||||
logger.LogWarning("Error logging file name a) {file}", file);
|
||||
logger.LogWarning("Error logging file name b) {file}", file);
|
||||
logger.LogWarning("Error logging file name c) {file}", file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void WriteCsvFile(string fileName, ReadOnlyCollection<Record> records) {
|
||||
List<string> lines = ["Time,A_LOGISTICS,id12,id13,id15,id16,id18,id19,id21,id22,id25,id26,id29,id37,id38,id39,id40,id41,id42,id27,id28,id30,id61,id62,id173,id58,id172,id57,id193,id183,vp93,vp154,vp78,vp83,vp176,vp79,vp81,vp82,vp84,vp86,vp87,vp80,vp85,vp153,vp221,vp222,vp223,NUM_DATA_ROWS,NUM_DATA_COLUMNS,START_TIME_FORMAT,START_TIME,LOGISTICS_COLUMN,A_BASIC_TYPE,A_INFO,A_INFO2,A_JOBID,A_LAYER,A_LAYER2,A_MES_ENTITY,A_MID,A_NULL_DATA,A_PPID,A_PROCESS_JOBID,A_PRODUCT,A_SEQUENCE,A_WADER_ID,A_WAFER_POS,id31,id32,id33,id34,id35,id36,vp96,A_CHAMBER,A_SLOT"];
|
||||
foreach (Record record in records) {
|
||||
lines.Add(string.Concat(record.Time, ',',
|
||||
record.A_LOGISTICS, ',',
|
||||
record.Id12, ',',
|
||||
record.Id13, ',',
|
||||
record.Id15, ',',
|
||||
record.Id16, ',',
|
||||
record.Id18, ',',
|
||||
record.Id19, ',',
|
||||
record.Id21, ',',
|
||||
record.Id22, ',',
|
||||
record.Id25, ',',
|
||||
record.Id26, ',',
|
||||
record.Id29, ',',
|
||||
record.Id37, ',',
|
||||
record.Id38, ',',
|
||||
record.Id39, ',',
|
||||
record.Id40, ',',
|
||||
record.Id41, ',',
|
||||
record.Id42, ',',
|
||||
record.Id27, ',',
|
||||
record.Id28, ',',
|
||||
record.Id30, ',',
|
||||
record.Id61, ',',
|
||||
record.Id62, ',',
|
||||
record.Id173, ',',
|
||||
record.Id58, ',',
|
||||
record.Id172, ',',
|
||||
record.Id57, ',',
|
||||
record.Id193, ',',
|
||||
record.Id183, ',',
|
||||
record.VP93, ',',
|
||||
record.VP154, ',',
|
||||
record.VP78, ',',
|
||||
record.VP83, ',',
|
||||
record.VP176, ',',
|
||||
record.VP79, ',',
|
||||
record.VP81, ',',
|
||||
record.VP82, ',',
|
||||
record.VP84, ',',
|
||||
record.VP86, ',',
|
||||
record.VP87, ',',
|
||||
record.VP80, ',',
|
||||
record.VP85, ',',
|
||||
record.VP153, ',',
|
||||
record.VP221, ',',
|
||||
record.VP222, ',',
|
||||
record.VP223, ',',
|
||||
record.NUM_DATA_ROWS, ',',
|
||||
record.NUM_DATA_COLUMNS, ',',
|
||||
record.START_TIME_FORMAT, ',',
|
||||
record.START_TIME, ',',
|
||||
record.LOGISTICS_COLUMN, ',',
|
||||
record.A_BASIC_TYPE, ',',
|
||||
record.A_INFO, ',',
|
||||
record.A_INFO2, ',',
|
||||
record.A_JOBID, ',',
|
||||
record.A_LAYER, ',',
|
||||
record.A_LAYER2, ',',
|
||||
record.A_MES_ENTITY, ',',
|
||||
record.A_MID, ',',
|
||||
record.A_NULL_DATA, ',',
|
||||
record.A_PPID, ',',
|
||||
record.A_PROCESS_JOBID, ',',
|
||||
record.A_PRODUCT, ',',
|
||||
record.A_SEQUENCE, ',',
|
||||
record.A_WADER_ID, ',',
|
||||
record.A_WAFER_POS, ',',
|
||||
record.Id31, ',',
|
||||
record.Id32, ',',
|
||||
record.Id33, ',',
|
||||
record.Id34, ',',
|
||||
record.Id35, ',',
|
||||
record.Id36, ',',
|
||||
record.VP96, ',',
|
||||
record.A_CHAMBER, ',',
|
||||
record.A_SLOT));
|
||||
}
|
||||
string text = string.Join(Environment.NewLine, lines);
|
||||
string csvFileName = Path.ChangeExtension(fileName, ".csv");
|
||||
File.WriteAllText(csvFileName, text);
|
||||
}
|
||||
|
||||
private static void WriteCsvFile(string fileName, ReadOnlyCollection<RecordWith> recordsWith) {
|
||||
List<string> lines = ["Point,Time,A_LOGISTICS,CenterTemp,CenterSetPoint,CenterDevFromSetpoint,FrontTemp,FrontSetPoint,FrontDevFromSetpoint,SideTemp,SideSetPoint,SideDevFromSetpoint,RearTemp,RearSetPoint,RearDevFromSetpoint,N2H2SetPoint,N2H2Flow,N2H2DevFromSetpoint,N2H2PercentDevFromSetpoint,HCLHISetPoint,NSRCSetPoint,NSRCFlow,NSRCSDevFromSetpoint,NSRCSPercentDevFromSetpoint,NDILSetPoint,NDILFlow,NDILDevFromSetpoint,NDILPercentDevFromSetpoint,NINJSetPoint,NINJFlow,NINJDevFromSetpoint,NINJPercentDevFromSetpoint,HCLSetPoint,HCLFlow,HCLHIFlow,HCLHIDevFromSetpoint,HCLHIPercentDevFromSetpoint,HCLDevFromSetpoint,HCLPercentDevFromSetpoint,ROTSetPoint,ROTSpeed,ROTDevFromSetpoint,LVC1Carrier,LVC1Flow,LVC1Ratio,LVC1SetPoint,LVCDevFromSetpoint,LVCPercentDevFromSetpoint,SCRLOAD4,SCRDrive4,ProcessState,SystemState,LL1State,LL2State,TotalWaferCount,LL1Init,LL1WafersIn,LL1WfrCnt,LL2Init,LL2WafersIn,LL2WfrCnt,LL1LotId,LL2LotId,PPSTEPNAME,LeftDefaultRecipe,RightDefaultRecipe,RecipeCompleteMsg,NUM_DATA_ROWS,NUM_DATA_COLUMNS,START_TIME_FORMAT,START_TIME,LOGISTICS_COLUMN,A_BASIC_TYPE,A_INFO,A_INFO2,A_JOBID,A_LAYER,A_LAYER2,A_MES_ENTITY,A_MID,A_NULL_DATA,A_PPID,A_PROCESS_JOBID,A_PRODUCT,A_SEQUENCE,A_WADER_ID,A_WAFER_POS,PSRCSetPoint,PSRCFlow,PSRCSDevFromSetpoint,PSRCSPercentDevFromSetpoint,PDILSetPoint,PDILFlow,PDILDevFromSetpoint,PDILPercentDevFromSetpoint,PINJSetPoint,PINJFlow,PINJDevFromSetpoint,PINJPercentDevFromSetpoint,PPEXECNAME,A_CHAMBER,A_SLOT"];
|
||||
foreach (RecordWith record in recordsWith) {
|
||||
lines.Add(string.Concat(record.Point, ',',
|
||||
record.Time, ',',
|
||||
record.A_LOGISTICS, ',',
|
||||
record.Id12, ',',
|
||||
record.Id13, ',',
|
||||
record.CenterDevFromSetpoint, ',',
|
||||
record.Id15, ',',
|
||||
record.Id16, ',',
|
||||
record.FrontDevFromSetpoint, ',',
|
||||
record.Id18, ',',
|
||||
record.Id19, ',',
|
||||
record.SideDevFromSetpoint, ',',
|
||||
record.Id21, ',',
|
||||
record.Id22, ',',
|
||||
record.RearDevFromSetpoint, ',',
|
||||
record.Id25, ',',
|
||||
record.Id26, ',',
|
||||
record.N2H2DevFromSetpoint, ',',
|
||||
record.N2H2PercentDevFromSetpoint, ',',
|
||||
record.Id29, ',',
|
||||
record.Id37, ',',
|
||||
record.Id38, ',',
|
||||
record.NSRCSDevFromSetpoint, ',',
|
||||
record.NSRCSPercentDevFromSetpoint, ',',
|
||||
record.Id39, ',',
|
||||
record.Id40, ',',
|
||||
record.NDILDevFromSetpoint, ',',
|
||||
record.NDILPercentDevFromSetpoint, ',',
|
||||
record.Id41, ',',
|
||||
record.Id42, ',',
|
||||
record.NINJDevFromSetpoint, ',',
|
||||
record.NINJPercentDevFromSetpoint, ',',
|
||||
record.Id27, ',',
|
||||
record.Id28, ',',
|
||||
record.Id30, ',',
|
||||
record.HCLHIDevFromSetpoint, ',',
|
||||
record.HCLHIPercentDevFromSetpoint, ',',
|
||||
record.HCLDevFromSetpoint, ',',
|
||||
record.HCLPercentDevFromSetpoint, ',',
|
||||
record.Id61, ',',
|
||||
record.Id62, ',',
|
||||
record.ROTDevFromSetpoint, ',',
|
||||
record.Id173, ',',
|
||||
record.Id58, ',',
|
||||
record.Id172, ',',
|
||||
record.Id57, ',',
|
||||
record.LVCDevFromSetpoint, ',',
|
||||
record.LVCPercentDevFromSetpoint, ',',
|
||||
record.Id193, ',',
|
||||
record.Id183, ',',
|
||||
record.VP93, ',',
|
||||
record.VP154, ',',
|
||||
record.VP78, ',',
|
||||
record.VP83, ',',
|
||||
record.VP176, ',',
|
||||
record.VP79, ',',
|
||||
record.VP81, ',',
|
||||
record.VP82, ',',
|
||||
record.VP84, ',',
|
||||
record.VP86, ',',
|
||||
record.VP87, ',',
|
||||
record.VP80, ',',
|
||||
record.VP85, ',',
|
||||
record.VP153, ',',
|
||||
record.VP221, ',',
|
||||
record.VP222, ',',
|
||||
record.VP223, ',',
|
||||
record.NUM_DATA_ROWS, ',',
|
||||
record.NUM_DATA_COLUMNS, ',',
|
||||
record.START_TIME_FORMAT, ',',
|
||||
record.START_TIME, ',',
|
||||
record.LOGISTICS_COLUMN, ',',
|
||||
record.A_BASIC_TYPE, ',',
|
||||
record.A_INFO, ',',
|
||||
record.A_INFO2, ',',
|
||||
record.A_JOBID, ',',
|
||||
record.A_LAYER, ',',
|
||||
record.A_LAYER2, ',',
|
||||
record.A_MES_ENTITY, ',',
|
||||
record.A_MID, ',',
|
||||
record.A_NULL_DATA, ',',
|
||||
record.A_PPID, ',',
|
||||
record.A_PROCESS_JOBID, ',',
|
||||
record.A_PRODUCT, ',',
|
||||
record.A_SEQUENCE, ',',
|
||||
record.A_WADER_ID, ',',
|
||||
record.A_WAFER_POS, ',',
|
||||
record.Id31, ',',
|
||||
record.Id32, ',',
|
||||
record.PSRCSDevFromSetpoint, ',',
|
||||
record.PSRCSPercentDevFromSetpoint, ',',
|
||||
record.Id33, ',',
|
||||
record.Id34, ',',
|
||||
record.PDILDevFromSetpoint, ',',
|
||||
record.PDILPercentDevFromSetpoint, ',',
|
||||
record.Id35, ',',
|
||||
record.Id36, ',',
|
||||
record.PINJDevFromSetpoint, ',',
|
||||
record.PINJPercentDevFromSetpoint, ',',
|
||||
record.VP96, ',',
|
||||
record.A_CHAMBER, ',',
|
||||
record.A_SLOT));
|
||||
}
|
||||
string text = string.Join(Environment.NewLine, lines);
|
||||
string csvFileName = Path.ChangeExtension(fileName, ".csv");
|
||||
File.WriteAllText(csvFileName, text);
|
||||
}
|
||||
|
||||
}
|
||||
192
ADO2025/PI8/Helper-2025-11-13.cs
Normal file
192
ADO2025/PI8/Helper-2025-11-13.cs
Normal file
@ -0,0 +1,192 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.ADO2025.PI8;
|
||||
|
||||
#pragma warning disable IDE0027
|
||||
|
||||
[Serializable]
|
||||
[XmlType(Namespace = "http://schemas.datacontract.org/2004/07/EafManagement.Monitoring")]
|
||||
[XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/EafManagement.Monitoring", IsNullable = false)]
|
||||
public partial class ArrayOfRuntimeInstanceStatusReport {
|
||||
|
||||
[XmlElement("RuntimeInstanceStatusReport", Order = 0)]
|
||||
public RuntimeInstanceStatusReport[]? RuntimeInstanceStatusReport { get; set; }
|
||||
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[XmlType(Namespace = "http://schemas.datacontract.org/2004/07/EafManagement.Monitoring")]
|
||||
[XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/EafManagement.Monitoring", IsNullable = false)]
|
||||
public partial class RuntimeInstanceStatusReport {
|
||||
|
||||
public string? CellInstanceName { get; set; }
|
||||
public string? CurrentActiveVersion { get; set; }
|
||||
public string? CurrentHost { get; set; }
|
||||
public string? CurrentLoggingConfigurationName { get; set; }
|
||||
public string? CurrentLoggingConfigurationVersion { get; set; }
|
||||
public EquipmentState[]? EquipmentStates { get; set; }
|
||||
public string? ErrorDescription { get; set; }
|
||||
public string? Info { get; set; }
|
||||
public string? IsAutomatedRestartActive { get; set; }
|
||||
public string? IsAutomatedRestartRequested { get; set; }
|
||||
public string? IsPilot { get; set; }
|
||||
public string? IsReadyForRestart { get; set; }
|
||||
public string? LastKnownCurrentActiveVersion { get; set; }
|
||||
public string? MachineName { get; set; }
|
||||
public string? PilotVersion { get; set; }
|
||||
public string? RuntimeInstanceName { get; set; }
|
||||
public string? Startable { get; set; }
|
||||
public string? StartTime { get; set; }
|
||||
public string? State { get; set; }
|
||||
public string? StopTime { get; set; }
|
||||
public string? TargetActiveVersion { get; set; }
|
||||
public string? TargetHost { get; set; }
|
||||
public string? TargetLoggingConfigurationName { get; set; }
|
||||
public string? TargetLoggingConfigurationVersion { get; set; }
|
||||
public string? Timestamp { get; set; }
|
||||
public string? WindowsName { get; set; }
|
||||
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[XmlType(Namespace = "http://schemas.datacontract.org/2004/07/EafManagement.Monitoring")]
|
||||
[XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/EafManagement.Monitoring", IsNullable = false)]
|
||||
public partial class EquipmentState {
|
||||
|
||||
public bool? IsCommunicating { get; set; }
|
||||
public bool? IsConnected { get; set; }
|
||||
public string? CommunicationState { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
}
|
||||
|
||||
#pragma warning restore IDE0027
|
||||
|
||||
internal static partial class Helper20251113 {
|
||||
|
||||
private record Record(
|
||||
[property: JsonPropertyName("CellInstanceName")] string? CellInstanceName,
|
||||
[property: JsonPropertyName("CurrentActiveVersion")] string? CurrentActiveVersion,
|
||||
[property: JsonPropertyName("CurrentHost")] string? CurrentHost,
|
||||
[property: JsonPropertyName("CurrentLoggingConfigurationName")] string? CurrentLoggingConfigurationName,
|
||||
[property: JsonPropertyName("CurrentLoggingConfigurationVersion")] string? CurrentLoggingConfigurationVersion,
|
||||
[property: JsonPropertyName("EquipmentStates")] EquipmentState[]? EquipmentState,
|
||||
[property: JsonPropertyName("ErrorDescription")] string? ErrorDescription,
|
||||
[property: JsonPropertyName("Info")] string? Info,
|
||||
[property: JsonPropertyName("IsAutomatedRestartActive")] bool? IsAutomatedRestartActive,
|
||||
[property: JsonPropertyName("IsAutomatedRestartRequested")] bool? IsAutomatedRestartRequested,
|
||||
[property: JsonPropertyName("IsPilot")] bool? IsPilot,
|
||||
[property: JsonPropertyName("IsReadyForRestart")] bool? IsReadyForRestart,
|
||||
[property: JsonPropertyName("LastKnownCurrentActiveVersion")] string? LastKnownCurrentActiveVersion,
|
||||
[property: JsonPropertyName("MachineName")] string? MachineName,
|
||||
[property: JsonPropertyName("PilotVersion")] object PilotVersion,
|
||||
[property: JsonPropertyName("RuntimeInstanceName")] string? RuntimeInstanceName,
|
||||
[property: JsonPropertyName("Startable")] bool? Startable,
|
||||
[property: JsonPropertyName("StartTime")] string? StartTime,
|
||||
[property: JsonPropertyName("State")] string? State,
|
||||
[property: JsonPropertyName("StopTime")] string? StopTime,
|
||||
[property: JsonPropertyName("TargetActiveVersion")] string? TargetActiveVersion,
|
||||
[property: JsonPropertyName("TargetHost")] string? TargetHost,
|
||||
[property: JsonPropertyName("TargetLoggingConfigurationName")] string? TargetLoggingConfigurationName,
|
||||
[property: JsonPropertyName("TargetLoggingConfigurationVersion")] string? TargetLoggingConfigurationVersion,
|
||||
[property: JsonPropertyName("Timestamp")] string? Timestamp,
|
||||
[property: JsonPropertyName("UpdatePeriod")] int? UpdatePeriod,
|
||||
[property: JsonPropertyName("WindowsName")] string? WindowsName
|
||||
);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Record[]))]
|
||||
private partial class Helper20251113RecordSourceGenerationContext : JsonSerializerContext {
|
||||
}
|
||||
|
||||
internal static void Parse(ILogger<Worker> logger, List<string> args) {
|
||||
logger.LogInformation(args[0]);
|
||||
logger.LogInformation(args[1]);
|
||||
logger.LogInformation(args[2]);
|
||||
string xml;
|
||||
string url = args[2];
|
||||
string name = args[3];
|
||||
string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]);
|
||||
if (!Directory.Exists(sourceDirectory)) {
|
||||
_ = Directory.CreateDirectory(sourceDirectory);
|
||||
}
|
||||
FileInfo fileInfo = new(Path.Combine(sourceDirectory, $"{name}.xml"));
|
||||
if (fileInfo.Exists && fileInfo.LastWriteTime > DateTime.Now.AddMinutes(-5)) {
|
||||
logger.LogInformation("File recently exists: {fileName}", fileInfo.FullName);
|
||||
xml = File.ReadAllText(fileInfo.FullName);
|
||||
} else {
|
||||
logger.LogInformation("Downloading from URL: {url}", url);
|
||||
HttpClient httpClient = new();
|
||||
HttpResponseMessage httpResponseMessage = httpClient.GetAsync(url).Result;
|
||||
xml = httpResponseMessage.Content.ReadAsStringAsync().Result;
|
||||
File.WriteAllText(fileInfo.FullName, xml);
|
||||
logger.LogInformation("File saved: {fileName}", fileInfo.FullName);
|
||||
}
|
||||
Parse(logger, sourceDirectory, name, xml);
|
||||
}
|
||||
|
||||
private static void Parse(ILogger<Worker> logger, string sourceDirectory, string name, string xml) {
|
||||
ArrayOfRuntimeInstanceStatusReport? arrayOfRuntimeInstanceStatusReport = ParseXML<ArrayOfRuntimeInstanceStatusReport>(xml, throwExceptions: true);
|
||||
if (arrayOfRuntimeInstanceStatusReport is not null) {
|
||||
WriteAllText(logger, sourceDirectory, name, arrayOfRuntimeInstanceStatusReport);
|
||||
}
|
||||
}
|
||||
|
||||
private static T? ParseXML<T>(string value, bool throwExceptions) where T : class {
|
||||
object? result;
|
||||
try {
|
||||
Stream stream = ToStream(value.Trim());
|
||||
XmlReader xmlReader = XmlReader.Create(stream, new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document });
|
||||
#pragma warning disable IL2026, IL2090
|
||||
XmlSerializer xmlSerializer = new(typeof(T), typeof(T).GetNestedTypes());
|
||||
result = xmlSerializer.Deserialize(xmlReader);
|
||||
#pragma warning restore IL2026, IL2090
|
||||
stream.Dispose();
|
||||
} catch (Exception) {
|
||||
result = null;
|
||||
if (throwExceptions) {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
return result as T;
|
||||
}
|
||||
|
||||
private static MemoryStream ToStream(string value) {
|
||||
MemoryStream memoryStream = new();
|
||||
StreamWriter streamWriter = new(memoryStream);
|
||||
streamWriter.Write(value);
|
||||
streamWriter.Flush();
|
||||
memoryStream.Position = 0;
|
||||
return memoryStream;
|
||||
}
|
||||
|
||||
private static void WriteAllText(ILogger<Worker> logger, string sourceDirectory, string name, ArrayOfRuntimeInstanceStatusReport arrayOfRuntimeInstanceStatusReport) {
|
||||
string fileName = Path.Combine(sourceDirectory, $"{name}.json");
|
||||
JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
|
||||
string json = Serialize(jsonSerializerOptions, arrayOfRuntimeInstanceStatusReport)
|
||||
.Replace("\"\"", "null")
|
||||
.Replace("\"true\"", "true", StringComparison.CurrentCultureIgnoreCase)
|
||||
.Replace("\"false\"", "false", StringComparison.CurrentCultureIgnoreCase);
|
||||
Record[]? records = JsonSerializer.Deserialize(json, Helper20251113RecordSourceGenerationContext.Default.RecordArray);
|
||||
if (records is not null) {
|
||||
foreach (Record record in records) {
|
||||
if (record.Startable is null || !record.Startable.Value) {
|
||||
continue;
|
||||
}
|
||||
logger.LogInformation("CellInstanceName: {CellInstanceName}, MachineName: {MachineName}, State: {State}, ErrorDescription: {ErrorDescription}", record.CellInstanceName, record.MachineName, record.State, record.ErrorDescription);
|
||||
}
|
||||
}
|
||||
File.WriteAllText(fileName, json);
|
||||
logger.LogInformation("File saved: {fileName}", fileName);
|
||||
}
|
||||
|
||||
private static string Serialize(JsonSerializerOptions jsonSerializerOptions, ArrayOfRuntimeInstanceStatusReport arrayOfRuntimeInstanceStatusReport) =>
|
||||
#pragma warning disable IL3050, IL2026
|
||||
JsonSerializer.Serialize(arrayOfRuntimeInstanceStatusReport.RuntimeInstanceStatusReport, jsonSerializerOptions);
|
||||
#pragma warning restore IL3050, IL2026
|
||||
|
||||
}
|
||||
125
ADO2025/PI8/Helper-2025-11-14.cs
Normal file
125
ADO2025/PI8/Helper-2025-11-14.cs
Normal file
@ -0,0 +1,125 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.IO.Compression;
|
||||
|
||||
namespace File_Folder_Helper.ADO2025.PI8;
|
||||
|
||||
internal static partial class Helper20251114 {
|
||||
|
||||
internal static void ZipRunDirectories(ILogger<Worker> logger, List<string> args) {
|
||||
logger.LogInformation(args[0]);
|
||||
logger.LogInformation(args[1]);
|
||||
logger.LogInformation(args[2]);
|
||||
logger.LogInformation(args[3]);
|
||||
logger.LogInformation(args[4]);
|
||||
string searchPattern = args[2];
|
||||
string dayDirectoryPattern = args[3];
|
||||
string weekDirectoryPattern = args[4];
|
||||
string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]);
|
||||
if (!Directory.Exists(sourceDirectory)) {
|
||||
_ = Directory.CreateDirectory(sourceDirectory);
|
||||
}
|
||||
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.AllDirectories);
|
||||
foreach (string file in files) {
|
||||
ZipRunDirectory(logger, dayDirectoryPattern, weekDirectoryPattern, file);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ZipRunDirectory(ILogger<Worker> logger, string dayDirectoryPattern, string weekDirectoryPattern, string file) {
|
||||
string path;
|
||||
string ticks;
|
||||
FileInfo fileInfo;
|
||||
string subFileName;
|
||||
string? dayDirectory;
|
||||
string? runDirectory;
|
||||
string[] allSubFiles;
|
||||
string[] runSubFiles;
|
||||
string? weekDirectory;
|
||||
ZipArchive zipArchive;
|
||||
string? ticksDirectory;
|
||||
string[] ticksSubFiles;
|
||||
string? dayDirectoryName;
|
||||
string? runDirectoryName;
|
||||
string? weekDirectoryName;
|
||||
string? ticksDirectoryName;
|
||||
List<string> deleteFiles = [];
|
||||
for (int i = 0; i < 1; i++) {
|
||||
try {
|
||||
fileInfo = new FileInfo(file);
|
||||
ticks = fileInfo.LastWriteTime.Ticks.ToString();
|
||||
logger.LogInformation("Processing file: {file}", file);
|
||||
ticksDirectory = Path.GetDirectoryName(file);
|
||||
ticksDirectoryName = Path.GetFileName(ticksDirectory);
|
||||
if (ticksDirectory is null || ticksDirectoryName is null || ticksDirectoryName.Length != ticks.Length) {
|
||||
logger.LogWarning("Could not get directory name for file: {file}", file);
|
||||
continue;
|
||||
}
|
||||
ticksSubFiles = Directory.GetFiles(ticksDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
if (ticksSubFiles.Length == 0) {
|
||||
logger.LogWarning("No files found in directory: {ticksDirectory}", ticksDirectory);
|
||||
continue;
|
||||
}
|
||||
runDirectory = Path.GetDirectoryName(ticksDirectory);
|
||||
runDirectoryName = Path.GetFileName(runDirectory);
|
||||
if (runDirectory is null || runDirectoryName is null) {
|
||||
logger.LogWarning("Could not get directory name for directory: {ticksDirectory}", ticksDirectory);
|
||||
continue;
|
||||
}
|
||||
dayDirectory = Path.GetDirectoryName(runDirectory);
|
||||
dayDirectoryName = Path.GetFileName(dayDirectory);
|
||||
if (dayDirectory is null || dayDirectoryName is null || dayDirectoryName.Length != dayDirectoryPattern.Length) {
|
||||
logger.LogWarning("Could not get directory name for directory: {runDirectory}", runDirectory);
|
||||
continue;
|
||||
}
|
||||
if (fileInfo.LastWriteTime.ToString(dayDirectoryPattern) != dayDirectoryName) {
|
||||
logger.LogWarning("Directory name does not match file write time for directory: {dayDirectory}", dayDirectory);
|
||||
continue;
|
||||
}
|
||||
weekDirectory = Path.GetDirectoryName(dayDirectory);
|
||||
weekDirectoryName = Path.GetFileName(weekDirectory);
|
||||
if (weekDirectory is null || weekDirectoryName is null || weekDirectoryName.Length != weekDirectoryPattern.Length) {
|
||||
logger.LogWarning("Could not get directory name for directory: {dayDirectory}", dayDirectory);
|
||||
continue;
|
||||
}
|
||||
path = Path.Combine(dayDirectory, $"{runDirectoryName}.zip");
|
||||
if (File.Exists(path)) {
|
||||
logger.LogInformation("Zip file already exists: {zipFile}", path);
|
||||
continue;
|
||||
}
|
||||
logger.LogInformation("Creating zip file: {zipFile}", path);
|
||||
zipArchive = ZipFile.Open(path, ZipArchiveMode.Create);
|
||||
foreach (string ticksSubFile in ticksSubFiles) {
|
||||
subFileName = Path.GetFileName(ticksSubFile);
|
||||
_ = zipArchive.CreateEntryFromFile(ticksSubFile, $"{ticksDirectoryName}/{subFileName}");
|
||||
deleteFiles.Add(ticksSubFile);
|
||||
}
|
||||
runSubFiles = Directory.GetFiles(runDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
if (runSubFiles.Length == 0) {
|
||||
logger.LogWarning("No files found in directory: {runDirectory}", runDirectory);
|
||||
continue;
|
||||
}
|
||||
foreach (string subFile in runSubFiles) {
|
||||
subFileName = Path.GetFileName(subFile);
|
||||
_ = zipArchive.CreateEntryFromFile(subFile, subFileName);
|
||||
deleteFiles.Add(subFile);
|
||||
}
|
||||
zipArchive.Dispose();
|
||||
File.SetLastWriteTime(path, fileInfo.LastWriteTime);
|
||||
allSubFiles = Directory.GetFiles(runDirectory, "*", SearchOption.AllDirectories);
|
||||
if (allSubFiles.Length != deleteFiles.Count) {
|
||||
logger.LogWarning("File count mismatch for directory: {runDirectory}", runDirectory);
|
||||
continue;
|
||||
} else {
|
||||
foreach (string deleteFile in deleteFiles) {
|
||||
File.Delete(deleteFile);
|
||||
}
|
||||
logger.LogInformation("Deleting run directory: {runDirectory}", runDirectory);
|
||||
Directory.Delete(runDirectory, recursive: true);
|
||||
}
|
||||
break;
|
||||
} catch (Exception ex) {
|
||||
logger.LogError(ex, "Error processing file: {file}", file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -191,6 +191,12 @@ internal static class HelperDay
|
||||
ADO2025.PI7.Helper20250926.RenameThenFindFirstAndLast(logger, args);
|
||||
else if (args[1] == "Day-Helper-2025-10-22")
|
||||
ADO2025.PI7.Helper20251022.CombineFiles(logger, args);
|
||||
else if (args[1] == "Day-Helper-2025-11-11")
|
||||
ADO2025.PI8.Helper20251111.AddAndSortWorkWeekFiles(logger, args);
|
||||
else if (args[1] == "Day-Helper-2025-11-13")
|
||||
ADO2025.PI8.Helper20251113.Parse(logger, args);
|
||||
else if (args[1] == "Day-Helper-2025-11-14")
|
||||
ADO2025.PI8.Helper20251114.ZipRunDirectories(logger, args);
|
||||
else
|
||||
throw new Exception(appSettings.Company);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user