mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
Replace the comment-line dump in ResourcesFileTreeNode.Decompile with two AvaloniaUI DataGrid views — ResourceStringTable for string entries (Name/Value) and ResourceObjectTable for everything else (Name/Value/Type, including ResourceSerializedObject and primitive-typed values). otherEntries collection plus SerializedObjectRepresentation row model are added on the node so ResX export (next commit) can iterate the same shape. Test pins the behaviour: a synthetic .resources stream produces three UIElements (Save button + two grids) where the prior implementation produced one. Assisted-by: Claude:claude-opus-4-7:Claude Codepull/3755/head
6 changed files with 248 additions and 5 deletions
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="240" |
||||
x:Class="ILSpy.Controls.ResourceObjectTable"> |
||||
<Grid Margin="5,0,0,0" RowDefinitions="Auto,*"> |
||||
<TextBlock Grid.Row="0" |
||||
Text="Other entries:" |
||||
FontFamily="Segoe UI" |
||||
FontWeight="Bold" |
||||
FontSize="14" |
||||
Margin="0,4,0,4" /> |
||||
<DataGrid Grid.Row="1" |
||||
Name="EntriesGrid" |
||||
AutoGenerateColumns="False" |
||||
IsReadOnly="True" |
||||
CanUserResizeColumns="True" |
||||
GridLinesVisibility="Horizontal" |
||||
HeadersVisibility="Column" |
||||
RowHeight="22" |
||||
x:CompileBindings="False"> |
||||
<DataGrid.Columns> |
||||
<DataGridTextColumn Header="Name" |
||||
Width="220" |
||||
Binding="{Binding Key}" |
||||
CanUserSort="True" /> |
||||
<DataGridTextColumn Header="Value" |
||||
Width="*" |
||||
Binding="{Binding Value}" |
||||
CanUserSort="True" /> |
||||
<DataGridTextColumn Header="Type" |
||||
Width="240" |
||||
Binding="{Binding Type}" |
||||
CanUserSort="True" /> |
||||
</DataGrid.Columns> |
||||
</DataGrid> |
||||
</Grid> |
||||
</UserControl> |
||||
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2026 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 global::Avalonia.Controls; |
||||
|
||||
namespace ILSpy.Controls |
||||
{ |
||||
/// <summary>
|
||||
/// Tabular view of non-string entries inside a <c>.resources</c> file (ints, doubles,
|
||||
/// serialized objects, …). Used as an inline UI element from
|
||||
/// <see cref="TreeNodes.ResourcesFileTreeNode"/>'s decompilation output.
|
||||
/// </summary>
|
||||
public partial class ResourceObjectTable : UserControl |
||||
{ |
||||
public ResourceObjectTable() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
public ResourceObjectTable(IEnumerable<SerializedObjectRepresentation> entries) : this() |
||||
{ |
||||
EntriesGrid.ItemsSource = entries; |
||||
} |
||||
} |
||||
|
||||
/// <summary>Row model for <see cref="ResourceObjectTable"/>.</summary>
|
||||
public sealed class SerializedObjectRepresentation |
||||
{ |
||||
public SerializedObjectRepresentation(string key, string type, string value) |
||||
{ |
||||
Key = key; |
||||
Type = type; |
||||
Value = value; |
||||
} |
||||
|
||||
public string Key { get; } |
||||
public string Type { get; } |
||||
public string Value { get; } |
||||
} |
||||
} |
||||
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="240" |
||||
x:Class="ILSpy.Controls.ResourceStringTable"> |
||||
<Grid Margin="5,0,0,0" RowDefinitions="Auto,*"> |
||||
<TextBlock Grid.Row="0" |
||||
Text="String table:" |
||||
FontFamily="Segoe UI" |
||||
FontWeight="Bold" |
||||
FontSize="14" |
||||
Margin="0,4,0,4" /> |
||||
<DataGrid Grid.Row="1" |
||||
Name="EntriesGrid" |
||||
AutoGenerateColumns="False" |
||||
IsReadOnly="True" |
||||
CanUserResizeColumns="True" |
||||
GridLinesVisibility="Horizontal" |
||||
HeadersVisibility="Column" |
||||
RowHeight="22" |
||||
x:CompileBindings="False"> |
||||
<DataGrid.Columns> |
||||
<DataGridTextColumn Header="Name" |
||||
Width="220" |
||||
Binding="{Binding Key}" |
||||
CanUserSort="True" /> |
||||
<DataGridTextColumn Header="Value" |
||||
Width="*" |
||||
Binding="{Binding Value}" |
||||
CanUserSort="True" /> |
||||
</DataGrid.Columns> |
||||
</DataGrid> |
||||
</Grid> |
||||
</UserControl> |
||||
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2026 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 global::Avalonia.Controls; |
||||
|
||||
namespace ILSpy.Controls |
||||
{ |
||||
/// <summary>
|
||||
/// Tabular view of the string entries inside a <c>.resources</c> file. Used as an inline
|
||||
/// UI element from <see cref="TreeNodes.ResourcesFileTreeNode"/>'s decompilation output.
|
||||
/// </summary>
|
||||
public partial class ResourceStringTable : UserControl |
||||
{ |
||||
public ResourceStringTable() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
public ResourceStringTable(IEnumerable<KeyValuePair<string, string>> entries) : this() |
||||
{ |
||||
EntriesGrid.ItemsSource = entries; |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue