Browse Source

Add AssemblyVersion to IModule

pull/2642/head
Siegfried Pammer 3 years ago
parent
commit
fe915780ad
  1. 6
      ICSharpCode.Decompiler/TypeSystem/IAssembly.cs
  2. 2
      ICSharpCode.Decompiler/TypeSystem/Implementation/MinimalCorlib.cs
  3. 2
      ICSharpCode.Decompiler/TypeSystem/MetadataModule.cs

6
ICSharpCode.Decompiler/TypeSystem/IAssembly.cs

@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
#nullable enable
using System;
using System.Collections.Generic;
using ICSharpCode.Decompiler.Metadata;
@ -65,6 +66,11 @@ namespace ICSharpCode.Decompiler.TypeSystem @@ -65,6 +66,11 @@ namespace ICSharpCode.Decompiler.TypeSystem
/// </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>

2
ICSharpCode.Decompiler/TypeSystem/Implementation/MinimalCorlib.cs

@ -45,6 +45,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation @@ -45,6 +45,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
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)
{
@ -56,6 +57,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation @@ -56,6 +57,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
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;

2
ICSharpCode.Decompiler/TypeSystem/MetadataModule.cs

@ -66,6 +66,7 @@ namespace ICSharpCode.Decompiler.TypeSystem @@ -66,6 +66,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
try
{
this.AssemblyName = metadata.GetString(asmdef.Name);
this.AssemblyVersion = asmdef.Version;
this.FullAssemblyName = metadata.GetFullAssemblyName();
}
catch (BadImageFormatException)
@ -117,6 +118,7 @@ namespace ICSharpCode.Decompiler.TypeSystem @@ -117,6 +118,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
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;

Loading…
Cancel
Save