This repository was archived by the owner on Mar 31, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathNuGetPackageExplorerFile.cs
More file actions
95 lines (76 loc) · 3.25 KB
/
NuGetPackageExplorerFile.cs
File metadata and controls
95 lines (76 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.ComponentModel.DataAnnotations;
using NuGetPe.AssemblyMetadata;
namespace NuGet.Insights.Worker.NuGetPackageExplorerToCsv
{
[CsvRecord]
public partial record NuGetPackageExplorerFile : PackageRecord, IAggregatedCsvRecord<NuGetPackageExplorerFile>
{
public NuGetPackageExplorerFile()
{
}
public NuGetPackageExplorerFile(Guid scanId, DateTimeOffset scanTimestamp, PackageDeleteCatalogLeaf leaf)
: base(scanId, scanTimestamp, leaf)
{
ResultType = NuGetPackageExplorerResultType.Deleted;
}
public NuGetPackageExplorerFile(Guid scanId, DateTimeOffset scanTimestamp, PackageDetailsCatalogLeaf leaf)
: base(scanId, scanTimestamp, leaf)
{
ResultType = NuGetPackageExplorerResultType.Available;
}
[Required]
public NuGetPackageExplorerResultType ResultType { get; set; }
public string Path { get; set; }
public string Extension { get; set; }
public bool? HasCompilerFlags { get; set; }
public bool? HasSourceLink { get; set; }
public bool? HasDebugInfo { get; set; }
[KustoType("dynamic")]
public string CompilerFlags { get; set; }
[KustoType("dynamic")]
public string SourceUrlRepoInfo { get; set; }
public PdbType? PdbType { get; set; }
public static string CsvCompactMessageSchemaName => "cc.npef";
public static IEqualityComparer<NuGetPackageExplorerFile> KeyComparer { get; } = NuGetPackageExplorerFileKeyComparer.Instance;
public static IReadOnlyList<string> KeyFields { get; } = [nameof(Identity), nameof(Path)];
public static List<NuGetPackageExplorerFile> Prune(List<NuGetPackageExplorerFile> records, bool isFinalPrune, IOptions<NuGetInsightsWorkerSettings> options, ILogger logger)
{
return PackageRecordExtensions.Prune(records, isFinalPrune);
}
public int CompareTo(NuGetPackageExplorerFile other)
{
var c = base.CompareTo(other);
if (c != 0)
{
return c;
}
return string.CompareOrdinal(Path, other.Path);
}
public class NuGetPackageExplorerFileKeyComparer : IEqualityComparer<NuGetPackageExplorerFile>
{
public static NuGetPackageExplorerFileKeyComparer Instance { get; } = new();
public bool Equals(NuGetPackageExplorerFile x, NuGetPackageExplorerFile y)
{
if (ReferenceEquals(x, y))
{
return true;
}
if (x is null || y is null)
{
return false;
}
return x.Identity == y.Identity
&& x.Path == y.Path;
}
public int GetHashCode([DisallowNull] NuGetPackageExplorerFile obj)
{
var hashCode = new HashCode();
hashCode.Add(obj.Identity);
hashCode.Add(obj.Path);
return hashCode.ToHashCode();
}
}
}
}