Skip to content

Commit

Permalink
Add AssemblyVersion to IModule
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer authored and pull[bot] committed Jul 16, 2022
1 parent 06bc09c commit a270f6a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ICSharpCode.Decompiler/TypeSystem/IAssembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#nullable enable

using System;
using System.Collections.Generic;

using ICSharpCode.Decompiler.Metadata;
Expand Down Expand Up @@ -65,6 +66,11 @@ public interface IModule : ISymbol, ICompilationProvider
/// </summary>
string AssemblyName { get; }

/// <summary>
/// Gets the assembly version.
/// </summary>
Version AssemblyVersion { get; }

/// <summary>
/// Gets the full assembly name (including public key token etc.)
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static IModuleReference CreateWithTypes(IEnumerable<KnownTypeReference> t
public ICompilation Compilation { get; }
CorlibTypeDefinition[] typeDefinitions;
readonly CorlibNamespace rootNamespace;
readonly Version asmVersion = new Version(0, 0, 0, 0);

private MinimalCorlib(ICompilation compilation, IEnumerable<KnownTypeReference> types)
{
Expand All @@ -56,6 +57,7 @@ private MinimalCorlib(ICompilation compilation, IEnumerable<KnownTypeReference>
bool IModule.IsMainModule => Compilation.MainModule == this;

string IModule.AssemblyName => "corlib";
Version IModule.AssemblyVersion => asmVersion;
string IModule.FullAssemblyName => "corlib";
string ISymbol.Name => "corlib";
SymbolKind ISymbol.SymbolKind => SymbolKind.Module;
Expand Down
2 changes: 2 additions & 0 deletions ICSharpCode.Decompiler/TypeSystem/MetadataModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ internal MetadataModule(ICompilation compilation, Metadata.PEFile peFile, TypeSy
try
{
this.AssemblyName = metadata.GetString(asmdef.Name);
this.AssemblyVersion = asmdef.Version;
this.FullAssemblyName = metadata.GetFullAssemblyName();
}
catch (BadImageFormatException)
Expand Down Expand Up @@ -117,6 +118,7 @@ internal string GetString(StringHandle name)
public bool IsMainModule => this == Compilation.MainModule;

public string AssemblyName { get; }
public Version AssemblyVersion { get; }
public string FullAssemblyName { get; }
string ISymbol.Name => AssemblyName;
SymbolKind ISymbol.SymbolKind => SymbolKind.Module;
Expand Down

0 comments on commit a270f6a

Please sign in to comment.