From 94c1a8670282fe274d320b62b0fd1d9bcbbf8276 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 8 Sep 2025 07:56:40 -0400 Subject: [PATCH] Add AssemblyName extension property to PE --- .../Wrappers/PortableExecutable.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/SabreTools.Serialization/Wrappers/PortableExecutable.cs b/SabreTools.Serialization/Wrappers/PortableExecutable.cs index 6f796ed5..28e766c4 100644 --- a/SabreTools.Serialization/Wrappers/PortableExecutable.cs +++ b/SabreTools.Serialization/Wrappers/PortableExecutable.cs @@ -596,6 +596,25 @@ namespace SabreTools.Serialization.Wrappers } } + /// + /// Name as derived from the assembly manifest + /// + /// + /// If there are multiple identities included in the manifest, + /// this will only retrieve the value from the first that doesn't + /// have a null or empty name. + /// + public string? AssemblyName + { + get + { + var manifest = GetAssemblyManifest(); + var identities = manifest?.AssemblyIdentities ?? []; + var nameIdentity = Array.Find(identities, ai => !string.IsNullOrEmpty(ai?.Name)); + return nameIdentity?.Name; + } + } + /// /// Version as derived from the assembly manifest ///