Browse Source

Move LanguageVersion to ILSpyX.

pull/2785/head
Siegfried Pammer 3 years ago
parent
commit
051aa600e4
  1. 40
      ICSharpCode.ILSpyX/LanguageVersion.cs
  2. 1
      ILSpy/DecompilationOptions.cs
  3. 2
      ILSpy/Languages/CSharpLanguage.cs
  4. 31
      ILSpy/Languages/Language.cs
  5. 1
      ILSpy/ViewModels/TabPageModel.cs

40
ICSharpCode.ILSpyX/LanguageVersion.cs

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
namespace ICSharpCode.ILSpyX
{
/// <summary>
/// Version-DisplayName pair used in UI scenarios, for example ILSpy's language version dropdown.
/// </summary>
public class LanguageVersion
{
public string Version { get; }
public string DisplayName { get; }
public LanguageVersion(string version, string? name = null)
{
Version = version ?? "";
DisplayName = name ?? Version.ToString();
}
public override string ToString()
{
return $"[LanguageVersion DisplayName={DisplayName}, Version={Version}]";
}
}
}

1
ILSpy/DecompilationOptions.cs

@ -20,6 +20,7 @@ using System; @@ -20,6 +20,7 @@ using System;
using System.Threading;
using ICSharpCode.ILSpy.Options;
using ICSharpCode.ILSpyX;
namespace ICSharpCode.ILSpy
{

2
ILSpy/Languages/CSharpLanguage.cs

@ -47,6 +47,8 @@ using ICSharpCode.ILSpy.TextView; @@ -47,6 +47,8 @@ using ICSharpCode.ILSpy.TextView;
using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.ILSpyX;
using LanguageVersion = ICSharpCode.ILSpyX.LanguageVersion;
namespace ICSharpCode.ILSpy
{
/// <summary>

31
ILSpy/Languages/Language.cs

@ -32,27 +32,8 @@ using ICSharpCode.Decompiler.Util; @@ -32,27 +32,8 @@ using ICSharpCode.Decompiler.Util;
using ICSharpCode.ILSpyX;
using ICSharpCode.ILSpyX.Abstractions;
using SRM = System.Reflection.Metadata;
namespace ICSharpCode.ILSpy
{
public class LanguageVersion
{
public string Version { get; }
public string DisplayName { get; }
public LanguageVersion(string version, string name = null)
{
this.Version = version ?? "";
this.DisplayName = name ?? version.ToString();
}
public override string ToString()
{
return $"[LanguageVersion DisplayName={DisplayName}, Version={Version}]";
}
}
/// <summary>
/// Base class for language-specific decompiler implementations.
/// </summary>
@ -84,9 +65,9 @@ namespace ICSharpCode.ILSpy @@ -84,9 +65,9 @@ namespace ICSharpCode.ILSpy
/// <summary>
/// Gets the syntax highlighting used for this language.
/// </summary>
public virtual ICSharpCode.AvalonEdit.Highlighting.IHighlightingDefinition SyntaxHighlighting {
public virtual IHighlightingDefinition SyntaxHighlighting {
get {
return ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinitionByExtension(this.FileExtension);
return HighlightingManager.Instance.GetDefinitionByExtension(FileExtension);
}
}
@ -541,13 +522,13 @@ namespace ICSharpCode.ILSpy @@ -541,13 +522,13 @@ namespace ICSharpCode.ILSpy
}
}
public virtual CodeMappingInfo GetCodeMappingInfo(PEFile module, SRM.EntityHandle member)
public virtual CodeMappingInfo GetCodeMappingInfo(PEFile module, EntityHandle member)
{
var declaringType = (SRM.TypeDefinitionHandle)member.GetDeclaringType(module.Metadata);
var declaringType = (TypeDefinitionHandle)member.GetDeclaringType(module.Metadata);
if (declaringType.IsNil && member.Kind == SRM.HandleKind.TypeDefinition)
if (declaringType.IsNil && member.Kind == HandleKind.TypeDefinition)
{
declaringType = (SRM.TypeDefinitionHandle)member;
declaringType = (TypeDefinitionHandle)member;
}
return new CodeMappingInfo(module, declaringType);

1
ILSpy/ViewModels/TabPageModel.cs

@ -22,6 +22,7 @@ using System.Linq; @@ -22,6 +22,7 @@ using System.Linq;
using System.Threading.Tasks;
using ICSharpCode.ILSpy.TextView;
using ICSharpCode.ILSpyX;
namespace ICSharpCode.ILSpy.ViewModels
{

Loading…
Cancel
Save