Skip to content

Commit

Permalink
Public GuidPartitionTypes.ToString()
Browse files Browse the repository at this point in the history
  • Loading branch information
LTRData committed Apr 20, 2024
1 parent 2fac371 commit 178ae97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Library/DiscUtils.Core/Partitions/GptEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
6 changes: 5 additions & 1 deletion Library/DiscUtils.Core/Partitions/GuidPartitionTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// DEALINGS IN THE SOFTWARE.
//

using DiscUtils.Streams;
using System;

namespace DiscUtils.Partitions;
Expand Down Expand Up @@ -89,7 +90,7 @@ public static class GuidPartitionTypes
/// </summary>
/// <param name="wellKnown">The value to convert.</param>
/// <returns>The GUID value.</returns>
internal static Guid Convert(WellKnownPartitionType wellKnown)
public static Guid Convert(WellKnownPartitionType wellKnown)
{
return wellKnown switch
{
Expand All @@ -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);
}

0 comments on commit 178ae97

Please sign in to comment.