Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/EventLogExpert.Eventing/Common/Events/EventFieldValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,20 @@ public bool TryGetGuid(out Guid value)
return false;
}

public bool TryGetBytes([NotNullWhen(true)] out byte[]? value)
{
if (_kind == EventFieldValueKind.Bytes && _reference is byte[] bytes)
{
value = bytes;

return true;
}

value = null;

return false;
}

public bool TryGetStringArray([NotNullWhen(true)] out string[]? values)
{
if (_kind == EventFieldValueKind.StringArray && _reference is string[] array)
Expand All @@ -122,6 +136,20 @@ public bool TryGetStringArray([NotNullWhen(true)] out string[]? values)
return false;
}

public bool TryGetArray([NotNullWhen(true)] out Array? value)
{
if (_kind == EventFieldValueKind.Array && _reference is Array array)
{
value = array;

return true;
}

value = null;

return false;
}

public string AsString() => _kind switch
{
EventFieldValueKind.String => _reference as string ?? string.Empty,
Expand Down
17 changes: 17 additions & 0 deletions src/EventLogExpert.Eventing/Common/Events/LevelSeverity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// // Copyright (c) Microsoft Corporation.
// // Licensed under the MIT License.

namespace EventLogExpert.Eventing.Common.Events;

public static class LevelSeverity
{
public static SeverityLevel? FromLevelName(string? level) => level switch
{
nameof(SeverityLevel.Critical) => SeverityLevel.Critical,
nameof(SeverityLevel.Error) => SeverityLevel.Error,
nameof(SeverityLevel.Warning) => SeverityLevel.Warning,
nameof(SeverityLevel.Information) => SeverityLevel.Information,
nameof(SeverityLevel.Verbose) => SeverityLevel.Verbose,
_ => null
};
}
27 changes: 27 additions & 0 deletions src/EventLogExpert.Runtime/DetailsPane/DetailsField.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// // Copyright (c) Microsoft Corporation.
// // Licensed under the MIT License.

namespace EventLogExpert.Runtime.DetailsPane;

public sealed record DetailsField
{
public required string Label { get; init; }

public required IReadOnlyList<string> PreviewLines { get; init; }

public required IReadOnlyList<string> FullLines { get; init; }

public required string CopyValue { get; init; }

public bool IsTruncated { get; init; }

public bool IsMuted { get; init; }

public bool IsMonospace { get; init; }

public string? DecodedLabel { get; init; }

public string? Description { get; init; }

public bool PreferFullWidth => PreviewLines.Count > 1 || IsTruncated || Description is not null;
}
7 changes: 7 additions & 0 deletions src/EventLogExpert.Runtime/DetailsPane/DetailsProperty.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// // Copyright (c) Microsoft Corporation.
// // Licensed under the MIT License.

namespace EventLogExpert.Runtime.DetailsPane;

/// <summary>A single label / value row in the reader view's identity header or system-details section.</summary>
public readonly record struct DetailsProperty(string Label, string Value);
Loading
Loading