using Microsoft.Extensions.Logging; using System.Collections.ObjectModel; using System.Text.Json; using System.Text.Json.Serialization; using System.Text.RegularExpressions; namespace File_Folder_Helper.Day; internal static partial class Helper20231212 { [GeneratedRegex(@"[\\,\/,\:,\*,\?,\"",\<,\>,\|]")] private static partial Regex WindowsSafe(); private record Debugging( [property: JsonPropertyName("Level")] int Level ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(Debugging))] private partial class DebuggingSourceGenerationContext : JsonSerializerContext { } private record Distance( [property: JsonPropertyName("Value")] int Value ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(Distance))] private partial class DistanceSourceGenerationContext : JsonSerializerContext { } private record Finished( [property: JsonPropertyName("Elapsed")] double Elapsed, [property: JsonPropertyName("Exit")] string Exit, [property: JsonPropertyName("Summary")] string Summary, [property: JsonPropertyName("Time")] int Time, [property: JsonPropertyName("TimeStr")] string TimeStr ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(Finished))] private partial class FinishedSourceGenerationContext : JsonSerializerContext { } private record Hop( [property: JsonPropertyName("Host")] string Host, [property: JsonPropertyName("IPAddr")] string IPAddr, [property: JsonPropertyName("RTT")] double RTT, [property: JsonPropertyName("TTL")] int TTL ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(Hop))] private partial class HopSourceGenerationContext : JsonSerializerContext { } private record Host( [property: JsonPropertyName("Distance")] Distance Distance, [property: JsonPropertyName("EndTime")] int EndTime, [property: JsonPropertyName("HostAddress")] IReadOnlyList HostAddresses, [property: JsonPropertyName("HostNames")] HostNames HostNames, [property: JsonPropertyName("IPIDSequence")] IPIDSequence IPIDSequence, [property: JsonPropertyName("OS")] OS OS, [property: JsonPropertyName("Port")] IReadOnlyList Ports, [property: JsonPropertyName("StartTime")] int StartTime, [property: JsonPropertyName("Status")] Status Status, [property: JsonPropertyName("TCPSequence")] TCPSequence TCPSequence, [property: JsonPropertyName("TCPTSSequence")] TCPTSSequence TCPTSSequence, [property: JsonPropertyName("Trace")] Trace Trace, [property: JsonPropertyName("Uptime")] Uptime Uptime ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(Host))] private partial class HostSourceGenerationContext : JsonSerializerContext { } private record HostAddress( [property: JsonPropertyName("Address")] string Address, [property: JsonPropertyName("AddressType")] string AddressType, [property: JsonPropertyName("Vendor")] string Vendor ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(HostAddress))] private partial class HostAddressSourceGenerationContext : JsonSerializerContext { } private record HostName( [property: JsonPropertyName("Name")] string Name, [property: JsonPropertyName("Type")] string Type ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(HostName))] private partial class HostNameSourceGenerationContext : JsonSerializerContext { } private record HostNames( [property: JsonPropertyName("HostName")] IReadOnlyList HostName ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(HostNames))] private partial class HostNamesSourceGenerationContext : JsonSerializerContext { } private record Hosts( [property: JsonPropertyName("Down")] int Down, [property: JsonPropertyName("Total")] int Total, [property: JsonPropertyName("Up")] int Up ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(Hosts))] private partial class HostsSourceGenerationContext : JsonSerializerContext { } private record IPIDSequence( [property: JsonPropertyName("Class")] string Class, [property: JsonPropertyName("Values")] string Values ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(IPIDSequence))] private partial class IPIDSequenceSourceGenerationContext : JsonSerializerContext { } private record OS( [property: JsonPropertyName("OSClass")] object OSClass, [property: JsonPropertyName("OSMatch")] IReadOnlyList OSMatches, [property: JsonPropertyName("OSPortUsed")] IReadOnlyList OSPortsUsed ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(OS))] private partial class OSSourceGenerationContext : JsonSerializerContext { } private record OSMatch( [property: JsonPropertyName("Accuracy")] string Accuracy, [property: JsonPropertyName("Line")] string Line, [property: JsonPropertyName("Name")] string Name ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(OSMatch))] private partial class OSMatchSourceGenerationContext : JsonSerializerContext { } private record OSPortUsed( [property: JsonPropertyName("PortID")] int PortID, [property: JsonPropertyName("Protocol")] string Protocol, [property: JsonPropertyName("State")] string State ); [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(OSPortUsed))] private partial class OSPortUsedSourceGenerationContext : JsonSerializerContext { } private record Port( [property: JsonPropertyName("PortID")] int PortID, [property: JsonPropertyName("Protocol")] string Protocol, [property: JsonPropertyName("Script")] IReadOnlyList