mirror of https://github.com/icsharpcode/ILSpy.git
101 changed files with 4262 additions and 503 deletions
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness |
||||
{ |
||||
class DynamicTests |
||||
{ |
||||
delegate void RefAction<T>(ref T arg); |
||||
|
||||
static void Main(string[] args) |
||||
{ |
||||
PrintResult((ref dynamic x) => x = x + 2.0, 5.0); |
||||
PrintResult((ref dynamic x) => x = x + 2.0, 5); |
||||
PrintResult((ref dynamic x) => x = x + 2, 5.0); |
||||
PrintResult((ref dynamic x) => x = x + 2, 5); |
||||
PrintResult((ref dynamic x) => x = x - 2.0, 5.0); |
||||
PrintResult((ref dynamic x) => x = x - 2.0, 5); |
||||
PrintResult((ref dynamic x) => x = x - 2, 5.0); |
||||
PrintResult((ref dynamic x) => x = x - 2, 5); |
||||
PrintResult((ref dynamic x) => x = x * 2.0, 5.0); |
||||
PrintResult((ref dynamic x) => x = x * 2.0, 5); |
||||
PrintResult((ref dynamic x) => x = x * 2, 5.0); |
||||
PrintResult((ref dynamic x) => x = x * 2, 5); |
||||
PrintResult((ref dynamic x) => x = x / 2.0, 5.0); |
||||
PrintResult((ref dynamic x) => x = x / 2.0, 5); |
||||
PrintResult((ref dynamic x) => x = x / 2, 5.0); |
||||
PrintResult((ref dynamic x) => x = x / 2, 5); |
||||
} |
||||
|
||||
private static void PrintResult(RefAction<dynamic> p, dynamic arg) |
||||
{ |
||||
p(ref arg); |
||||
Console.WriteLine(arg); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,87 @@
@@ -0,0 +1,87 @@
|
||||
// Copyright (c) 2018 Siegfried Pammer
|
||||
//
|
||||
// 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.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
|
||||
namespace ICSharpCode.Decompiler.Metadata |
||||
{ |
||||
public class ReferenceLoadInfo |
||||
{ |
||||
readonly Dictionary<string, UnresolvedAssemblyNameReference> loadedAssemblyReferences = new Dictionary<string, UnresolvedAssemblyNameReference>(); |
||||
|
||||
public void AddMessage(string fullName, MessageKind kind, string message) |
||||
{ |
||||
lock (loadedAssemblyReferences) |
||||
{ |
||||
if (!loadedAssemblyReferences.TryGetValue(fullName, out var referenceInfo)) |
||||
{ |
||||
referenceInfo = new UnresolvedAssemblyNameReference(fullName); |
||||
loadedAssemblyReferences.Add(fullName, referenceInfo); |
||||
} |
||||
referenceInfo.Messages.Add((kind, message)); |
||||
} |
||||
} |
||||
|
||||
public void AddMessageOnce(string fullName, MessageKind kind, string message) |
||||
{ |
||||
lock (loadedAssemblyReferences) |
||||
{ |
||||
if (!loadedAssemblyReferences.TryGetValue(fullName, out var referenceInfo)) |
||||
{ |
||||
referenceInfo = new UnresolvedAssemblyNameReference(fullName); |
||||
loadedAssemblyReferences.Add(fullName, referenceInfo); |
||||
referenceInfo.Messages.Add((kind, message)); |
||||
} |
||||
else |
||||
{ |
||||
var lastMsg = referenceInfo.Messages.LastOrDefault(); |
||||
if (kind != lastMsg.Item1 && message != lastMsg.Item2) |
||||
referenceInfo.Messages.Add((kind, message)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public bool TryGetInfo(string fullName, out UnresolvedAssemblyNameReference info) |
||||
{ |
||||
lock (loadedAssemblyReferences) |
||||
{ |
||||
return loadedAssemblyReferences.TryGetValue(fullName, out info); |
||||
} |
||||
} |
||||
|
||||
public IReadOnlyList<UnresolvedAssemblyNameReference> Entries { |
||||
get { |
||||
lock (loadedAssemblyReferences) |
||||
{ |
||||
return loadedAssemblyReferences.Values.ToList(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public bool HasErrors { |
||||
get { |
||||
lock (loadedAssemblyReferences) |
||||
{ |
||||
return loadedAssemblyReferences.Any(i => i.Value.HasErrors); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,17 +1,19 @@
@@ -1,17 +1,19 @@
|
||||
<Application x:Class="ICSharpCode.ILSpy.App" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:styles="urn:TomsToolbox.Wpf.Styles" |
||||
StartupUri="MainWindow.xaml"> |
||||
<Application.Resources> |
||||
<Style x:Key="DialogWindow" TargetType="{x:Type Window}"> |
||||
<Style x:Key="DialogWindow" TargetType="{x:Type Window}" BasedOn="{StaticResource {x:Static styles:ResourceKeys.WindowStyle}}"> |
||||
<Setter Property="ShowInTaskbar" Value="False"/> |
||||
<Setter Property="UseLayoutRounding" Value="True"/> |
||||
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/> |
||||
</Style> |
||||
|
||||
<Style TargetType="{x:Type Button}"> |
||||
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static styles:ResourceKeys.ButtonStyle}}"> |
||||
<Setter Property="MinWidth" Value="73" /> |
||||
<Setter Property="Padding" Value="9,1,9,1" /> |
||||
</Style> |
||||
|
||||
</Application.Resources> |
||||
</Application> |
After Width: | Height: | Size: 320 B |
@ -0,0 +1,84 @@
@@ -0,0 +1,84 @@
|
||||
// Copyright (c) 2021 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.
|
||||
|
||||
using System.Collections.Generic; |
||||
using System.Reflection.Metadata; |
||||
using System.Reflection.Metadata.Ecma335; |
||||
|
||||
using ICSharpCode.Decompiler; |
||||
using ICSharpCode.Decompiler.Metadata; |
||||
using ICSharpCode.ILSpy.Options; |
||||
using ICSharpCode.ILSpy.TreeNodes; |
||||
using ICSharpCode.ILSpy.ViewModels; |
||||
|
||||
namespace ICSharpCode.ILSpy.Metadata |
||||
{ |
||||
class DebugMetadataTablesTreeNode : ILSpyTreeNode |
||||
{ |
||||
private PEFile module; |
||||
private bool isEmbedded; |
||||
private MetadataReader provider; |
||||
|
||||
public DebugMetadataTablesTreeNode(PEFile module, bool isEmbedded, MetadataReader provider) |
||||
{ |
||||
this.module = module; |
||||
this.isEmbedded = isEmbedded; |
||||
this.provider = provider; |
||||
this.LazyLoading = true; |
||||
} |
||||
|
||||
public override object Text => "Tables"; |
||||
|
||||
public override object Icon => Images.Literal; |
||||
|
||||
protected override void LoadChildren() |
||||
{ |
||||
if (ShowTable(TableIndex.Document)) |
||||
this.Children.Add(new DocumentTableTreeNode(this.module, this.provider, isEmbedded)); |
||||
if (ShowTable(TableIndex.MethodDebugInformation)) |
||||
this.Children.Add(new MethodDebugInformationTableTreeNode(this.module, this.provider, isEmbedded)); |
||||
if (ShowTable(TableIndex.LocalScope)) |
||||
this.Children.Add(new LocalScopeTableTreeNode(this.module, this.provider, isEmbedded)); |
||||
if (ShowTable(TableIndex.LocalVariable)) |
||||
this.Children.Add(new LocalVariableTableTreeNode(this.module, this.provider, isEmbedded)); |
||||
if (ShowTable(TableIndex.LocalConstant)) |
||||
this.Children.Add(new LocalConstantTableTreeNode(this.module, this.provider, isEmbedded)); |
||||
if (ShowTable(TableIndex.ImportScope)) |
||||
this.Children.Add(new ImportScopeTableTreeNode(this.module, this.provider, isEmbedded)); |
||||
if (ShowTable(TableIndex.StateMachineMethod)) |
||||
this.Children.Add(new StateMachineMethodTableTreeNode(this.module, this.provider, isEmbedded)); |
||||
if (ShowTable(TableIndex.CustomDebugInformation)) |
||||
this.Children.Add(new CustomDebugInformationTableTreeNode(this.module, this.provider, isEmbedded)); |
||||
|
||||
bool ShowTable(TableIndex table) => !DisplaySettingsPanel.CurrentDisplaySettings.HideEmptyMetadataTables || this.provider.GetTableRowCount(table) > 0; |
||||
} |
||||
|
||||
public override bool View(TabPageModel tabPage) |
||||
{ |
||||
tabPage.Title = Text.ToString(); |
||||
tabPage.SupportsLanguageSwitching = false; |
||||
|
||||
return false; |
||||
} |
||||
|
||||
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||
{ |
||||
language.WriteCommentLine(output, "Metadata Tables"); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,97 @@
@@ -0,0 +1,97 @@
|
||||
// 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.
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.Reflection; |
||||
using System.Reflection.Metadata; |
||||
using System.Reflection.Metadata.Ecma335; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Data; |
||||
|
||||
using ICSharpCode.Decompiler; |
||||
using ICSharpCode.Decompiler.DebugInfo; |
||||
using ICSharpCode.Decompiler.Disassembler; |
||||
using ICSharpCode.Decompiler.IL; |
||||
using ICSharpCode.Decompiler.Metadata; |
||||
|
||||
namespace ICSharpCode.ILSpy.Metadata |
||||
{ |
||||
internal class BlobHeapTreeNode : MetadataHeapTreeNode |
||||
{ |
||||
readonly List<BlobHeapEntry> list; |
||||
|
||||
public BlobHeapTreeNode(PEFile module, MetadataReader metadata) |
||||
: base(HandleKind.Blob, module, metadata) |
||||
{ |
||||
list = new List<BlobHeapEntry>(); |
||||
|
||||
BlobHandle handle = MetadataTokens.BlobHandle(0); |
||||
do |
||||
{ |
||||
BlobHeapEntry entry = new BlobHeapEntry(metadata, handle); |
||||
list.Add(entry); |
||||
handle = metadata.GetNextHandle(handle); |
||||
} while (!handle.IsNil); |
||||
} |
||||
|
||||
public override object Text => $"Blob Heap ({list.Count})"; |
||||
|
||||
public override object Icon => Images.Literal; |
||||
|
||||
public override bool View(ViewModels.TabPageModel tabPage) |
||||
{ |
||||
tabPage.Title = Text.ToString(); |
||||
tabPage.SupportsLanguageSwitching = false; |
||||
|
||||
var view = Helpers.PrepareDataGrid(tabPage, this); |
||||
|
||||
view.ItemsSource = list; |
||||
|
||||
tabPage.Content = view; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
class BlobHeapEntry |
||||
{ |
||||
readonly MetadataReader metadata; |
||||
readonly BlobHandle handle; |
||||
|
||||
public int Offset => metadata.GetHeapOffset(handle); |
||||
|
||||
public int Length => metadata.GetBlobReader(handle).Length; |
||||
|
||||
public string Value => metadata.GetBlobReader(handle).ToHexString(); |
||||
|
||||
public BlobHeapEntry(MetadataReader metadata, BlobHandle handle) |
||||
{ |
||||
this.metadata = metadata; |
||||
this.handle = handle; |
||||
} |
||||
} |
||||
|
||||
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||
{ |
||||
language.WriteCommentLine(output, "Blob Heap"); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,86 @@
@@ -0,0 +1,86 @@
|
||||
// Copyright (c) 2021 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.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Reflection.Metadata; |
||||
using System.Reflection.Metadata.Ecma335; |
||||
|
||||
using ICSharpCode.Decompiler; |
||||
using ICSharpCode.Decompiler.Metadata; |
||||
|
||||
namespace ICSharpCode.ILSpy.Metadata |
||||
{ |
||||
internal class GuidHeapTreeNode : MetadataHeapTreeNode |
||||
{ |
||||
readonly List<GuidHeapEntry> list; |
||||
|
||||
public GuidHeapTreeNode(PEFile module, MetadataReader metadata) |
||||
: base(HandleKind.Guid, module, metadata) |
||||
{ |
||||
list = new List<GuidHeapEntry>(); |
||||
int count = metadata.GetHeapSize(HeapIndex.Guid) >> 4; |
||||
for (int i = 1; i <= count; i++) |
||||
{ |
||||
GuidHeapEntry entry = new GuidHeapEntry(metadata, MetadataTokens.GuidHandle(i)); |
||||
list.Add(entry); |
||||
} |
||||
} |
||||
|
||||
public override object Text => $"Guid Heap ({list.Count})"; |
||||
|
||||
public override object Icon => Images.Literal; |
||||
|
||||
public override bool View(ViewModels.TabPageModel tabPage) |
||||
{ |
||||
tabPage.Title = Text.ToString(); |
||||
tabPage.SupportsLanguageSwitching = false; |
||||
|
||||
var view = Helpers.PrepareDataGrid(tabPage, this); |
||||
|
||||
view.ItemsSource = list; |
||||
|
||||
tabPage.Content = view; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
class GuidHeapEntry |
||||
{ |
||||
readonly MetadataReader metadata; |
||||
readonly GuidHandle handle; |
||||
|
||||
public int Index => metadata.GetHeapOffset(handle); |
||||
|
||||
public int Length => 16; |
||||
|
||||
public string Value => metadata.GetGuid(handle).ToString(); |
||||
|
||||
public GuidHeapEntry(MetadataReader metadata, GuidHandle handle) |
||||
{ |
||||
this.metadata = metadata; |
||||
this.handle = handle; |
||||
} |
||||
} |
||||
|
||||
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||
{ |
||||
language.WriteCommentLine(output, "Guid Heap"); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,96 @@
@@ -0,0 +1,96 @@
|
||||
// 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.
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.Reflection; |
||||
using System.Reflection.Metadata; |
||||
using System.Reflection.Metadata.Ecma335; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Data; |
||||
|
||||
using ICSharpCode.Decompiler; |
||||
using ICSharpCode.Decompiler.DebugInfo; |
||||
using ICSharpCode.Decompiler.Disassembler; |
||||
using ICSharpCode.Decompiler.IL; |
||||
using ICSharpCode.Decompiler.Metadata; |
||||
|
||||
namespace ICSharpCode.ILSpy.Metadata |
||||
{ |
||||
internal class StringHeapTreeNode : MetadataHeapTreeNode |
||||
{ |
||||
readonly List<StringHeapEntry> list; |
||||
|
||||
public StringHeapTreeNode(PEFile module, MetadataReader metadata) |
||||
: base(HandleKind.String, module, metadata) |
||||
{ |
||||
list = new List<StringHeapEntry>(); |
||||
StringHandle handle = MetadataTokens.StringHandle(0); |
||||
do |
||||
{ |
||||
StringHeapEntry entry = new StringHeapEntry(metadata, handle); |
||||
list.Add(entry); |
||||
handle = metadata.GetNextHandle(handle); |
||||
} while (!handle.IsNil); |
||||
} |
||||
|
||||
public override object Text => $"String Heap ({list.Count})"; |
||||
|
||||
public override object Icon => Images.Literal; |
||||
|
||||
public override bool View(ViewModels.TabPageModel tabPage) |
||||
{ |
||||
tabPage.Title = Text.ToString(); |
||||
tabPage.SupportsLanguageSwitching = false; |
||||
|
||||
var view = Helpers.PrepareDataGrid(tabPage, this); |
||||
|
||||
view.ItemsSource = list; |
||||
|
||||
tabPage.Content = view; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
class StringHeapEntry |
||||
{ |
||||
readonly MetadataReader metadata; |
||||
readonly StringHandle handle; |
||||
|
||||
public int Offset => metadata.GetHeapOffset(handle); |
||||
|
||||
public int Length => metadata.GetString(handle).Length; |
||||
|
||||
public string Value => metadata.GetString(handle); |
||||
|
||||
public StringHeapEntry(MetadataReader metadata, StringHandle handle) |
||||
{ |
||||
this.metadata = metadata; |
||||
this.handle = handle; |
||||
} |
||||
} |
||||
|
||||
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||
{ |
||||
language.WriteCommentLine(output, "String Heap"); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,97 @@
@@ -0,0 +1,97 @@
|
||||
// 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.
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.Reflection; |
||||
using System.Reflection.Metadata; |
||||
using System.Reflection.Metadata.Ecma335; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Data; |
||||
|
||||
using ICSharpCode.Decompiler; |
||||
using ICSharpCode.Decompiler.DebugInfo; |
||||
using ICSharpCode.Decompiler.Disassembler; |
||||
using ICSharpCode.Decompiler.IL; |
||||
using ICSharpCode.Decompiler.Metadata; |
||||
|
||||
namespace ICSharpCode.ILSpy.Metadata |
||||
{ |
||||
internal class UserStringHeapTreeNode : MetadataHeapTreeNode |
||||
{ |
||||
readonly List<UserStringHeapEntry> list; |
||||
|
||||
public UserStringHeapTreeNode(PEFile module, MetadataReader metadata) |
||||
: base(HandleKind.UserString, module, metadata) |
||||
{ |
||||
list = new List<UserStringHeapEntry>(); |
||||
|
||||
UserStringHandle handle = MetadataTokens.UserStringHandle(0); |
||||
do |
||||
{ |
||||
UserStringHeapEntry entry = new UserStringHeapEntry(metadata, handle); |
||||
list.Add(entry); |
||||
handle = metadata.GetNextHandle(handle); |
||||
} while (!handle.IsNil); |
||||
} |
||||
|
||||
public override object Text => $"UserString Heap ({list.Count})"; |
||||
|
||||
public override object Icon => Images.Literal; |
||||
|
||||
public override bool View(ViewModels.TabPageModel tabPage) |
||||
{ |
||||
tabPage.Title = Text.ToString(); |
||||
tabPage.SupportsLanguageSwitching = false; |
||||
|
||||
var view = Helpers.PrepareDataGrid(tabPage, this); |
||||
|
||||
view.ItemsSource = list; |
||||
|
||||
tabPage.Content = view; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
class UserStringHeapEntry |
||||
{ |
||||
readonly MetadataReader metadata; |
||||
readonly UserStringHandle handle; |
||||
|
||||
public int Offset => metadata.GetHeapOffset(handle); |
||||
|
||||
public int Length => metadata.GetUserString(handle).Length; |
||||
|
||||
public string Value => metadata.GetUserString(handle); |
||||
|
||||
public UserStringHeapEntry(MetadataReader metadata, UserStringHandle handle) |
||||
{ |
||||
this.metadata = metadata; |
||||
this.handle = handle; |
||||
} |
||||
} |
||||
|
||||
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||
{ |
||||
language.WriteCommentLine(output, "UserString Heap"); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,68 @@
@@ -0,0 +1,68 @@
|
||||
// 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.
|
||||
|
||||
using System; |
||||
using System.Reflection.Metadata; |
||||
using System.Reflection.Metadata.Ecma335; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Threading; |
||||
|
||||
using ICSharpCode.Decompiler.Metadata; |
||||
using ICSharpCode.ILSpy.TextView; |
||||
using ICSharpCode.ILSpy.TreeNodes; |
||||
using ICSharpCode.ILSpy.ViewModels; |
||||
using ICSharpCode.TreeView; |
||||
|
||||
namespace ICSharpCode.ILSpy.Metadata |
||||
{ |
||||
internal abstract class MetadataHeapTreeNode : ILSpyTreeNode |
||||
{ |
||||
protected PEFile module; |
||||
protected MetadataReader metadata; |
||||
protected int scrollTarget; |
||||
|
||||
public HandleKind Kind { get; } |
||||
|
||||
public MetadataHeapTreeNode(HandleKind kind, PEFile module, MetadataReader metadata) |
||||
{ |
||||
this.module = module; |
||||
this.Kind = kind; |
||||
this.metadata = metadata; |
||||
} |
||||
|
||||
internal void ScrollTo(Handle handle) |
||||
{ |
||||
//this.scrollTarget = MetadataTokens.GetHeapOffset((EntityHandle)handle);
|
||||
} |
||||
|
||||
protected void ScrollItemIntoView(DataGrid view, object item) |
||||
{ |
||||
view.Loaded += View_Loaded; |
||||
view.Dispatcher.BeginInvoke((Action)(() => view.SelectItem(item)), DispatcherPriority.Background); |
||||
} |
||||
|
||||
private void View_Loaded(object sender, System.Windows.RoutedEventArgs e) |
||||
{ |
||||
DataGrid view = (DataGrid)sender; |
||||
var sv = view.FindVisualChild<ScrollViewer>(); |
||||
sv.ScrollToVerticalOffset(scrollTarget - 1); |
||||
view.Loaded -= View_Loaded; |
||||
this.scrollTarget = default; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,132 @@
@@ -0,0 +1,132 @@
|
||||
// Copyright (c) 2021 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.
|
||||
|
||||
using System.Collections.Generic; |
||||
using System.Reflection.Metadata.Ecma335; |
||||
|
||||
using ICSharpCode.Decompiler; |
||||
using ICSharpCode.Decompiler.Metadata; |
||||
using ICSharpCode.ILSpy.Options; |
||||
using ICSharpCode.ILSpy.TreeNodes; |
||||
using ICSharpCode.ILSpy.ViewModels; |
||||
|
||||
namespace ICSharpCode.ILSpy.Metadata |
||||
{ |
||||
class MetadataTablesTreeNode : ILSpyTreeNode |
||||
{ |
||||
private PEFile module; |
||||
|
||||
public MetadataTablesTreeNode(PEFile module) |
||||
{ |
||||
this.module = module; |
||||
this.LazyLoading = true; |
||||
} |
||||
|
||||
public override object Text => "Tables"; |
||||
|
||||
public override object Icon => Images.Literal; |
||||
|
||||
protected override void LoadChildren() |
||||
{ |
||||
if (ShowTable(TableIndex.Module)) |
||||
this.Children.Add(new ModuleTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.TypeRef)) |
||||
this.Children.Add(new TypeRefTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.TypeDef)) |
||||
this.Children.Add(new TypeDefTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.Field)) |
||||
this.Children.Add(new FieldTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.MethodDef)) |
||||
this.Children.Add(new MethodTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.Param)) |
||||
this.Children.Add(new ParamTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.InterfaceImpl)) |
||||
this.Children.Add(new InterfaceImplTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.MemberRef)) |
||||
this.Children.Add(new MemberRefTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.Constant)) |
||||
this.Children.Add(new ConstantTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.CustomAttribute)) |
||||
this.Children.Add(new CustomAttributeTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.FieldMarshal)) |
||||
this.Children.Add(new FieldMarshalTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.DeclSecurity)) |
||||
this.Children.Add(new DeclSecurityTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.ClassLayout)) |
||||
this.Children.Add(new ClassLayoutTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.FieldLayout)) |
||||
this.Children.Add(new FieldLayoutTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.StandAloneSig)) |
||||
this.Children.Add(new StandAloneSigTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.EventMap)) |
||||
this.Children.Add(new EventMapTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.Event)) |
||||
this.Children.Add(new EventTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.PropertyMap)) |
||||
this.Children.Add(new PropertyMapTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.Property)) |
||||
this.Children.Add(new PropertyTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.MethodSemantics)) |
||||
this.Children.Add(new MethodSemanticsTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.MethodImpl)) |
||||
this.Children.Add(new MethodImplTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.ModuleRef)) |
||||
this.Children.Add(new ModuleRefTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.TypeSpec)) |
||||
this.Children.Add(new TypeSpecTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.ImplMap)) |
||||
this.Children.Add(new ImplMapTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.FieldRva)) |
||||
this.Children.Add(new FieldRVATableTreeNode(module)); |
||||
if (ShowTable(TableIndex.Assembly)) |
||||
this.Children.Add(new AssemblyTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.AssemblyRef)) |
||||
this.Children.Add(new AssemblyRefTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.File)) |
||||
this.Children.Add(new FileTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.ExportedType)) |
||||
this.Children.Add(new ExportedTypeTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.ManifestResource)) |
||||
this.Children.Add(new ManifestResourceTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.NestedClass)) |
||||
this.Children.Add(new NestedClassTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.GenericParam)) |
||||
this.Children.Add(new GenericParamTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.MethodSpec)) |
||||
this.Children.Add(new MethodSpecTableTreeNode(module)); |
||||
if (ShowTable(TableIndex.GenericParamConstraint)) |
||||
this.Children.Add(new GenericParamConstraintTableTreeNode(module)); |
||||
|
||||
bool ShowTable(TableIndex table) => !DisplaySettingsPanel.CurrentDisplaySettings.HideEmptyMetadataTables || module.Metadata.GetTableRowCount(table) > 0; |
||||
|
||||
} |
||||
|
||||
public override bool View(TabPageModel tabPage) |
||||
{ |
||||
tabPage.Title = Text.ToString(); |
||||
tabPage.SupportsLanguageSwitching = false; |
||||
|
||||
return false; |
||||
} |
||||
|
||||
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||
{ |
||||
language.WriteCommentLine(output, "Metadata Tables"); |
||||
} |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,149 @@
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0"?> |
||||
<SyntaxDefinition name="C#" extensions=".cs" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008"> |
||||
<!-- This is a variant of the AvalonEdit C# highlighting that has several constructs disabled. |
||||
The disabled constructs (e.g. contextual keywords) are highlighted using the CSharpLanguage.HighlightingTokenWriter instead. |
||||
--> |
||||
|
||||
<!-- The named colors 'Comment' and 'String' are used in SharpDevelop to detect if a line is inside a multiline string/comment --> |
||||
<Color name="Comment" foreground="#FF57A64A" exampleText="// comment" /> |
||||
<Color name="String" foreground="#FFD69D85" exampleText="string text = "Hello, World!""/> |
||||
<Color name="StringInterpolation" foreground="#FFffd68f" exampleText="string text = $"Hello, {name}!""/> |
||||
<Color name="Char" foreground="#FFD69D85" exampleText="char linefeed = '\n';"/> |
||||
<Color name="Preprocessor" foreground="#FF9B9B9B" exampleText="#region Title"/> |
||||
<Color name="Punctuation" foreground="White" exampleText="a(b.c);"/> |
||||
<Color name="ValueTypeKeywords" foreground="#FF00A0FF" exampleText="bool b = true;"/> |
||||
<Color name="ReferenceTypeKeywords" foreground="#FF559CD6" exampleText="object o;"/> |
||||
<Color name="NumberLiteral" foreground="#FFb5cea8" exampleText="3.1415f"/> |
||||
<Color name="ThisOrBaseReference" foreground="#FF3a6a9b" exampleText="this.Do(); base.Do();"/> |
||||
<Color name="NullOrValueKeywords" foreground="#FF559CD6" exampleText="if (value == null)"/> |
||||
<Color name="Keywords" foreground="#FFd8a0df" exampleText="if (a) {} else {}"/> |
||||
<Color name="GotoKeywords" foreground="#FFd8a0df" exampleText="continue; return null;"/> |
||||
<Color name="QueryKeywords" foreground="#FFd8a0df" exampleText="var a = from x in y select z;"/> |
||||
<Color name="ExceptionKeywords" foreground="#FFd8a0df" exampleText="try {} catch {} finally {}"/> |
||||
<Color name="CheckedKeyword" foreground="#FF559CD6" exampleText="checked {}"/> |
||||
<Color name="UnsafeKeywords" foreground="#FF559CD6" exampleText="unsafe { fixed (..) {} }"/> |
||||
<Color name="OperatorKeywords" foreground="#FFD69D85" exampleText="public static implicit operator..."/> |
||||
<Color name="ParameterModifiers" foreground="#FF559CD6" exampleText="(ref int a, params int[] b)"/> |
||||
<Color name="Modifiers" foreground="#FF559CD6" exampleText="static readonly int a;"/> |
||||
<Color name="Visibility" foreground="#FF559CD6" exampleText="public override void ToString();"/> |
||||
<Color name="NamespaceKeywords" foreground="#FF559CD6" exampleText="namespace A.B { using System; }"/> |
||||
<Color name="GetSetAddRemove" foreground="#FF559CD6" exampleText="int Prop { get; set; }"/> |
||||
<Color name="TrueFalse" foreground="#FF00A0FF" exampleText="b = false; a = true;"/> |
||||
<Color name="TypeKeywords" foreground="#FF559CD6" exampleText="if (x is int) { a = x as int; type = typeof(int); size = sizeof(int); c = new object(); }"/> |
||||
<Color name="AttributeKeywords" foreground="#FFD69D85" exampleText="[assembly: AssemblyVersion("1.0.0.*")]" /> |
||||
|
||||
<!-- Colors used for semantic highlighting --> |
||||
<Color name="ReferenceTypes" foreground="#569CD6" exampleText="System.#{#Uri#}# uri;"/> |
||||
<Color name="InterfaceTypes" foreground="#569CD6" exampleText="System.#{#IDisposable#}# obj;"/> |
||||
<Color name="TypeParameters" foreground="#569CD6" exampleText="class MyList<#{#T#}#> { }"/> |
||||
<Color name="DelegateTypes" foreground="#569CD6" exampleText="System.#{#Action#}#; action;"/> |
||||
<Color name="ValueTypes" fontWeight="bold" foreground="#569CD6" exampleText="System.#{#DateTime#}# date;"/> |
||||
<Color name="EnumTypes" fontWeight="bold" foreground="#569CD6" exampleText="System.#{#ConsoleKey#}# key;"/> |
||||
<Color name="MethodCall" foreground="#FFdcdcaa" fontWeight="bold" exampleText="o.#{#ToString#}#();"/> |
||||
<Color name="FieldAccess" fontStyle="italic" exampleText="return this.#{#name#}#;"/> |
||||
<Color name="InactiveCode" foreground="Gray" exampleText="#{#Deactivated by #if#}#"/> |
||||
<Color name="SemanticError" foreground="DarkRed" exampleText="o.#{#MissingMethod#}#()"/> |
||||
|
||||
<Property name="DocCommentMarker" value="///" /> |
||||
|
||||
<RuleSet name="CommentMarkerSet"> |
||||
<Keywords fontWeight="bold" foreground="Red"> |
||||
<Word>TODO</Word> |
||||
<Word>FIXME</Word> |
||||
</Keywords> |
||||
<Keywords fontWeight="bold" foreground="#E0E000"> |
||||
<Word>HACK</Word> |
||||
<Word>UNDONE</Word> |
||||
</Keywords> |
||||
</RuleSet> |
||||
|
||||
<!-- This is the main ruleset. --> |
||||
<RuleSet> |
||||
<Span color="Preprocessor"> |
||||
<Begin>\#</Begin> |
||||
<RuleSet name="PreprocessorSet"> |
||||
<Span> <!-- preprocessor directives that allow comments --> |
||||
<Begin fontWeight="bold"> |
||||
(define|undef|if|elif|else|endif|line)\b |
||||
</Begin> |
||||
<RuleSet> |
||||
<Span color="Comment" ruleSet="CommentMarkerSet"> |
||||
<Begin>//</Begin> |
||||
</Span> |
||||
</RuleSet> |
||||
</Span> |
||||
<Span> <!-- preprocessor directives that don't allow comments --> |
||||
<Begin fontWeight="bold"> |
||||
(region|endregion|error|warning|pragma)\b |
||||
</Begin> |
||||
</Span> |
||||
</RuleSet> |
||||
</Span> |
||||
|
||||
<Span color="Comment"> |
||||
<Begin color="XmlDoc/DocComment">///(?!/)</Begin> |
||||
<RuleSet> |
||||
<Import ruleSet="XmlDoc/DocCommentSet"/> |
||||
<Import ruleSet="CommentMarkerSet"/> |
||||
</RuleSet> |
||||
</Span> |
||||
|
||||
<Span color="Comment" ruleSet="CommentMarkerSet"> |
||||
<Begin>//</Begin> |
||||
</Span> |
||||
|
||||
<Span color="Comment" ruleSet="CommentMarkerSet" multiline="true"> |
||||
<Begin>/\*</Begin> |
||||
<End>\*/</End> |
||||
</Span> |
||||
|
||||
<Span color="String"> |
||||
<Begin>"</Begin> |
||||
<End>"</End> |
||||
<RuleSet> |
||||
<!-- span for escape sequences --> |
||||
<Span begin="\\" end="."/> |
||||
</RuleSet> |
||||
</Span> |
||||
|
||||
<Span color="Char"> |
||||
<Begin>'</Begin> |
||||
<End>'</End> |
||||
<RuleSet> |
||||
<!-- span for escape sequences --> |
||||
<Span begin="\\" end="."/> |
||||
</RuleSet> |
||||
</Span> |
||||
|
||||
<Span color="String" multiline="true"> |
||||
<Begin color="String">@"</Begin> |
||||
<End>"</End> |
||||
<RuleSet> |
||||
<!-- span for escape sequences --> |
||||
<Span begin='""' end=""/> |
||||
</RuleSet> |
||||
</Span> |
||||
|
||||
<Span color="String"> |
||||
<Begin>\$"</Begin> |
||||
<End>"</End> |
||||
<RuleSet> |
||||
<!-- span for escape sequences --> |
||||
<Span begin="\\" end="."/> |
||||
<Span begin="\{\{" end=""/> |
||||
<!-- string interpolation --> |
||||
<Span begin="{" end="}" color="StringInterpolation" ruleSet=""/> |
||||
</RuleSet> |
||||
</Span> |
||||
|
||||
<!-- Digits --> |
||||
<Rule color="NumberLiteral"> |
||||
\b0[xX][0-9a-fA-F]+ # hex number |
||||
| |
||||
( \b\d+(\.[0-9]+)? #number with optional floating point |
||||
| \.[0-9]+ #or just starting with floating point |
||||
) |
||||
([eE][+-]?[0-9]+)? # optional exponent |
||||
</Rule> |
||||
</RuleSet> |
||||
</SyntaxDefinition> |
@ -0,0 +1,530 @@
@@ -0,0 +1,530 @@
|
||||
<SyntaxDefinition name="ILAsm" extensions=".il" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008"> |
||||
<Color name="Comment" foreground="#FF57A64A" exampleText="// comment" /> |
||||
<Color name="String" foreground="#FFD69D85" exampleText=""Hello, World!"" /> |
||||
<Color name="Instructions" foreground="#FFD69D85" exampleText="nop;" /> |
||||
<Color name="Keywords" foreground="#FFD69D85" fontWeight="bold" exampleText="true" /> |
||||
<Color name="Directives" foreground="#FF57A64A" fontWeight="bold" exampleText=".class" /> |
||||
<Color name="Security" foreground="#FF559CD6" exampleText="request" /> |
||||
|
||||
<RuleSet ignoreCase="false"> |
||||
<Keywords color="Instructions"> |
||||
<Word>nop</Word> |
||||
<Word>break</Word> |
||||
<Word>ldarg.0</Word> |
||||
<Word>ldarg.1</Word> |
||||
<Word>ldarg.2</Word> |
||||
<Word>ldarg.3</Word> |
||||
<Word>ldloc.0</Word> |
||||
<Word>ldloc.1</Word> |
||||
<Word>ldloc.2</Word> |
||||
<Word>ldloc.3</Word> |
||||
<Word>stloc.0</Word> |
||||
<Word>stloc.1</Word> |
||||
<Word>stloc.2</Word> |
||||
<Word>stloc.3</Word> |
||||
<Word>ldarg.s</Word> |
||||
<Word>ldarga.s</Word> |
||||
<Word>starg.s</Word> |
||||
<Word>ldloc.s</Word> |
||||
<Word>ldloca.s</Word> |
||||
<Word>stloc.s</Word> |
||||
<Word>ldnull</Word> |
||||
<Word>ldc.i4.m1</Word> |
||||
<Word>ldc.i4.0</Word> |
||||
<Word>ldc.i4.1</Word> |
||||
<Word>ldc.i4.2</Word> |
||||
<Word>ldc.i4.3</Word> |
||||
<Word>ldc.i4.4</Word> |
||||
<Word>ldc.i4.5</Word> |
||||
<Word>ldc.i4.6</Word> |
||||
<Word>ldc.i4.7</Word> |
||||
<Word>ldc.i4.8</Word> |
||||
<Word>ldc.i4.s</Word> |
||||
<Word>ldc.i4</Word> |
||||
<Word>ldc.i8</Word> |
||||
<Word>ldc.r4</Word> |
||||
<Word>ldc.r8</Word> |
||||
<Word>dup</Word> |
||||
<Word>pop</Word> |
||||
<Word>jmp</Word> |
||||
<Word>call</Word> |
||||
<Word>calli</Word> |
||||
<Word>ret</Word> |
||||
<Word>br.s</Word> |
||||
<Word>brfalse.s</Word> |
||||
<Word>brtrue.s</Word> |
||||
<Word>beq.s</Word> |
||||
<Word>bge.s</Word> |
||||
<Word>bgt.s</Word> |
||||
<Word>ble.s</Word> |
||||
<Word>blt.s</Word> |
||||
<Word>bne.un.s</Word> |
||||
<Word>bge.un.s</Word> |
||||
<Word>bgt.un.s</Word> |
||||
<Word>ble.un.s</Word> |
||||
<Word>blt.un.s</Word> |
||||
<Word>br</Word> |
||||
<Word>brfalse</Word> |
||||
<Word>brtrue</Word> |
||||
<Word>beq</Word> |
||||
<Word>bge</Word> |
||||
<Word>bgt</Word> |
||||
<Word>ble</Word> |
||||
<Word>blt</Word> |
||||
<Word>bne.un</Word> |
||||
<Word>bge.un</Word> |
||||
<Word>bgt.un</Word> |
||||
<Word>ble.un</Word> |
||||
<Word>blt.un</Word> |
||||
<Word>switch</Word> |
||||
<Word>ldind.i1</Word> |
||||
<Word>ldind.u1</Word> |
||||
<Word>ldind.i2</Word> |
||||
<Word>ldind.u2</Word> |
||||
<Word>ldind.i4</Word> |
||||
<Word>ldind.u4</Word> |
||||
<Word>ldind.i8</Word> |
||||
<Word>ldind.i</Word> |
||||
<Word>ldind.r4</Word> |
||||
<Word>ldind.r8</Word> |
||||
<Word>ldind.ref</Word> |
||||
<Word>stind.ref</Word> |
||||
<Word>stind.i1</Word> |
||||
<Word>stind.i2</Word> |
||||
<Word>stind.i4</Word> |
||||
<Word>stind.i8</Word> |
||||
<Word>stind.r4</Word> |
||||
<Word>stind.r8</Word> |
||||
<Word>add</Word> |
||||
<Word>sub</Word> |
||||
<Word>mul</Word> |
||||
<Word>div</Word> |
||||
<Word>div.un</Word> |
||||
<Word>rem</Word> |
||||
<Word>rem.un</Word> |
||||
<Word>and</Word> |
||||
<Word>or</Word> |
||||
<Word>xor</Word> |
||||
<Word>shl</Word> |
||||
<Word>shr</Word> |
||||
<Word>shr.un</Word> |
||||
<Word>neg</Word> |
||||
<Word>not</Word> |
||||
<Word>conv.i1</Word> |
||||
<Word>conv.i2</Word> |
||||
<Word>conv.i4</Word> |
||||
<Word>conv.i8</Word> |
||||
<Word>conv.r4</Word> |
||||
<Word>conv.r8</Word> |
||||
<Word>conv.u4</Word> |
||||
<Word>conv.u8</Word> |
||||
<Word>callvirt</Word> |
||||
<Word>cpobj</Word> |
||||
<Word>ldobj</Word> |
||||
<Word>ldstr</Word> |
||||
<Word>newobj</Word> |
||||
<Word>castclass</Word> |
||||
<Word>isinst</Word> |
||||
<Word>conv.r.un</Word> |
||||
<Word>unbox</Word> |
||||
<Word>throw</Word> |
||||
<Word>ldfld</Word> |
||||
<Word>ldflda</Word> |
||||
<Word>stfld</Word> |
||||
<Word>ldsfld</Word> |
||||
<Word>ldsflda</Word> |
||||
<Word>stsfld</Word> |
||||
<Word>stobj</Word> |
||||
<Word>conv.ovf.i1.un</Word> |
||||
<Word>conv.ovf.i2.un</Word> |
||||
<Word>conv.ovf.i4.un</Word> |
||||
<Word>conv.ovf.i8.un</Word> |
||||
<Word>conv.ovf.u1.un</Word> |
||||
<Word>conv.ovf.u2.un</Word> |
||||
<Word>conv.ovf.u4.un</Word> |
||||
<Word>conv.ovf.u8.un</Word> |
||||
<Word>conv.ovf.i.un</Word> |
||||
<Word>conv.ovf.u.un</Word> |
||||
<Word>box</Word> |
||||
<Word>newarr</Word> |
||||
<Word>ldlen</Word> |
||||
<Word>ldelema</Word> |
||||
<Word>ldelem</Word> |
||||
<Word>ldelem.i1</Word> |
||||
<Word>ldelem.u1</Word> |
||||
<Word>ldelem.i2</Word> |
||||
<Word>ldelem.u2</Word> |
||||
<Word>ldelem.i4</Word> |
||||
<Word>ldelem.u4</Word> |
||||
<Word>ldelem.i8</Word> |
||||
<Word>ldelem.i</Word> |
||||
<Word>ldelem.r4</Word> |
||||
<Word>ldelem.r8</Word> |
||||
<Word>ldelem.ref</Word> |
||||
<Word>stelem</Word> |
||||
<Word>stelem.i</Word> |
||||
<Word>stelem.i1</Word> |
||||
<Word>stelem.i2</Word> |
||||
<Word>stelem.i4</Word> |
||||
<Word>stelem.i8</Word> |
||||
<Word>stelem.r4</Word> |
||||
<Word>stelem.r8</Word> |
||||
<Word>stelem.ref</Word> |
||||
<Word>conv.ovf.i1</Word> |
||||
<Word>conv.ovf.u1</Word> |
||||
<Word>conv.ovf.i2</Word> |
||||
<Word>conv.ovf.u2</Word> |
||||
<Word>conv.ovf.i4</Word> |
||||
<Word>conv.ovf.u4</Word> |
||||
<Word>conv.ovf.i8</Word> |
||||
<Word>conv.ovf.u8</Word> |
||||
<Word>refanyval</Word> |
||||
<Word>ckfinite</Word> |
||||
<Word>mkrefany</Word> |
||||
<Word>ldtoken</Word> |
||||
<Word>conv.u2</Word> |
||||
<Word>conv.u1</Word> |
||||
<Word>conv.i</Word> |
||||
<Word>conv.ovf.i</Word> |
||||
<Word>conv.ovf.u</Word> |
||||
<Word>add.ovf</Word> |
||||
<Word>add.ovf.un</Word> |
||||
<Word>mul.ovf</Word> |
||||
<Word>mul.ovf.un</Word> |
||||
<Word>sub.ovf</Word> |
||||
<Word>sub.ovf.un</Word> |
||||
<Word>endfinally</Word> |
||||
<Word>leave</Word> |
||||
<Word>leave.s</Word> |
||||
<Word>stind.i</Word> |
||||
<Word>conv.u</Word> |
||||
<Word>prefix7</Word> |
||||
<Word>prefix6</Word> |
||||
<Word>prefix5</Word> |
||||
<Word>prefix4</Word> |
||||
<Word>prefix3</Word> |
||||
<Word>prefix2</Word> |
||||
<Word>prefix1</Word> |
||||
<Word>prefixref</Word> |
||||
<Word>arglist</Word> |
||||
<Word>ceq</Word> |
||||
<Word>cgt</Word> |
||||
<Word>cgt.un</Word> |
||||
<Word>clt</Word> |
||||
<Word>clt.un</Word> |
||||
<Word>ldftn</Word> |
||||
<Word>ldvirtftn</Word> |
||||
<Word>ldarg</Word> |
||||
<Word>ldarga</Word> |
||||
<Word>starg</Word> |
||||
<Word>ldloc</Word> |
||||
<Word>ldloca</Word> |
||||
<Word>stloc</Word> |
||||
<Word>localloc</Word> |
||||
<Word>endfilter</Word> |
||||
<Word>unaligned.</Word> |
||||
<Word>volatile.</Word> |
||||
<Word>tail.</Word> |
||||
<Word>initobj</Word> |
||||
<Word>cpblk</Word> |
||||
<Word>initblk</Word> |
||||
<Word>rethrow</Word> |
||||
<Word>sizeof</Word> |
||||
<Word>refanytype</Word> |
||||
<Word>illegal</Word> |
||||
<Word>endmac</Word> |
||||
<Word>brnull</Word> |
||||
<Word>brnull.s</Word> |
||||
<Word>brzero</Word> |
||||
<Word>brzero.s</Word> |
||||
<Word>brinst</Word> |
||||
<Word>brinst.s</Word> |
||||
<Word>ldind.u8</Word> |
||||
<Word>ldelem.u8</Word> |
||||
<Word>ldc.i4.M1</Word> |
||||
<Word>endfault</Word> |
||||
</Keywords> |
||||
<Keywords color="Keywords"> |
||||
<Word>void</Word> |
||||
<Word>bool</Word> |
||||
<Word>char</Word> |
||||
<Word>wchar</Word> |
||||
<Word>int</Word> |
||||
<Word>int8</Word> |
||||
<Word>int16</Word> |
||||
<Word>int32</Word> |
||||
<Word>int64</Word> |
||||
<Word>uint8</Word> |
||||
<Word>uint16</Word> |
||||
<Word>uint32</Word> |
||||
<Word>uint64</Word> |
||||
<Word>float</Word> |
||||
<Word>float32</Word> |
||||
<Word>float64</Word> |
||||
<Word>refany</Word> |
||||
<Word>typedref</Word> |
||||
<Word>object</Word> |
||||
<Word>string</Word> |
||||
<Word>native</Word> |
||||
<Word>unsigned</Word> |
||||
<Word>value</Word> |
||||
<Word>valuetype</Word> |
||||
<Word>class</Word> |
||||
<Word>const</Word> |
||||
<Word>vararg</Word> |
||||
<Word>default</Word> |
||||
<Word>stdcall</Word> |
||||
<Word>thiscall</Word> |
||||
<Word>fastcall</Word> |
||||
<Word>unmanaged</Word> |
||||
<Word>not_in_gc_heap</Word> |
||||
<Word>beforefieldinit</Word> |
||||
<Word>instance</Word> |
||||
<Word>filter</Word> |
||||
<Word>catch</Word> |
||||
<Word>static</Word> |
||||
<Word>public</Word> |
||||
<Word>private</Word> |
||||
<Word>synchronized</Word> |
||||
<Word>interface</Word> |
||||
<Word>extends</Word> |
||||
<Word>implements</Word> |
||||
<Word>handler</Word> |
||||
<Word>finally</Word> |
||||
<Word>fault</Word> |
||||
<Word>to</Word> |
||||
<Word>abstract</Word> |
||||
<Word>auto</Word> |
||||
<Word>sequential</Word> |
||||
<Word>explicit</Word> |
||||
<Word>wrapper</Word> |
||||
<Word>ansi</Word> |
||||
<Word>unicode</Word> |
||||
<Word>autochar</Word> |
||||
<Word>import</Word> |
||||
<Word>enum</Word> |
||||
<Word>virtual</Word> |
||||
<Word>notremotable</Word> |
||||
<Word>special</Word> |
||||
<Word>il</Word> |
||||
<Word>cil</Word> |
||||
<Word>optil</Word> |
||||
<Word>managed</Word> |
||||
<Word>preservesig</Word> |
||||
<Word>runtime</Word> |
||||
<Word>method</Word> |
||||
<Word>field</Word> |
||||
<Word>bytearray</Word> |
||||
<Word>final</Word> |
||||
<Word>sealed</Word> |
||||
<Word>specialname</Word> |
||||
<Word>family</Word> |
||||
<Word>assembly</Word> |
||||
<Word>famandassem</Word> |
||||
<Word>famorassem</Word> |
||||
<Word>privatescope</Word> |
||||
<Word>nested</Word> |
||||
<Word>hidebysig</Word> |
||||
<Word>newslot</Word> |
||||
<Word>rtspecialname</Word> |
||||
<Word>pinvokeimpl</Word> |
||||
<Word>unmanagedexp</Word> |
||||
<Word>reqsecobj</Word> |
||||
<Word>.ctor</Word> |
||||
<Word>.cctor</Word> |
||||
<Word>initonly</Word> |
||||
<Word>literal</Word> |
||||
<Word>notserialized</Word> |
||||
<Word>forwardref</Word> |
||||
<Word>internalcall</Word> |
||||
<Word>noinlining</Word> |
||||
<Word>aggressiveinlining</Word> |
||||
<Word>nomangle</Word> |
||||
<Word>lasterr</Word> |
||||
<Word>winapi</Word> |
||||
<Word>cdecl</Word> |
||||
<Word>stdcall</Word> |
||||
<Word>thiscall</Word> |
||||
<Word>fastcall</Word> |
||||
<Word>as</Word> |
||||
<Word>pinned</Word> |
||||
<Word>modreq</Word> |
||||
<Word>modopt</Word> |
||||
<Word>serializable</Word> |
||||
<Word>at</Word> |
||||
<Word>tls</Word> |
||||
<Word>true</Word> |
||||
<Word>false</Word> |
||||
<Word>strict</Word> |
||||
</Keywords> |
||||
<Keywords color="Directives"> |
||||
<Word>.class</Word> |
||||
<Word>.namespace</Word> |
||||
<Word>.method</Word> |
||||
<Word>.field</Word> |
||||
<Word>.emitbyte</Word> |
||||
<Word>.try</Word> |
||||
<Word>.maxstack</Word> |
||||
<Word>.locals</Word> |
||||
<Word>.entrypoint</Word> |
||||
<Word>.zeroinit</Word> |
||||
<Word>.pdirect</Word> |
||||
<Word>.data</Word> |
||||
<Word>.event</Word> |
||||
<Word>.addon</Word> |
||||
<Word>.removeon</Word> |
||||
<Word>.fire</Word> |
||||
<Word>.other</Word> |
||||
<Word>protected</Word> |
||||
<Word>.property</Word> |
||||
<Word>.set</Word> |
||||
<Word>.get</Word> |
||||
<Word>default</Word> |
||||
<Word>.import</Word> |
||||
<Word>.permission</Word> |
||||
<Word>.permissionset</Word> |
||||
<Word>.line</Word> |
||||
<Word>.language</Word> |
||||
<Word>#line</Word> |
||||
</Keywords> |
||||
<Keywords color="Security"> |
||||
<Word>request</Word> |
||||
<Word>demand</Word> |
||||
<Word>assert</Word> |
||||
<Word>deny</Word> |
||||
<Word>permitonly</Word> |
||||
<Word>linkcheck</Word> |
||||
<Word>inheritcheck</Word> |
||||
<Word>reqmin</Word> |
||||
<Word>reqopt</Word> |
||||
<Word>reqrefuse</Word> |
||||
<Word>prejitgrant</Word> |
||||
<Word>prejitdeny</Word> |
||||
<Word>noncasdemand</Word> |
||||
<Word>noncaslinkdemand</Word> |
||||
<Word>noncasinheritance</Word> |
||||
</Keywords> |
||||
<Keywords color="Directives"> |
||||
<!-- custom value specifier --> |
||||
<Word>.custom</Word> |
||||
<!-- IL method attribute --> |
||||
<Word>init</Word> |
||||
<!-- Class layout directives --> |
||||
<Word>.size</Word> |
||||
<Word>.pack</Word> |
||||
<!-- Manifest-related keywords --> |
||||
<Word>.file</Word> |
||||
<Word>nometadata</Word> |
||||
<Word>.hash</Word> |
||||
<Word>.assembly</Word> |
||||
<Word>implicitcom</Word> |
||||
<Word>noappdomain</Word> |
||||
<Word>noprocess</Word> |
||||
<Word>nomachine</Word> |
||||
<Word>.publickey</Word> |
||||
<Word>.publickeytoken</Word> |
||||
<Word>algorithm</Word> |
||||
<Word>.ver</Word> |
||||
<Word>.locale</Word> |
||||
<Word>extern</Word> |
||||
<Word>.export</Word> |
||||
<Word>.manifestres</Word> |
||||
<Word>.mresource</Word> |
||||
<Word>.localized</Word> |
||||
|
||||
<!-- Field marshaling keywords --> |
||||
<Word>.module</Word> |
||||
<Word>marshal</Word> |
||||
<Word>custom</Word> |
||||
<Word>sysstring</Word> |
||||
<Word>fixed</Word> |
||||
<Word>variant</Word> |
||||
<Word>currency</Word> |
||||
<Word>syschar</Word> |
||||
<Word>decimal</Word> |
||||
<Word>date</Word> |
||||
<Word>bstr</Word> |
||||
<Word>tbstr</Word> |
||||
<Word>lpstr</Word> |
||||
<Word>lpwstr</Word> |
||||
<Word>lptstr</Word> |
||||
<Word>objectref</Word> |
||||
<Word>iunknown</Word> |
||||
<Word>idispatch</Word> |
||||
<Word>struct</Word> |
||||
<Word>safearray</Word> |
||||
<Word>byvalstr</Word> |
||||
<Word>lpvoid</Word> |
||||
<Word>any</Word> |
||||
<Word>array</Word> |
||||
<Word>lpstruct</Word> |
||||
|
||||
<!-- VTable fixup keywords --> |
||||
<Word>.vtfixup</Word> |
||||
<Word>fromunmanaged</Word> |
||||
<Word>callmostderived</Word> |
||||
<Word>.vtentry</Word> |
||||
|
||||
<!-- Parameter attributes --> |
||||
<Word>in</Word> |
||||
<Word>out</Word> |
||||
<Word>opt</Word> |
||||
<Word>lcid</Word> |
||||
<Word>retval</Word> |
||||
<Word>.param</Word> |
||||
|
||||
<!-- Method implementations --> |
||||
<Word>.override</Word> |
||||
<Word>with</Word> |
||||
|
||||
<!-- VariantType keywords --> |
||||
<Word>null</Word> |
||||
<Word>error</Word> |
||||
<Word>hresult</Word> |
||||
<Word>carray</Word> |
||||
<Word>userdefined</Word> |
||||
<Word>record</Word> |
||||
<Word>filetime</Word> |
||||
<Word>blob</Word> |
||||
<Word>stream</Word> |
||||
<Word>storage</Word> |
||||
<Word>streamed_object</Word> |
||||
<Word>stored_object</Word> |
||||
<Word>blob_object</Word> |
||||
<Word>cf</Word> |
||||
<Word>clsid</Word> |
||||
<Word>vector</Word> |
||||
|
||||
<!-- Null reference keyword for InitOpt --> |
||||
<Word>nullref</Word> |
||||
|
||||
<!-- Header flags keywords --> |
||||
<Word>.subsystem</Word> |
||||
<Word>.corflags</Word> |
||||
<Word>.stackreserve</Word> |
||||
<Word>alignment</Word> |
||||
<Word>.imagebase</Word> |
||||
</Keywords> |
||||
<Span color="Comment" ruleSet="CommentMarkerSet"> |
||||
<Begin>//</Begin> |
||||
</Span> |
||||
<Span color="Comment" ruleSet="CommentMarkerSet"> |
||||
<Begin>/\*</Begin> |
||||
<End>\*/</End> |
||||
</Span> |
||||
<Span color="String"> |
||||
<Begin>"</Begin> |
||||
<End>"</End> |
||||
</Span> |
||||
</RuleSet> |
||||
<RuleSet name="CommentMarkerSet" ignoreCase="false"> |
||||
<Keywords foreground="#FFFF0000" fontWeight="bold"> |
||||
<Word>TODO</Word> |
||||
<Word>FIXME</Word> |
||||
</Keywords> |
||||
<Keywords foreground="#EEE0E000" fontWeight="bold"> |
||||
<Word>HACK</Word> |
||||
<Word>UNDONE</Word> |
||||
</Keywords> |
||||
</RuleSet> |
||||
</SyntaxDefinition> |
@ -0,0 +1,63 @@
@@ -0,0 +1,63 @@
|
||||
<SyntaxDefinition name="XML" extensions=".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;.booproj;.build;.xfrm;.targets;.xaml;.xpt;.xft;.map;.wsdl;.disco;.ps1xml;.nuspec" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008"> |
||||
<Color foreground="Green" name="Comment" exampleText="<!-- comment -->" /> |
||||
<Color foreground="#FFD69D85" name="CData" exampleText="<![CDATA[data]]>" /> |
||||
<Color foreground="#FFD69D85" name="DocType" exampleText="<!DOCTYPE rootElement>" /> |
||||
<Color foreground="#FFD69D85" name="XmlDeclaration" exampleText='<?xml version="1.0"?>' /> |
||||
<Color foreground="#FFD69D85" name="XmlTag" exampleText='<tag attribute="value" />' /> |
||||
<Color foreground="#FF00A0FF" name="AttributeName" exampleText='<tag attribute="value" />' /> |
||||
<Color foreground="#FFD69D85" name="AttributeValue" exampleText='<tag attribute="value" />' /> |
||||
<Color foreground="#FFd8a0df" name="Entity" exampleText="index.aspx?a=1&amp;b=2" /> |
||||
<Color foreground="#FF559CD6" name="BrokenEntity" exampleText="index.aspx?a=1&b=2" /> |
||||
|
||||
<RuleSet> |
||||
<Span color="Comment" multiline="true"> |
||||
<Begin><!--</Begin> |
||||
<End>--></End> |
||||
</Span> |
||||
<Span color="CData" multiline="true"> |
||||
<Begin><!\[CDATA\[</Begin> |
||||
<End>]]></End> |
||||
</Span> |
||||
<Span color="DocType" multiline="true"> |
||||
<Begin><!DOCTYPE</Begin> |
||||
<End>></End> |
||||
</Span> |
||||
<Span color="XmlDeclaration" multiline="true"> |
||||
<Begin><\?</Begin> |
||||
<End>\?></End> |
||||
</Span> |
||||
<Span color="XmlTag" multiline="true"> |
||||
<Begin><</Begin> |
||||
<End>></End> |
||||
<RuleSet> |
||||
<!-- Treat the position before '<' as end, as that's not a valid character |
||||
in attribute names and indicates the user forgot a closing quote. --> |
||||
<Span color="AttributeValue" multiline="true" ruleSet="EntitySet"> |
||||
<Begin>"</Begin> |
||||
<End>"|(?=<)</End> |
||||
</Span> |
||||
<Span color="AttributeValue" multiline="true" ruleSet="EntitySet"> |
||||
<Begin>'</Begin> |
||||
<End>'|(?=<)</End> |
||||
</Span> |
||||
<Rule color="AttributeName">[\d\w_\-\.]+(?=(\s*=))</Rule> |
||||
<Rule color="AttributeValue">=</Rule> |
||||
</RuleSet> |
||||
</Span> |
||||
<Import ruleSet="EntitySet"/> |
||||
</RuleSet> |
||||
|
||||
<RuleSet name="EntitySet"> |
||||
<Rule color="Entity"> |
||||
& |
||||
[\w\d\#]+ |
||||
; |
||||
</Rule> |
||||
|
||||
<Rule color="BrokenEntity"> |
||||
& |
||||
[\w\d\#]* |
||||
#missing ; |
||||
</Rule> |
||||
</RuleSet> |
||||
</SyntaxDefinition> |
@ -0,0 +1,63 @@
@@ -0,0 +1,63 @@
|
||||
<SyntaxDefinition name="XML" extensions=".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;.booproj;.build;.xfrm;.targets;.xaml;.xpt;.xft;.map;.wsdl;.disco;.ps1xml;.nuspec" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008"> |
||||
<Color foreground="Green" name="Comment" exampleText="<!-- comment -->" /> |
||||
<Color foreground="Blue" name="CData" exampleText="<![CDATA[data]]>" /> |
||||
<Color foreground="Blue" name="DocType" exampleText="<!DOCTYPE rootElement>" /> |
||||
<Color foreground="Blue" name="XmlDeclaration" exampleText='<?xml version="1.0"?>' /> |
||||
<Color foreground="DarkMagenta" name="XmlTag" exampleText='<tag attribute="value" />' /> |
||||
<Color foreground="Red" name="AttributeName" exampleText='<tag attribute="value" />' /> |
||||
<Color foreground="Blue" name="AttributeValue" exampleText='<tag attribute="value" />' /> |
||||
<Color foreground="Teal" name="Entity" exampleText="index.aspx?a=1&amp;b=2" /> |
||||
<Color foreground="Olive" name="BrokenEntity" exampleText="index.aspx?a=1&b=2" /> |
||||
|
||||
<RuleSet> |
||||
<Span color="Comment" multiline="true"> |
||||
<Begin><!--</Begin> |
||||
<End>--></End> |
||||
</Span> |
||||
<Span color="CData" multiline="true"> |
||||
<Begin><!\[CDATA\[</Begin> |
||||
<End>]]></End> |
||||
</Span> |
||||
<Span color="DocType" multiline="true"> |
||||
<Begin><!DOCTYPE</Begin> |
||||
<End>></End> |
||||
</Span> |
||||
<Span color="XmlDeclaration" multiline="true"> |
||||
<Begin><\?</Begin> |
||||
<End>\?></End> |
||||
</Span> |
||||
<Span color="XmlTag" multiline="true"> |
||||
<Begin><</Begin> |
||||
<End>></End> |
||||
<RuleSet> |
||||
<!-- Treat the position before '<' as end, as that's not a valid character |
||||
in attribute names and indicates the user forgot a closing quote. --> |
||||
<Span color="AttributeValue" multiline="true" ruleSet="EntitySet"> |
||||
<Begin>"</Begin> |
||||
<End>"|(?=<)</End> |
||||
</Span> |
||||
<Span color="AttributeValue" multiline="true" ruleSet="EntitySet"> |
||||
<Begin>'</Begin> |
||||
<End>'|(?=<)</End> |
||||
</Span> |
||||
<Rule color="AttributeName">[\d\w_\-\.]+(?=(\s*=))</Rule> |
||||
<Rule color="AttributeValue">=</Rule> |
||||
</RuleSet> |
||||
</Span> |
||||
<Import ruleSet="EntitySet"/> |
||||
</RuleSet> |
||||
|
||||
<RuleSet name="EntitySet"> |
||||
<Rule color="Entity"> |
||||
& |
||||
[\w\d\#]+ |
||||
; |
||||
</Rule> |
||||
|
||||
<Rule color="BrokenEntity"> |
||||
& |
||||
[\w\d\#]* |
||||
#missing ; |
||||
</Rule> |
||||
</RuleSet> |
||||
</SyntaxDefinition> |
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
using System; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
|
||||
namespace ICSharpCode.ILSpy |
||||
{ |
||||
internal class ThemeManager |
||||
{ |
||||
private bool _isDarkMode; |
||||
private readonly ResourceDictionary _themeDictionaryContainer = new ResourceDictionary(); |
||||
|
||||
|
||||
public static readonly ThemeManager Current = new ThemeManager(); |
||||
|
||||
private ThemeManager() |
||||
{ |
||||
Application.Current.Resources.MergedDictionaries.Add(_themeDictionaryContainer); |
||||
} |
||||
|
||||
public bool IsDarkMode { |
||||
get => _isDarkMode; |
||||
set { |
||||
_isDarkMode = value; |
||||
|
||||
_themeDictionaryContainer.MergedDictionaries.Clear(); |
||||
|
||||
string theme = value ? "Dark" : "Light"; |
||||
|
||||
_themeDictionaryContainer.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri($"themes/{theme}Theme.xaml", UriKind.Relative) }); |
||||
} |
||||
} |
||||
|
||||
public Button CreateButton() |
||||
{ |
||||
return new Button { |
||||
Style = CreateButtonStyle() |
||||
}; |
||||
} |
||||
|
||||
public Style CreateButtonStyle() |
||||
{ |
||||
return new Style(typeof(Button), (Style)Application.Current.FindResource(typeof(Button))); |
||||
} |
||||
|
||||
public Style CreateToolBarButtonStyle() |
||||
{ |
||||
return new Style(typeof(Button), (Style)Application.Current.FindResource(ToolBar.ButtonStyleKey)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:styles="urn:TomsToolbox.Wpf.Styles" |
||||
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.themes"> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="/AvalonDock.Themes.VS2013;component/darktheme.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
|
||||
<Color x:Key="{x:Static SystemColors.ControlLightLightColorKey}">#333337</Color> |
||||
<Color x:Key="{x:Static SystemColors.ControlLightColorKey}">#464646</Color> |
||||
<Color x:Key="{x:Static SystemColors.ControlColorKey}">#252526</Color> |
||||
<Color x:Key="{x:Static SystemColors.ControlDarkColorKey}">#686868</Color> |
||||
<Color x:Key="{x:Static SystemColors.ControlDarkDarkColorKey}">#9E9E9E</Color> |
||||
<Color x:Key="{x:Static SystemColors.ControlTextColorKey}">#F1F1F1</Color> |
||||
<Color x:Key="{x:Static SystemColors.GrayTextColorKey}">#999999</Color> |
||||
<Color x:Key="{x:Static SystemColors.HighlightColorKey}">#3399FF</Color> |
||||
<Color x:Key="{x:Static SystemColors.HighlightTextColorKey}">#FFFFFF</Color> |
||||
<Color x:Key="{x:Static SystemColors.InfoTextColorKey}">#F1F1F1</Color> |
||||
<Color x:Key="{x:Static SystemColors.InfoColorKey}">#333337</Color> |
||||
<Color x:Key="{x:Static SystemColors.MenuColorKey}">#1B1B1C</Color> |
||||
<Color x:Key="{x:Static SystemColors.MenuBarColorKey}">#1B1B1C</Color> |
||||
<Color x:Key="{x:Static SystemColors.MenuTextColorKey}">#F1F1F1</Color> |
||||
<Color x:Key="{x:Static SystemColors.WindowColorKey}">#333337</Color> |
||||
<Color x:Key="{x:Static SystemColors.WindowTextColorKey}">#F1F1F1</Color> |
||||
<Color x:Key="{x:Static SystemColors.ActiveCaptionColorKey}">#2D2D30</Color> |
||||
<Color x:Key="{x:Static SystemColors.ActiveBorderColorKey}">#007ACC</Color> |
||||
<Color x:Key="{x:Static SystemColors.ActiveCaptionTextColorKey}">#F1F1F1</Color> |
||||
<Color x:Key="{x:Static SystemColors.InactiveCaptionColorKey}">#2D2D30</Color> |
||||
<Color x:Key="{x:Static SystemColors.InactiveBorderColorKey}">#434346</Color> |
||||
<Color x:Key="{x:Static SystemColors.InactiveCaptionTextColorKey}">#F1F1F1</Color> |
||||
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlLightLightBrushKey}" Color="#333337" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlLightBrushKey}" Color="#464646" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#252526" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkBrushKey}" Color="#686868" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#9E9E9E" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="#F1F1F1" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.GrayTextBrushKey}" Color="#999999" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#3399FF" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#FFFFFF" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.InfoTextBrushKey}" Color="#F1F1F1" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.InfoBrushKey}" Color="#333337" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.MenuBrushKey}" Color="#1B1B1C" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.MenuBarBrushKey}" Color="#1B1B1C" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.MenuTextBrushKey}" Color="#F1F1F1" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="#333337" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.WindowTextBrushKey}" Color="#F1F1F1" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ActiveCaptionBrushKey}" Color="#2D2D30" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ActiveBorderBrushKey}" Color="#007ACC" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ActiveCaptionTextBrushKey}" Color="#F1F1F1" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveCaptionBrushKey}" Color="#2D2D30" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveBorderBrushKey}" Color="#434346" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveCaptionTextBrushKey}" Color="#F1F1F1" /> |
||||
|
||||
<SolidColorBrush x:Key="{x:Static styles:ResourceKeys.BorderBrush}" Color="#9E9E9E" /> |
||||
<SolidColorBrush x:Key="{x:Static styles:ResourceKeys.DisabledBrush}" Color="#2D2D30" /> |
||||
<Color x:Key="{x:Static themes:ResourceKeys.TextMarkerBackgroundColor}">MediumVioletRed</Color> |
||||
<SolidColorBrush x:Key="{x:Static themes:ResourceKeys.LinkTextForegroundBrush}">CornflowerBlue</SolidColorBrush> |
||||
|
||||
</ResourceDictionary> |
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:styles="urn:TomsToolbox.Wpf.Styles"> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="/AvalonDock.Themes.VS2013;component/lighttheme.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
|
||||
<Color x:Key="{x:Static SystemColors.ControlLightLightColorKey}">#FCFCFC</Color> |
||||
<Color x:Key="{x:Static SystemColors.ControlLightColorKey}">#D8D8E0</Color> |
||||
<Color x:Key="{x:Static SystemColors.ControlColorKey}">#F5F5F5</Color> |
||||
<Color x:Key="{x:Static SystemColors.ControlDarkColorKey}">#C2C3C9</Color> |
||||
<Color x:Key="{x:Static SystemColors.ControlDarkDarkColorKey}">#686868</Color> |
||||
<Color x:Key="{x:Static SystemColors.ControlTextColorKey}">#1E1E1E</Color> |
||||
<Color x:Key="{x:Static SystemColors.GrayTextColorKey}">#717171</Color> |
||||
<Color x:Key="{x:Static SystemColors.HighlightColorKey}">#3399FF</Color> |
||||
<Color x:Key="{x:Static SystemColors.HighlightTextColorKey}">#FFFFFF</Color> |
||||
<Color x:Key="{x:Static SystemColors.MenuColorKey}">#F6F6F6</Color> |
||||
<Color x:Key="{x:Static SystemColors.MenuBarColorKey}">#F6F6F6</Color> |
||||
<Color x:Key="{x:Static SystemColors.MenuTextColorKey}">#1E1E1E</Color> |
||||
<Color x:Key="{x:Static SystemColors.WindowColorKey}">#FFFFFF</Color> |
||||
<Color x:Key="{x:Static SystemColors.WindowTextColorKey}">#1E1E1E</Color> |
||||
<Color x:Key="{x:Static SystemColors.ActiveCaptionColorKey}">#EEEEF2</Color> |
||||
<Color x:Key="{x:Static SystemColors.ActiveBorderColorKey}">#007ACC</Color> |
||||
<Color x:Key="{x:Static SystemColors.ActiveCaptionTextColorKey}">#1E1E1E</Color> |
||||
<Color x:Key="{x:Static SystemColors.InactiveCaptionColorKey}">#EEEEF2</Color> |
||||
<Color x:Key="{x:Static SystemColors.InactiveBorderColorKey}">#CCCEDB</Color> |
||||
<Color x:Key="{x:Static SystemColors.InactiveCaptionTextColorKey}">#1E1E1E</Color> |
||||
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlLightLightBrushKey}" Color="#FCFCFC" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlLightBrushKey}" Color="#D8D8E0" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#F5F5F5" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkBrushKey}" Color="#C2C3C9" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#686868" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="#1E1E1E" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.GrayTextBrushKey}" Color="#717171" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#3399FF" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#FFFFFF" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.MenuBrushKey}" Color="#F6F6F6" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.MenuBarBrushKey}" Color="#F6F6F6" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.MenuTextBrushKey}" Color="#1E1E1E" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="#FFFFFF" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.WindowTextBrushKey}" Color="#1E1E1E" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ActiveCaptionBrushKey}" Color="#EEEEF2" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ActiveBorderBrushKey}" Color="#007ACC" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ActiveCaptionTextBrushKey}" Color="#1E1E1E" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveCaptionBrushKey}" Color="#EEEEF2" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveBorderBrushKey}" Color="#CCCEDB" /> |
||||
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveCaptionTextBrushKey}" Color="#1E1E1E" /> |
||||
|
||||
<SolidColorBrush x:Key="{x:Static styles:ResourceKeys.BorderBrush}" Color="#686868" /> |
||||
<SolidColorBrush x:Key="{x:Static styles:ResourceKeys.DisabledBrush}" Color="#EEEEF2" /> |
||||
</ResourceDictionary> |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
using System.Windows; |
||||
|
||||
namespace ICSharpCode.ILSpy.themes |
||||
{ |
||||
public static class ResourceKeys |
||||
{ |
||||
public static ResourceKey TextMarkerBackgroundColor = new ComponentResourceKey(typeof(ResourceKeys), "TextMarkerBackgroundColor"); |
||||
public static ResourceKey TextMarkerDefinitionBackgroundColor = new ComponentResourceKey(typeof(ResourceKeys), "TextMarkerDefinitionBackgroundColor"); |
||||
public static ResourceKey LinkTextForegroundBrush = new ComponentResourceKey(typeof(ResourceKeys), "LinkTextForegroundBrush"); |
||||
} |
||||
} |
@ -0,0 +1,331 @@
@@ -0,0 +1,331 @@
|
||||
{ |
||||
"cells": [ |
||||
{ |
||||
"cell_type": "markdown", |
||||
"metadata": {}, |
||||
"source": [ |
||||
"Load the NuGet package and print out the version to make sure we are using the latest and greatest" |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "code", |
||||
"execution_count": 1, |
||||
"metadata": { |
||||
"dotnet_interactive": { |
||||
"language": "csharp" |
||||
} |
||||
}, |
||||
"source": [ |
||||
"#r \"nuget: ICSharpCode.Decompiler, 7.0.0.6372-preview3\"\n", |
||||
"\n", |
||||
"using System.Reflection.Metadata;\n", |
||||
"using ICSharpCode.Decompiler;\n", |
||||
"using ICSharpCode.Decompiler.CSharp;\n", |
||||
"using ICSharpCode.Decompiler.Metadata;\n", |
||||
"using ICSharpCode.Decompiler.TypeSystem;\n", |
||||
"\n", |
||||
"Console.WriteLine(typeof(FullTypeName).Assembly.GetName());" |
||||
], |
||||
"outputs": [ |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "ICSharpCode.Decompiler, Version=7.0.0.6372, Culture=neutral, PublicKeyToken=d4bfe873e7598c49\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "markdown", |
||||
"metadata": {}, |
||||
"source": [ |
||||
"You must have compiled **frontends.sln** first (run “dotnet build” in ICSharpCode.Decompiler.PowerShell folder). Make sure to modify **basePath** to your repository path." |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "code", |
||||
"execution_count": 1, |
||||
"metadata": { |
||||
"dotnet_interactive": { |
||||
"language": "csharp" |
||||
} |
||||
}, |
||||
"source": [ |
||||
"const string basePath = @\"D:\\GitWorkspace\\ILSpy\\\";\n", |
||||
"string testAssemblyPath = basePath + @\"ICSharpCode.Decompiler.PowerShell\\bin\\Release\\netstandard2.0\\ICSharpCode.Decompiler.dll\";\n", |
||||
"\n", |
||||
"var decompiler = new CSharpDecompiler(testAssemblyPath, new DecompilerSettings());" |
||||
], |
||||
"outputs": [] |
||||
}, |
||||
{ |
||||
"cell_type": "markdown", |
||||
"metadata": {}, |
||||
"source": [ |
||||
"Get the count of types in this module" |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "code", |
||||
"execution_count": 1, |
||||
"metadata": { |
||||
"dotnet_interactive": { |
||||
"language": "csharp" |
||||
} |
||||
}, |
||||
"source": [ |
||||
"var types = decompiler.TypeSystem.MainModule.TypeDefinitions;\n", |
||||
"Console.WriteLine(types.Count());" |
||||
], |
||||
"outputs": [ |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "1459\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "markdown", |
||||
"metadata": {}, |
||||
"source": [ |
||||
"Decompile a known type (as a whole)" |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "code", |
||||
"execution_count": 1, |
||||
"metadata": { |
||||
"dotnet_interactive": { |
||||
"language": "csharp" |
||||
} |
||||
}, |
||||
"source": [ |
||||
"// ICSharpCode.Decompiler.Util.Empty<T> -> translates to `n, where n is the # of generic parameters\n", |
||||
"var nameOfGenericType = new FullTypeName(\"ICSharpCode.Decompiler.Util.Empty`1\");\n", |
||||
"Console.WriteLine(decompiler.DecompileTypeAsString(nameOfGenericType));" |
||||
], |
||||
"outputs": [ |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "using System;\r\n\r\nnamespace ICSharpCode.Decompiler.Util\r\n{\r\n\tpublic static class Empty<T>\r\n\t{\r\n\t\tpublic static readonly T[] Array = System.Array.Empty<T>();\r\n\t}\r\n}\r\n\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "markdown", |
||||
"metadata": {}, |
||||
"source": [ |
||||
"If you want to decompile one single member (sample: first method)" |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "code", |
||||
"execution_count": 1, |
||||
"metadata": { |
||||
"dotnet_interactive": { |
||||
"language": "csharp" |
||||
} |
||||
}, |
||||
"source": [ |
||||
"var nameOfUniResolver = new FullTypeName(\"ICSharpCode.Decompiler.Metadata.UniversalAssemblyResolver\");\n", |
||||
"ITypeDefinition typeInfo = decompiler.TypeSystem.FindType(nameOfUniResolver).GetDefinition();\n", |
||||
"var tokenOfFirstMethod = typeInfo.Methods.First().MetadataToken;\n", |
||||
"Console.WriteLine(decompiler.DecompileAsString(tokenOfFirstMethod));" |
||||
], |
||||
"outputs": [ |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "using System;\r\n\r\nstatic UniversalAssemblyResolver()\r\n{\r\n\tgac_paths = GetGacPaths();\r\n\tZeroVersion = new Version(0, 0, 0, 0);\r\n\tif (Type.GetType(\"Mono.Runtime\") != null)\r\n\t{\r\n\t\tdecompilerRuntime = DecompilerRuntime.Mono;\r\n\t}\r\n\telse if (typeof(object).Assembly.GetName().Name == \"System.Private.CoreLib\")\r\n\t{\r\n\t\tdecompilerRuntime = DecompilerRuntime.NETCoreApp;\r\n\t}\r\n\telse if (Environment.OSVersion.Platform == PlatformID.Unix)\r\n\t{\r\n\t\tdecompilerRuntime = DecompilerRuntime.Mono;\r\n\t}\r\n}\r\n\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "markdown", |
||||
"metadata": {}, |
||||
"source": [ |
||||
"If you need access to low-level metadata tables" |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "code", |
||||
"execution_count": 1, |
||||
"metadata": { |
||||
"dotnet_interactive": { |
||||
"language": "csharp" |
||||
} |
||||
}, |
||||
"source": [ |
||||
"ITypeDefinition type = decompiler.TypeSystem.FindType(nameOfUniResolver).GetDefinition();\n", |
||||
"var module = type.ParentModule.PEFile;" |
||||
], |
||||
"outputs": [] |
||||
}, |
||||
{ |
||||
"cell_type": "markdown", |
||||
"metadata": {}, |
||||
"source": [ |
||||
"Get the child namespaces" |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "code", |
||||
"execution_count": 1, |
||||
"metadata": { |
||||
"dotnet_interactive": { |
||||
"language": "csharp" |
||||
} |
||||
}, |
||||
"source": [ |
||||
"var icsdns = decompiler.TypeSystem.RootNamespace;\n", |
||||
"foreach (var cn in icsdns.ChildNamespaces) Console.WriteLine(cn.FullName);" |
||||
], |
||||
"outputs": [ |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "Microsoft\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
}, |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "System\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
}, |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "LightJson\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
}, |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "Humanizer\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
}, |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "ICSharpCode\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
}, |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "FxResources\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
}, |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "Internal\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
}, |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "Windows\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
}, |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "MS\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "markdown", |
||||
"metadata": {}, |
||||
"source": [ |
||||
"Get types in a single namespace" |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "code", |
||||
"execution_count": 1, |
||||
"metadata": { |
||||
"dotnet_interactive": { |
||||
"language": "csharp" |
||||
} |
||||
}, |
||||
"source": [ |
||||
"var typesInNamespace = icsdns.ChildNamespaces.First(cn => cn.FullName == \"LightJson\").Types;\n", |
||||
"Console.WriteLine(typesInNamespace.First().FullTypeName);" |
||||
], |
||||
"outputs": [ |
||||
{ |
||||
"output_type": "execute_result", |
||||
"data": { |
||||
"text/plain": "LightJson.JsonArray\r\n" |
||||
}, |
||||
"execution_count": 1, |
||||
"metadata": {} |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
"cell_type": "code", |
||||
"execution_count": 1, |
||||
"metadata": { |
||||
"dotnet_interactive": { |
||||
"language": "csharp" |
||||
} |
||||
}, |
||||
"source": [ |
||||
"" |
||||
], |
||||
"outputs": [] |
||||
} |
||||
], |
||||
"metadata": { |
||||
"kernelspec": { |
||||
"display_name": ".NET (C#)", |
||||
"language": "C#", |
||||
"name": ".net-csharp" |
||||
}, |
||||
"language_info": { |
||||
"file_extension": ".cs", |
||||
"mimetype": "text/x-csharp", |
||||
"name": "C#", |
||||
"pygments_lexer": "csharp", |
||||
"version": "8.0" |
||||
} |
||||
}, |
||||
"nbformat": 4, |
||||
"nbformat_minor": 4 |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue