csharp_new_line_before_open_brace = none

This commit is contained in:
2025-07-27 12:33:54 -07:00
parent 341cc93a0a
commit e74a0ccdce
22 changed files with 908 additions and 653 deletions

View File

@ -59,9 +59,6 @@ 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_line_after_token_in_arrow_expression_clause_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
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
@ -113,7 +110,7 @@ dotnet_diagnostic.CA1051.severity = error # CA1051: Do not declare visible insta
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 = error # CA1829: Use Length/Count property instead of Count() when available
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'
@ -123,7 +120,7 @@ dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template
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 = error # Using directive is unnecessary
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)
@ -131,7 +128,7 @@ dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be remov
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 = error # IDE0058: Expression value is never used
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)
@ -140,7 +137,6 @@ dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]cs
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_diagnostic.IDE2000.severity = error # IDE2000: Allow multiple blank lines
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
@ -256,8 +252,8 @@ dotnet_naming_symbols.types.applicable_accessibilities = public, internal, priva
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 = true
dotnet_sort_system_directives_first = true
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
@ -297,85 +293,4 @@ 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
# Question
csharp_prefer_simple_using_statement = false # Question
csharp_style_expression_bodied_constructors = when_on_single_line:none # Question
csharp_style_expression_bodied_properties = true # Question
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning # Question
csharp_style_pattern_matching_over_as_with_null_check = false # Question
csharp_style_prefer_pattern_matching = false # Question
csharp_style_prefer_range_operator = false # Question
csharp_style_prefer_switch_expression = false # Question
csharp_style_unused_value_assignment_preference = unused_local_variable # Question
csharp_style_unused_value_expression_statement_preference = false # Question
csharp_style_var_elsewhere = false:none # Question
csharp_style_var_for_built_in_types = false:none # Question
csharp_style_var_when_type_is_apparent = false:warning # Question
dotnet_diagnostic.CA1001.severity = none # Question - Types that own disposable fields should be disposable
dotnet_diagnostic.CA1051.severity = none # Question - Do not declare visible instance fields
dotnet_diagnostic.CA1416.severity = none # Question - This call site is reachable on all platforms.
dotnet_diagnostic.CA1510.severity = none # Question - Use
dotnet_diagnostic.CA1834.severity = none # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.CA1860.severity = none # Question - Avoid using
dotnet_diagnostic.CA1862.severity = none # Question - Prefer using
dotnet_diagnostic.CA2208.severity = none # Question - Instantiate argument exceptions correctly
dotnet_diagnostic.CA2211.severity = none # Question - Non-constant fields should not be visible
dotnet_diagnostic.CA2249.severity = none # Question - Use
dotnet_diagnostic.CA2253.severity = none # Question - Named placeholders should not be numeric values
dotnet_diagnostic.CS0103.severity = none # Question - The name
dotnet_diagnostic.CS0168.severity = warning # Question - The variable
dotnet_diagnostic.CS0219.severity = none # Question - The variable
dotnet_diagnostic.CS0612.severity = none # Question - is obsolete
dotnet_diagnostic.CS0618.severity = none # Question - Compiler Warning (level 2)
dotnet_diagnostic.CS0659.severity = none # Question - Compiler Warning (level 3)
dotnet_diagnostic.CS8019.severity = warning # Question - Unnecessary using directive.
dotnet_diagnostic.CS8600.severity = none # Question - Converting null literal or possible null value to non-nullable type
dotnet_diagnostic.CS8602.severity = none # Question - Dereference of a possibly null reference.
dotnet_diagnostic.CS8603.severity = none # Question - Possible null reference return
dotnet_diagnostic.CS8604.severity = none # Question - Possible null reference argument for parameter.
dotnet_diagnostic.CS8618.severity = none # Question - Non-nullable variable must contain a non-null value when exiting constructor
dotnet_diagnostic.CS8625.severity = none # Question - Cannot convert null literal to non-nullable reference type.
dotnet_diagnostic.CS8629.severity = warning # Question - Nullable value type may be null
dotnet_diagnostic.CS8765.severity = none # Question - Nullability of type of parameter
dotnet_diagnostic.IDE0005.severity = none # Question - Remove unnecessary using directives
dotnet_diagnostic.IDE0008.severity = warning # Question - Use explicit type instead of
dotnet_diagnostic.IDE0017.severity = none # Question - Object initialization can be simplified
dotnet_diagnostic.IDE0019.severity = none # Question - Use pattern matching
dotnet_diagnostic.IDE0021.severity = none # Question - Use expression body for constructor
dotnet_diagnostic.IDE0022.severity = none # Question - Use expression body for method
dotnet_diagnostic.IDE0025.severity = none # Question - Use expression body for property
dotnet_diagnostic.IDE0027.severity = none # Question - Use expression body for accessor
dotnet_diagnostic.IDE0028.severity = none # Question - Use collection initializers or expressions
dotnet_diagnostic.IDE0031.severity = none # Question - Null check can be simplified
dotnet_diagnostic.IDE0032.severity = none # Question - Use auto property
dotnet_diagnostic.IDE0037.severity = none # Question - Member name can be simplified
dotnet_diagnostic.IDE0041.severity = none # Question - Null check can be simplified
dotnet_diagnostic.IDE0047.severity = none # Question - Parentheses preferences
dotnet_diagnostic.IDE0049.severity = warning # Question - Name can be simplified
dotnet_diagnostic.IDE0051.severity = none # Question - Remove unused private member
dotnet_diagnostic.IDE0053.severity = none # Question - Use expression body for lambdas
dotnet_diagnostic.IDE0054.severity = none # Question - Use compound assignment
dotnet_diagnostic.IDE0055.severity = none # Question - Formatting rule
dotnet_diagnostic.IDE0057.severity = none # Question - Substring can be simplified
dotnet_diagnostic.IDE0058.severity = none # Question - Remove unnecessary expression value
dotnet_diagnostic.IDE0059.severity = none # Question - Unnecessary assignment of a value to
dotnet_diagnostic.IDE0060.severity = warning # Question - Remove unused parameter
dotnet_diagnostic.IDE0063.severity = none # Question - Use simple
dotnet_diagnostic.IDE0065.severity = none # Question -
dotnet_diagnostic.IDE0066.severity = none # Question - Use
dotnet_diagnostic.IDE0078.severity = none # Question - Use pattern matching (may change code meaning)
dotnet_diagnostic.IDE0090.severity = warning # Question - Simplify new expression
dotnet_diagnostic.IDE0100.severity = error # Question - Remove redundant equality
dotnet_diagnostic.IDE0160.severity = warning # Question - Use block-scoped namespace
dotnet_diagnostic.IDE0161.severity = warning # Question - Namespace declaration preferences
dotnet_diagnostic.IDE0270.severity = none # Question - Null check can be simplified
dotnet_diagnostic.IDE0300.severity = none # Question - Collection initialization can be simplified
dotnet_diagnostic.IDE1006.severity = none # Question - Use collection expression for builder dotnet_style_prefer_collection_expression
dotnet_style_null_propagation = false # Question
dotnet_style_object_initializer = false # Question
dotnet_style_prefer_auto_properties = false # Question
dotnet_style_allow_statement_immediately_after_block_experimental = true # Question
dotnet_style_prefer_inferred_anonymous_type_member_names = false:warning # Question
dotnet_style_prefer_is_null_check_over_reference_equality_method = false # Question
# https://github.com/dotnet/project-system/blob/main/.editorconfig

View File

@ -11,25 +11,22 @@ namespace IFX.Shared.PasteSpecialXml.EAF.XML.API.Envelope;
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://www.w3.org/2003/05/soap-envelope")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://www.w3.org/2003/05/soap-envelope", IsNullable = false)]
public partial class Envelope
{
public partial class Envelope {
private EnvelopeHeader? headerField;
private EnvelopeBody? bodyField;
/// <remarks/>
public EnvelopeHeader Header
{
get => this.headerField;
set => this.headerField = value;
public EnvelopeHeader Header {
get => headerField;
set => headerField = value;
}
/// <remarks/>
public EnvelopeBody Body
{
get => this.bodyField;
set => this.bodyField = value;
public EnvelopeBody Body {
get => bodyField;
set => bodyField = value;
}
}
@ -37,8 +34,7 @@ public partial class Envelope
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://www.w3.org/2003/05/soap-envelope")]
public partial class EnvelopeHeader
{
public partial class EnvelopeHeader {
private Sequence? sequenceField;
private SequenceAcknowledgement? sequenceAcknowledgementField;
@ -47,33 +43,29 @@ public partial class EnvelopeHeader
private string? relatesToField;
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.xmlsoap.org/ws/2005/02/rm")]
public Sequence Sequence
{
get => this.sequenceField;
set => this.sequenceField = value;
public Sequence Sequence {
get => sequenceField;
set => sequenceField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.xmlsoap.org/ws/2005/02/rm")]
public SequenceAcknowledgement SequenceAcknowledgement
{
get => this.sequenceAcknowledgementField;
set => this.sequenceAcknowledgementField = value;
public SequenceAcknowledgement SequenceAcknowledgement {
get => sequenceAcknowledgementField;
set => sequenceAcknowledgementField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://www.w3.org/2005/08/addressing")]
public Action Action
{
get => this.actionField;
set => this.actionField = value;
public Action Action {
get => actionField;
set => actionField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://www.w3.org/2005/08/addressing")]
public string RelatesTo
{
get => this.relatesToField;
set => this.relatesToField = value;
public string RelatesTo {
get => relatesToField;
set => relatesToField = value;
}
}
/// <remarks/>
@ -81,36 +73,31 @@ public partial class EnvelopeHeader
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.xmlsoap.org/ws/2005/02/rm")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.xmlsoap.org/ws/2005/02/rm", IsNullable = false)]
public partial class Sequence
{
public partial class Sequence {
private string? identifierField;
private byte messageNumberField;
private object? lastMessageField;
private byte mustUnderstandField;
/// <remarks/>
public string Identifier
{
get => this.identifierField;
set => this.identifierField = value;
public string Identifier {
get => identifierField;
set => identifierField = value;
}
/// <remarks/>
public byte MessageNumber
{
get => this.messageNumberField;
set => this.messageNumberField = value;
public byte MessageNumber {
get => messageNumberField;
set => messageNumberField = value;
}
/// <remarks/>
public object LastMessage
{
get => this.lastMessageField;
set => this.lastMessageField = value;
public object LastMessage {
get => lastMessageField;
set => lastMessageField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://www.w3.org/2003/05/soap-envelope")]
public byte mustUnderstand
{
get => this.mustUnderstandField;
set => this.mustUnderstandField = value;
public byte mustUnderstand {
get => mustUnderstandField;
set => mustUnderstandField = value;
}
}
/// <remarks/>
@ -118,52 +105,45 @@ public partial class Sequence
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.xmlsoap.org/ws/2005/02/rm")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.xmlsoap.org/ws/2005/02/rm", IsNullable = false)]
public partial class SequenceAcknowledgement
{
public partial class SequenceAcknowledgement {
private string? identifierField;
private SequenceAcknowledgementAcknowledgementRange? acknowledgementRangeField;
private byte bufferRemainingField;
/// <remarks/>
public string Identifier
{
get => this.identifierField;
set => this.identifierField = value;
public string Identifier {
get => identifierField;
set => identifierField = value;
}
/// <remarks/>
public SequenceAcknowledgementAcknowledgementRange AcknowledgementRange
{
get => this.acknowledgementRangeField;
set => this.acknowledgementRangeField = value;
public SequenceAcknowledgementAcknowledgementRange AcknowledgementRange {
get => acknowledgementRangeField;
set => acknowledgementRangeField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.microsoft.com/ws/2006/05/rm")]
public byte BufferRemaining
{
get => this.bufferRemainingField;
set => this.bufferRemainingField = value;
public byte BufferRemaining {
get => bufferRemainingField;
set => bufferRemainingField = value;
}
}
/// <remarks/>
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.xmlsoap.org/ws/2005/02/rm")]
public partial class SequenceAcknowledgementAcknowledgementRange
{
public partial class SequenceAcknowledgementAcknowledgementRange {
private byte lowerField;
private byte upperField;
/// <remarks/>
[System.Xml.Serialization.XmlAttribute()]
public byte Lower
{
get => this.lowerField;
set => this.lowerField = value;
public byte Lower {
get => lowerField;
set => lowerField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlAttribute()]
public byte Upper
{
get => this.upperField;
set => this.upperField = value;
public byte Upper {
get => upperField;
set => upperField = value;
}
}
@ -172,8 +152,7 @@ public partial class SequenceAcknowledgementAcknowledgementRange
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://www.w3.org/2005/08/addressing")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://www.w3.org/2005/08/addressing", IsNullable = false)]
public partial class Action
{
public partial class Action {
private byte mustUnderstandField;
@ -181,18 +160,16 @@ public partial class Action
/// <remarks/>
[System.Xml.Serialization.XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://www.w3.org/2003/05/soap-envelope")]
public byte mustUnderstand
{
get => this.mustUnderstandField;
set => this.mustUnderstandField = value;
public byte mustUnderstand {
get => mustUnderstandField;
set => mustUnderstandField = value;
}
/// <remarks/>
[System.Xml.Serialization.XmlText()]
public string Value
{
get => this.valueField;
set => this.valueField = value;
public string Value {
get => valueField;
set => valueField = value;
}
}
@ -200,17 +177,15 @@ public partial class Action
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://www.w3.org/2003/05/soap-envelope")]
public partial class EnvelopeBody
{
public partial class EnvelopeBody {
private CreateSequenceResponse? createSequenceResponseField;
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://schemas.xmlsoap.org/ws/2005/02/rm")]
public CreateSequenceResponse CreateSequenceResponse
{
get => this.createSequenceResponseField;
set => this.createSequenceResponseField = value;
public CreateSequenceResponse CreateSequenceResponse {
get => createSequenceResponseField;
set => createSequenceResponseField = value;
}
}
@ -219,25 +194,22 @@ public partial class EnvelopeBody
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.xmlsoap.org/ws/2005/02/rm")]
[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.xmlsoap.org/ws/2005/02/rm", IsNullable = false)]
public partial class CreateSequenceResponse
{
public partial class CreateSequenceResponse {
private string? identifierField;
private CreateSequenceResponseAccept? acceptField;
/// <remarks/>
public string Identifier
{
get => this.identifierField;
set => this.identifierField = value;
public string Identifier {
get => identifierField;
set => identifierField = value;
}
/// <remarks/>
public CreateSequenceResponseAccept Accept
{
get => this.acceptField;
set => this.acceptField = value;
public CreateSequenceResponseAccept Accept {
get => acceptField;
set => acceptField = value;
}
}
@ -245,16 +217,14 @@ public partial class CreateSequenceResponse
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.xmlsoap.org/ws/2005/02/rm")]
public partial class CreateSequenceResponseAccept
{
public partial class CreateSequenceResponseAccept {
private CreateSequenceResponseAcceptAcksTo? acksToField;
/// <remarks/>
public CreateSequenceResponseAcceptAcksTo AcksTo
{
get => this.acksToField;
set => this.acksToField = value;
public CreateSequenceResponseAcceptAcksTo AcksTo {
get => acksToField;
set => acksToField = value;
}
}
@ -262,16 +232,14 @@ public partial class CreateSequenceResponseAccept
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.xmlsoap.org/ws/2005/02/rm")]
public partial class CreateSequenceResponseAcceptAcksTo
{
public partial class CreateSequenceResponseAcceptAcksTo {
private string? addressField;
/// <remarks/>
[System.Xml.Serialization.XmlElement(Namespace = "http://www.w3.org/2005/08/addressing")]
public string Address
{
get => this.addressField;
set => this.addressField = value;
public string Address {
get => addressField;
set => addressField = value;
}
}

View File

@ -1,12 +1,11 @@
using Microsoft.Extensions.FileSystemGlobbing;
using Microsoft.Extensions.Logging;
using System.Collections.ObjectModel;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Web;
using Microsoft.Extensions.FileSystemGlobbing;
using Microsoft.Extensions.Logging;
namespace File_Folder_Helper.ADO2025.PI6;
internal static partial class Helper20250519 {
@ -288,8 +287,9 @@ internal static partial class Helper20250519 {
if (!baseAddress.StartsWith("http:")) {
logger.LogInformation("Not supported URL <{url}>", baseAddress);
} else {
HttpClient httpClient = new();
httpClient.BaseAddress = new(baseAddress);
HttpClient httpClient = new() {
BaseAddress = new(baseAddress)
};
StringContent stringContent = new(json, Encoding.UTF8, "application/json");
httpResponseMessage = httpClient.PostAsync(page, stringContent);
httpResponseMessage.Wait();
@ -342,7 +342,7 @@ internal static partial class Helper20250519 {
}
}
private static void LiveSync(ILogger<Worker> logger, string page, RelativePath relativePath, HttpClient httpClient, string directory, ReadOnlyCollection<Record> records, HttpMethod? httpMethod, bool delete) {
private static void LiveSync(ILogger<Worker> logger, string page, RelativePath relativePath, HttpClient httpClient, string? directory, ReadOnlyCollection<Record> records, HttpMethod? httpMethod, bool delete) {
long sum;
try { sum = records.Sum(l => l.Size); } catch (Exception) { sum = 0; }
string size = GetSizeWithSuffix(sum);
@ -374,7 +374,7 @@ internal static partial class Helper20250519 {
return result;
}
private static void PreformDeletes(ILogger<Worker> logger, string directory, ReadOnlyCollection<Record> records) {
private static void PreformDeletes(ILogger<Worker> logger, string? directory, ReadOnlyCollection<Record> records) {
string size;
Record? record;
string count = records.Count.ToString("000000");
@ -386,7 +386,7 @@ internal static partial class Helper20250519 {
progressBar.Tick();
#endif
record = records[i];
if (record is null) {
if (record is null || string.IsNullOrEmpty(directory)) {
continue;
}
size = GetSizeWithSuffix(record.Size);
@ -402,7 +402,7 @@ internal static partial class Helper20250519 {
#endif
}
private static void Preform(ILogger<Worker> logger, string page, string directory, ReadOnlyCollection<Record> records, HttpClient httpClient, HttpMethod httpMethod) {
private static void Preform(ILogger<Worker> logger, string page, string? directory, ReadOnlyCollection<Record> records, HttpClient httpClient, HttpMethod httpMethod) {
Verb verb;
long ticks;
string size;
@ -430,9 +430,10 @@ internal static partial class Helper20250519 {
httpRequestMessage = new(httpMethod, $"{page}size={verb.Size}&ticks={verb.Ticks}&path={verb.UrlEncodedFile}");
} else if (httpMethod == HttpMethod.Patch || httpMethod == HttpMethod.Put) {
httpRequestMessage = new(httpMethod, $"{page}path={verb.Directory}");
multipartFormDataContent = new();
multipartFormDataContent.Add(new ByteArrayContent(File.ReadAllBytes(verb.File)), "formFiles", verb.Multipart);
multipartFormDataContent.Add(new StringContent(verb.Directory), "path", iValue);
multipartFormDataContent = new() {
{ new ByteArrayContent(File.ReadAllBytes(verb.File)), "formFiles", verb.Multipart },
{ new StringContent(verb.Directory), "path", iValue }
};
httpRequestMessage.Content = multipartFormDataContent;
} else
throw new NotImplementedException();
@ -469,7 +470,7 @@ internal static partial class Helper20250519 {
#endif
}
private static ReadOnlyCollection<Verb> GetVerbCollection(string directory, ReadOnlyCollection<Record> records) {
private static ReadOnlyCollection<Verb> GetVerbCollection(string? directory, ReadOnlyCollection<Record> records) {
List<Verb> results = [];
Verb verb;
string checkFile;
@ -477,6 +478,9 @@ internal static partial class Helper20250519 {
string? checkDirectory;
List<Verb> collection = [];
foreach (Record record in records) {
if (string.IsNullOrEmpty(directory)) {
continue;
}
checkFile = Path.Combine(directory, record.RelativePath);
checkFileName = Path.GetFileName(checkFile);
checkDirectory = Path.GetDirectoryName(checkFile);

View File

@ -59,12 +59,11 @@ internal static partial class Helper20250521 {
string datePattern = args[5];
string searchPattern = args[2];
string searchPatternB = args[3];
string columns = args[6].Replace('~', ',');
int dateLineSegmentCount = int.Parse(args[4]);
string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]);
ReadOnlyDictionary<string, string> keyValuePairs = GetKeyValuePairs(searchPattern, sourceDirectory);
MoveMatchDirectory(searchPatternB, keyValuePairs, sourceDirectory);
ReadOnlyCollection<RecordB> records = GetRecords(searchPatternB, sourceDirectory, dateLineSegmentCount, datePattern, columns);
ReadOnlyCollection<RecordB> records = GetRecords(searchPatternB, sourceDirectory, dateLineSegmentCount, datePattern);
WriteRecords(sourceDirectory, records);
}
@ -72,7 +71,7 @@ internal static partial class Helper20250521 {
Dictionary<string, string> results = [];
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.AllDirectories);
foreach (string file in files) {
results.Add(Path.GetFileNameWithoutExtension(file), Path.GetDirectoryName(file));
results.Add(Path.GetFileNameWithoutExtension(file), Path.GetDirectoryName(file) ?? throw new Exception());
}
return results.AsReadOnly();
}
@ -92,7 +91,7 @@ internal static partial class Helper20250521 {
}
}
private static ReadOnlyCollection<RecordB> GetRecords(string searchPatternB, string sourceDirectory, int dateLineSegmentCount, string datePattern, string columns) {
private static ReadOnlyCollection<RecordB> GetRecords(string searchPatternB, string sourceDirectory, int dateLineSegmentCount, string datePattern) {
List<RecordB> results = [];
string line;
string[] lines;
@ -110,7 +109,7 @@ internal static partial class Helper20250521 {
if (lineCheck.EffectiveDate == DateTime.MinValue || lineCheck.TransactionDate == DateTime.MinValue) {
continue;
} else {
record = GetRecord(dateLineSegmentCount, datePattern, lines, i, lineCheck.Segments, lineCheck.TransactionDate, lineCheck.EffectiveDate);
record = GetRecord(dateLineSegmentCount, datePattern, lines, i, lineCheck.TransactionDate, lineCheck.EffectiveDate);
if (record is not null) {
i = record.I;
results.Add(record);
@ -121,7 +120,7 @@ internal static partial class Helper20250521 {
return results.AsReadOnly();
}
private static RecordB? GetRecord(int dateLineSegmentCount, string datePattern, string[] lines, int i, string[] segments, DateTime transactionDate, DateTime effectiveDate) {
private static RecordB? GetRecord(int dateLineSegmentCount, string datePattern, string[] lines, int i, DateTime transactionDate, DateTime effectiveDate) {
RecordB? result = null;
string line;
LineCheck lineCheck;
@ -148,7 +147,7 @@ internal static partial class Helper20250521 {
return result;
}
private static RecordB GetRecord(DateTime transactionDate, DateTime effectiveDate, ReadOnlyCollection<string> collection, int i) {
private static RecordB? GetRecord(DateTime transactionDate, DateTime effectiveDate, ReadOnlyCollection<string> collection, int i) {
RecordB? result;
List<string> verified = [];
foreach (string check in collection) {

View File

@ -1,10 +1,9 @@
using Microsoft.Extensions.Logging;
using System.Collections.ObjectModel;
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.Extensions.Logging;
namespace File_Folder_Helper.ADO2025.PI6;
internal static partial class Helper20250701 {
@ -55,7 +54,7 @@ internal static partial class Helper20250701 {
FileInfo fileInfo;
string? pipeTable;
string? collections;
string directoryName;
string? directoryName;
string checkDirectory;
foreach (string directory in directories) {
if (sizeFilter < 987654321 && Path.GetFileName(directory).Contains('-')) {
@ -68,6 +67,9 @@ internal static partial class Helper20250701 {
continue;
}
directoryName = Path.GetFileName(fileInfo.DirectoryName);
if (string.IsNullOrEmpty(directoryName)) {
continue;
}
if (fileInfo.Length > sizeFilter && !directoryName.StartsWith('Z')) {
checkDirectory = Path.Combine(sourceDirectory, $"Z{directoryName}");
if (!Directory.Exists(checkDirectory)) {
@ -158,7 +160,7 @@ internal static partial class Helper20250701 {
string[] segments;
List<List<string>> collections = [];
string[] columns = lines[columnTitlesLine].Split('\t');
foreach (string column in columns) {
foreach (string _ in columns) {
collections.Add([]);
}
for (int i = columnTitlesLine + 1; i < lines.Length; i++) {
@ -406,6 +408,9 @@ internal static partial class Helper20250701 {
}
keyValuePairs.Add(jsonProperty.Name, jsonProperty.Value.ToString());
}
if (columns is null) {
continue;
}
foreach (string column in columns) {
if (!keyValuePairs.TryGetValue(column, out value)) {
values.Add(new string(' ', column.Length));

View File

@ -1,9 +1,8 @@
using Microsoft.Extensions.Logging;
using System.Collections.ObjectModel;
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.Extensions.Logging;
namespace File_Folder_Helper.ADO2025.PI6;
internal static partial class Helper20250709 {
@ -157,7 +156,6 @@ internal static partial class Helper20250709 {
string extension = args[4];
string searchPattern = args[2];
int sizeFilter = int.Parse(args[3]);
string[] columns = args[5].Split(',');
string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]);
string destinationDirectory = Path.GetFullPath(args[6].Split('~')[0]);
string[] directories = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
@ -172,7 +170,7 @@ internal static partial class Helper20250709 {
string checkFile;
Reactor? reactor;
FileInfo fileInfo;
string directoryName;
string? directoryName;
string checkDirectory;
foreach (string directory in directories) {
if (sizeFilter < 987654321 && Path.GetFileName(directory).Contains('-')) {
@ -185,6 +183,9 @@ internal static partial class Helper20250709 {
continue;
}
directoryName = Path.GetFileName(fileInfo.DirectoryName);
if (string.IsNullOrEmpty(directoryName)) {
continue;
}
if (fileInfo.Length > sizeFilter && !directoryName.StartsWith('Z')) {
checkDirectory = Path.Combine(sourceDirectory, $"Z{directoryName}");
if (!Directory.Exists(checkDirectory)) {

View File

@ -1,8 +1,7 @@
using Microsoft.Extensions.Logging;
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;
using Microsoft.Extensions.Logging;
namespace File_Folder_Helper.ADO2025.PI6;
internal static partial class Helper20250710 {
@ -28,7 +27,7 @@ internal static partial class Helper20250710 {
string[] files;
string checkFile;
FileInfo fileInfo;
string directoryName;
string? directoryName;
const string extension = ".trc";
foreach (string directory in directories) {
files = Directory.GetFiles(directory, searchPattern, SearchOption.TopDirectoryOnly);
@ -38,6 +37,9 @@ internal static partial class Helper20250710 {
continue;
}
directoryName = Path.GetFileName(fileInfo.DirectoryName);
if (string.IsNullOrEmpty(directoryName)) {
continue;
}
checkFile = Path.Combine(directoryName, $"{fileInfo.Name}{extension}");
if (File.Exists(checkFile)) {
continue;

View File

@ -1,16 +1,22 @@
using Microsoft.Extensions.Logging;
using Phares.Metadata.Models.Stateless;
using Phares.Shared.Models;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Text.Json;
using Microsoft.Extensions.Logging;
using Phares.Metadata.Models.Stateless;
using Phares.Shared.Models;
using System.Text.Json.Serialization;
namespace File_Folder_Helper.ADO2025.PI6;
internal static partial class Helper20250720 {
private record Helper20250720Settings(ResultSettings? ResultSettings, MetadataSettings? MetadataSettings);
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Helper20250720Settings))]
private partial class Helper20250720SettingsSourceGenerationContext : JsonSerializerContext {
}
internal static void WriteFaceData(ILogger<Worker> logger, List<string> args) {
logger.LogInformation(args[0]);
logger.LogInformation(args[1]);
@ -45,21 +51,17 @@ internal static partial class Helper20250720 {
logger.LogError("Face file doesn't exist! <{faceFileInfo}>", faceFileInfo.FullName);
} else {
string json = File.ReadAllText(jsonFile);
ResultSettings? resultSettings = JsonSerializer.Deserialize(json, ResultSettingsSourceGenerationContext.Default.ResultSettings);
MetadataSettings? metadataSettings = JsonSerializer.Deserialize(json, MetadataSettingsSourceGenerationContext.Default.MetadataSettings);
if (resultSettings is null) {
logger.LogError(nameof(ResultSettings));
} else if (metadataSettings is null) {
logger.LogError(nameof(MetadataSettings));
Helper20250720Settings? settings = JsonSerializer.Deserialize(json, Helper20250720SettingsSourceGenerationContext.Default.Helper20250720Settings);
if (settings?.ResultSettings is null || settings.ResultSettings.ResultAllInOneSubdirectoryLength < 1 || settings.MetadataSettings is null) {
throw new Exception(nameof(Helper20250720Settings));
}
WriteFaceData(logger, outputDirectoryName, originalFile, faceFileInfo, digiKamFile, settings.ResultSettings, settings.MetadataSettings);
ReadOnlyDictionary<long, ReadOnlyCollection<string>> keyValuePairsXMP = GetKeyValuePairs(searchPatternXMP, pathRootXMP);
ReadOnlyDictionary<long, ReadOnlyCollection<ExifDirectory>> keyValuePairs = GetKeyValuePairs(searchPattern, pathRoot, settings.ResultSettings, settings.MetadataSettings);
if (keyValuePairs.Count == 0) {
logger.LogError("Didn't find any valid file(s)!");
} else {
WriteFaceData(logger, outputDirectoryName, originalFile, faceFileInfo, digiKamFile, resultSettings, metadataSettings);
ReadOnlyDictionary<long, ReadOnlyCollection<string>> keyValuePairsXMP = GetKeyValuePairs(searchPatternXMP, pathRootXMP);
ReadOnlyDictionary<long, ReadOnlyCollection<ExifDirectory>> keyValuePairs = GetKeyValuePairs(searchPattern, pathRoot, resultSettings, metadataSettings);
if (keyValuePairs.Count == 0) {
logger.LogError("Didn't find any valid file(s)!");
} else {
WriteFaceData(logger, outputDirectoryName, keyValuePairs, keyValuePairsXMP);
}
WriteFaceData(logger, outputDirectoryName, keyValuePairs, keyValuePairsXMP);
}
}
}
@ -116,6 +118,8 @@ internal static partial class Helper20250720 {
FaceFile faceFile;
string descriptionLine = "</rdf:Description>";
faceFile = keyValuePairs.ElementAt(0).Value;
if (faceFile.Location is null || faceFile.OutputResolution is null)
throw new Exception();
List<string> regionLines = [
"<MP:RegionInfo rdf:parseType=\"Resource\">",
"<MPRI:Regions>",
@ -138,6 +142,8 @@ internal static partial class Helper20250720 {
foreach (KeyValuePair<string, FaceFile> keyValuePair in keyValuePairs) {
personKey = keyValuePair.Key;
faceFile = keyValuePair.Value;
if (faceFile.Location is null || faceFile.OutputResolution is null)
throw new Exception();
width = faceFile.Location.Right - faceFile.Location.Left;
height = faceFile.Location.Bottom - faceFile.Location.Top;
if (!string.IsNullOrEmpty(originalFile) && File.Exists(originalFile)) {
@ -233,8 +239,8 @@ internal static partial class Helper20250720 {
// </dc:subject>
subjectLines.Add($"<rdf:li>{personKey}</rdf:li>");
}
regionLines.AddRange(["</rdf:Bag>","</MPRI:Regions>","</MP:RegionInfo>"]);
regionsLinesB.AddRange(["</rdf:Bag>", "</mwg-rs:RegionList>","</mwg-rs:Regions>"]);
regionLines.AddRange(["</rdf:Bag>", "</MPRI:Regions>", "</MP:RegionInfo>"]);
regionsLinesB.AddRange(["</rdf:Bag>", "</mwg-rs:RegionList>", "</mwg-rs:Regions>"]);
digiKamLines.AddRange(["</rdf:Seq>", "</digiKam:TagsList>"]);
microsoftPhotoLines.AddRange(["</rdf:Bag>", "</MicrosoftPhoto:LastKeywordXMP>"]);
hierarchicalSubjectLines.AddRange(["</rdf:Bag>", "</lr:hierarchicalSubject>"]);
@ -292,7 +298,7 @@ internal static partial class Helper20250720 {
private static ReadOnlyDictionary<string, FaceFile> GetKeyValuePairs(ILogger<Worker> logger, ReadOnlyCollection<ExifDirectory> exifDirectories) {
Dictionary<string, FaceFile> results = [];
string personKey;
string? personKey;
FaceFile? faceFile;
foreach (ExifDirectory exifDirectory in exifDirectories) {
faceFile = IMetadata.GetFaceFile(exifDirectory);
@ -304,6 +310,9 @@ internal static partial class Helper20250720 {
logger.LogWarning("faceFile output-resolution orientation is not aloud!");
} else {
personKey = Path.GetFileName(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(exifDirectory.FilePath.FullName))));
if (string.IsNullOrEmpty(personKey)) {
continue;
}
if (results.ContainsKey(personKey)) {
continue;
}

View File

@ -12,13 +12,13 @@ namespace File_Folder_Helper.ADO2025.PI6;
internal static partial class Helper20250726 {
private record Settings(ResultSettings? ResultSettings, MetadataSettings? MetadataSettings);
private record Helper20250726Settings(ResultSettings? ResultSettings, MetadataSettings? MetadataSettings);
private record Record(CombinedEnumAndIndex CombinedEnumAndIndex, FilePath FilePath, bool HasFlagHidden);
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Settings))]
private partial class SettingsSourceGenerationContext : JsonSerializerContext {
[JsonSerializable(typeof(Helper20250726Settings))]
private partial class Helper20250726SettingsSourceGenerationContext : JsonSerializerContext {
}
internal static void CopyToCombinedEnumAndIndexFormat(ILogger<Worker> logger, List<string> args) {
@ -35,9 +35,9 @@ internal static partial class Helper20250726 {
string json = File.ReadAllText(jsonFile);
string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]);
string destinationDirectory = Path.GetFullPath(args[4].Split('~')[0]);
Settings? settings = JsonSerializer.Deserialize(json, SettingsSourceGenerationContext.Default.Settings);
if (settings.ResultSettings is null || settings.ResultSettings.ResultAllInOneSubdirectoryLength < 1 || settings.MetadataSettings is null) {
throw new Exception(nameof(Settings));
Helper20250726Settings? settings = JsonSerializer.Deserialize(json, Helper20250726SettingsSourceGenerationContext.Default.Helper20250726Settings);
if (settings?.ResultSettings is null || settings.ResultSettings.ResultAllInOneSubdirectoryLength < 1 || settings.MetadataSettings is null) {
throw new Exception(nameof(Helper20250726Settings));
}
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.AllDirectories);
ReadOnlyDictionary<int, ReadOnlyDictionary<byte, ReadOnlyCollection<string>>> keyValuePairs = GetKeyValuePairs(destinationDirectory, settings.ResultSettings);