private record
This commit is contained in:
@ -8,26 +8,26 @@ namespace File_Folder_Helper.ADO2024.PI2;
|
||||
internal static partial class Helper20240517
|
||||
{
|
||||
|
||||
public record ContentSignature([property: JsonPropertyName("contentSignature")] string Value,
|
||||
private record ContentSignature([property: JsonPropertyName("contentSignature")] string Value,
|
||||
[property: JsonPropertyName("contentSignatureType")] string ContentSignatureType);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(ContentSignature))]
|
||||
public partial class ContentSignatureGenerationContext : JsonSerializerContext
|
||||
private partial class ContentSignatureGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record Type([property: JsonPropertyName("count")] int Count,
|
||||
private record Type([property: JsonPropertyName("count")] int Count,
|
||||
[property: JsonPropertyName("match")] string Match,
|
||||
[property: JsonPropertyName("searchData")] SearchData SearchData);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Type))]
|
||||
public partial class TypeGenerationContext : JsonSerializerContext
|
||||
private partial class TypeGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record ImageAmazon([property: JsonPropertyName("colorSpace")] string ColorSpace,
|
||||
private record ImageAmazon([property: JsonPropertyName("colorSpace")] string ColorSpace,
|
||||
[property: JsonPropertyName("dateTime")] DateTime DateTime,
|
||||
[property: JsonPropertyName("dateTimeDigitized")] DateTime DateTimeDigitized,
|
||||
[property: JsonPropertyName("dateTimeOriginal")] DateTime DateTimeOriginal,
|
||||
@ -54,11 +54,11 @@ internal static partial class Helper20240517
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(ImageAmazon))]
|
||||
public partial class ImageAmazonGenerationContext : JsonSerializerContext
|
||||
private partial class ImageAmazonGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record ContentProperties([property: JsonPropertyName("contentDate")] DateTime ContentDate,
|
||||
private record ContentProperties([property: JsonPropertyName("contentDate")] DateTime ContentDate,
|
||||
[property: JsonPropertyName("contentSignatures")] IReadOnlyList<ContentSignature> ContentSignatures,
|
||||
[property: JsonPropertyName("contentType")] string ContentType,
|
||||
[property: JsonPropertyName("extension")] string Extension,
|
||||
@ -69,19 +69,19 @@ internal static partial class Helper20240517
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(ContentProperties))]
|
||||
public partial class ContentPropertiesGenerationContext : JsonSerializerContext
|
||||
private partial class ContentPropertiesGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record XAccntParentMap();
|
||||
private record XAccntParentMap();
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(XAccntParentMap))]
|
||||
public partial class XAccntParentMapGenerationContext : JsonSerializerContext
|
||||
private partial class XAccntParentMapGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record Datum([property: JsonPropertyName("accessRuleIds")] IReadOnlyList<object> AccessRuleIds,
|
||||
private record Datum([property: JsonPropertyName("accessRuleIds")] IReadOnlyList<object> AccessRuleIds,
|
||||
[property: JsonPropertyName("childAssetTypeInfo")] IReadOnlyList<object> ChildAssetTypeInfo,
|
||||
[property: JsonPropertyName("contentProperties")] ContentProperties ContentProperties,
|
||||
[property: JsonPropertyName("createdBy")] string CreatedBy,
|
||||
@ -111,27 +111,27 @@ internal static partial class Helper20240517
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Datum))]
|
||||
public partial class DatumGenerationContext : JsonSerializerContext
|
||||
private partial class DatumGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Dictionary<string, Datum>))]
|
||||
public partial class DictionaryDatumGenerationContext : JsonSerializerContext
|
||||
private partial class DictionaryDatumGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record LocationAmazon([property: JsonPropertyName("count")] int Count,
|
||||
private record LocationAmazon([property: JsonPropertyName("count")] int Count,
|
||||
[property: JsonPropertyName("match")] string Match,
|
||||
[property: JsonPropertyName("searchData")] SearchData SearchData);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(LocationAmazon))]
|
||||
public partial class LocationAmazonGenerationContext : JsonSerializerContext
|
||||
private partial class LocationAmazonGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record LocationInfo([property: JsonPropertyName("city")] string City,
|
||||
private record LocationInfo([property: JsonPropertyName("city")] string City,
|
||||
[property: JsonPropertyName("country")] string Country,
|
||||
[property: JsonPropertyName("countryIso3Code")] string CountryIso3Code,
|
||||
[property: JsonPropertyName("state")] string State,
|
||||
@ -139,74 +139,74 @@ internal static partial class Helper20240517
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(LocationInfo))]
|
||||
public partial class LocationInfoGenerationContext : JsonSerializerContext
|
||||
private partial class LocationInfoGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record SearchData([property: JsonPropertyName("clusterName")] string ClusterName,
|
||||
private record SearchData([property: JsonPropertyName("clusterName")] string ClusterName,
|
||||
[property: JsonPropertyName("locationId")] string LocationId,
|
||||
[property: JsonPropertyName("locationInfo")] LocationInfo LocationInfo,
|
||||
[property: JsonPropertyName("thingId")] string ThingId);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(SearchData))]
|
||||
public partial class SearchDataGenerationContext : JsonSerializerContext
|
||||
private partial class SearchDataGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record AllPerson([property: JsonPropertyName("count")] int Count,
|
||||
private record AllPerson([property: JsonPropertyName("count")] int Count,
|
||||
[property: JsonPropertyName("match")] string Match,
|
||||
[property: JsonPropertyName("searchData")] SearchData SearchData);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(AllPerson))]
|
||||
public partial class AllPersonGenerationContext : JsonSerializerContext
|
||||
private partial class AllPersonGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record PersonAmazon([property: JsonPropertyName("count")] int Count,
|
||||
private record PersonAmazon([property: JsonPropertyName("count")] int Count,
|
||||
[property: JsonPropertyName("match")] string Match,
|
||||
[property: JsonPropertyName("searchData")] SearchData SearchData);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(PersonAmazon))]
|
||||
public partial class PersonAmazonGenerationContext : JsonSerializerContext
|
||||
private partial class PersonAmazonGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record ClusterId([property: JsonPropertyName("count")] int Count,
|
||||
private record ClusterId([property: JsonPropertyName("count")] int Count,
|
||||
[property: JsonPropertyName("match")] string Match,
|
||||
[property: JsonPropertyName("searchData")] SearchData SearchData);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(ClusterId))]
|
||||
public partial class ClusterIdGenerationContext : JsonSerializerContext
|
||||
private partial class ClusterIdGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record Thing([property: JsonPropertyName("count")] int Count,
|
||||
private record Thing([property: JsonPropertyName("count")] int Count,
|
||||
[property: JsonPropertyName("match")] string Match,
|
||||
[property: JsonPropertyName("searchData")] SearchData SearchData);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Thing))]
|
||||
public partial class ThingGenerationContext : JsonSerializerContext
|
||||
private partial class ThingGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record Time([property: JsonPropertyName("count")] int Count,
|
||||
private record Time([property: JsonPropertyName("count")] int Count,
|
||||
[property: JsonPropertyName("match")] string Match,
|
||||
[property: JsonPropertyName("searchData")] SearchData SearchData);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Time))]
|
||||
public partial class TimeGenerationContext : JsonSerializerContext
|
||||
private partial class TimeGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record ParentMap([property: JsonPropertyName("FOLDER")] IReadOnlyList<string> FOLDER);
|
||||
private record ParentMap([property: JsonPropertyName("FOLDER")] IReadOnlyList<string> FOLDER);
|
||||
|
||||
public record Aggregations([property: JsonPropertyName("allPeople")] IReadOnlyList<AllPerson> AllPeople,
|
||||
private record Aggregations([property: JsonPropertyName("allPeople")] IReadOnlyList<AllPerson> AllPeople,
|
||||
[property: JsonPropertyName("clusterId")] IReadOnlyList<ClusterId> ClusterId,
|
||||
[property: JsonPropertyName("location")] IReadOnlyList<LocationAmazon> Location,
|
||||
[property: JsonPropertyName("people")] IReadOnlyList<PersonAmazon> People,
|
||||
@ -216,23 +216,23 @@ internal static partial class Helper20240517
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(Aggregations))]
|
||||
public partial class AggregationsGenerationContext : JsonSerializerContext
|
||||
private partial class AggregationsGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(ParentMap))]
|
||||
public partial class ParentMapGenerationContext : JsonSerializerContext
|
||||
private partial class ParentMapGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public record RootAmazon([property: JsonPropertyName("aggregations")] Aggregations Aggregations,
|
||||
private record RootAmazon([property: JsonPropertyName("aggregations")] Aggregations Aggregations,
|
||||
[property: JsonPropertyName("count")] int Count,
|
||||
[property: JsonPropertyName("data")] IReadOnlyList<Datum> Data);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(RootAmazon))]
|
||||
public partial class RootAmazonGenerationContext : JsonSerializerContext
|
||||
private partial class RootAmazonGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,37 @@
|
||||
using File_Folder_Helper.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.ADO2024.PI2;
|
||||
|
||||
internal static partial class Helper20240718
|
||||
{
|
||||
|
||||
private record Host([property: JsonPropertyName("a")] string? Id,
|
||||
[property: JsonPropertyName("b")] string? Colon,
|
||||
[property: JsonPropertyName("c")] string? Hyphen,
|
||||
[property: JsonPropertyName("d")] string? Line,
|
||||
[property: JsonPropertyName("e")] string? Count,
|
||||
[property: JsonPropertyName("f")] string? Segments,
|
||||
[property: JsonPropertyName("g")] string? Type,
|
||||
[property: JsonPropertyName("h")] string? Device,
|
||||
[property: JsonPropertyName("i")] string? Name,
|
||||
[property: JsonPropertyName("j")] string? Location);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true, AllowTrailingCommas = true)]
|
||||
[JsonSerializable(typeof(Host[]))]
|
||||
private partial class HostsSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
private static Host[] GetHosts(ILogger<Worker> logger, string file)
|
||||
{
|
||||
Host[] results;
|
||||
string lines = File.ReadAllText(file);
|
||||
string json = $"[{lines.Replace("\r\n", ",")}]";
|
||||
logger.LogDebug(lines);
|
||||
results = JsonSerializer.Deserialize(json, HostSourceGenerationContext.Default.HostArray) ?? throw new NullReferenceException();
|
||||
results = JsonSerializer.Deserialize(json, HostsSourceGenerationContext.Default.HostArray) ?? throw new NullReferenceException();
|
||||
return results;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user