dotnet-installer/src/SourceBuild/tarball/content/tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection/PoisonedFileEntry.cs
Dan Seefeldt 832010fdf6
Initial checkin of source-build tarball build infrastructure (#10961)
* Initial checkin of source-build tarball build infra

* Add a couple more comments

* Update eng/SourceBuild.Version.Details.xml based on PR review

Co-authored-by: Chris Rummel <crummel@microsoft.com>

* Updates based on PR review comments

Co-authored-by: Chris Rummel <crummel@microsoft.com>
2021-06-24 16:36:04 -05:00

36 lines
1.1 KiB
C#

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Microsoft.DotNet.SourceBuild.Tasks.LeakDetection
{
internal class PoisonedFileEntry
{
const string ElementName = "File";
internal byte[] Hash { get; set; }
internal string Path { get; set; }
internal PoisonType Type { get; set; }
internal List<PoisonMatch> Matches { get; }
internal PoisonedFileEntry()
{
this.Matches = new List<PoisonMatch>();
}
public XElement ToXml() => this.ToXml(ElementName);
protected XElement ToXml(string myElementName) => new XElement(myElementName,
new XAttribute(nameof(Path), Path),
new XElement(nameof(Hash), Hash.ToHexString()),
new XElement(nameof(Type), Type.ToString()),
Matches.Select(m => m.ToXml())
);
}
}