From 178ae977578991a2684e8197c668dcdb83d2d308 Mon Sep 17 00:00:00 2001
From: LTRData
Date: Sat, 20 Apr 2024 12:50:11 +0200
Subject: [PATCH] Public GuidPartitionTypes.ToString()
---
Library/DiscUtils.Core/Partitions/GptEntry.cs | 5 ++++-
Library/DiscUtils.Core/Partitions/GuidPartitionTypes.cs | 6 +++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Library/DiscUtils.Core/Partitions/GptEntry.cs b/Library/DiscUtils.Core/Partitions/GptEntry.cs
index fd90ae89e..989561d96 100644
--- a/Library/DiscUtils.Core/Partitions/GptEntry.cs
+++ b/Library/DiscUtils.Core/Partitions/GptEntry.cs
@@ -82,7 +82,10 @@ public GptEntry()
{ new Guid("2DB519EC-B10F-11DC-B99B-0019D1879648"), "NetBSD Encrypted" }
};
- public static string GetFriendlyPartitionType(Guid type) => _friendlyPartitionTypeNames.TryGetValue(type, out var name) ? name : type.ToString().ToUpperInvariant();
+ public static string GetFriendlyPartitionType(Guid type)
+ => _friendlyPartitionTypeNames.TryGetValue(type, out var name)
+ ? name
+ : type.ToString().ToUpperInvariant();
public int CompareTo(GptEntry other)
{
diff --git a/Library/DiscUtils.Core/Partitions/GuidPartitionTypes.cs b/Library/DiscUtils.Core/Partitions/GuidPartitionTypes.cs
index caf0e9363..38648fdc6 100644
--- a/Library/DiscUtils.Core/Partitions/GuidPartitionTypes.cs
+++ b/Library/DiscUtils.Core/Partitions/GuidPartitionTypes.cs
@@ -20,6 +20,7 @@
// DEALINGS IN THE SOFTWARE.
//
+using DiscUtils.Streams;
using System;
namespace DiscUtils.Partitions;
@@ -89,7 +90,7 @@ public static class GuidPartitionTypes
///
/// The value to convert.
/// The GUID value.
- internal static Guid Convert(WellKnownPartitionType wellKnown)
+ public static Guid Convert(WellKnownPartitionType wellKnown)
{
return wellKnown switch
{
@@ -99,4 +100,7 @@ internal static Guid Convert(WellKnownPartitionType wellKnown)
_ => throw new ArgumentException("Unknown partition type"),
};
}
+
+ public static string ToString(Guid partitionType)
+ => GptEntry.GetFriendlyPartitionType(partitionType);
}
\ No newline at end of file