Start work on WPF project
This commit is contained in:
parent
c22be10b74
commit
abf1fbf167
10
ReCodeItGUI_WPF/App.xaml
Normal file
10
ReCodeItGUI_WPF/App.xaml
Normal file
@ -0,0 +1,10 @@
|
||||
<Application x:Class="ReCodeItGUI_WPF.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:ReCodeItGUI_WPF"
|
||||
xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
</Application.Resources>
|
||||
</Application>
|
14
ReCodeItGUI_WPF/App.xaml.cs
Normal file
14
ReCodeItGUI_WPF/App.xaml.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Windows;
|
||||
|
||||
namespace ReCodeItGUI_WPF
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
|
||||
}
|
10
ReCodeItGUI_WPF/AssemblyInfo.cs
Normal file
10
ReCodeItGUI_WPF/AssemblyInfo.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
156
ReCodeItGUI_WPF/Helpers/GUIExtentions.cs
Normal file
156
ReCodeItGUI_WPF/Helpers/GUIExtentions.cs
Normal file
@ -0,0 +1,156 @@
|
||||
using Microsoft.Win32;
|
||||
using ReCodeIt.Models;
|
||||
using System.Windows.Controls;
|
||||
using Xceed.Wpf.Toolkit;
|
||||
|
||||
namespace ReCodeItGUI_WPF.Helpers
|
||||
{
|
||||
internal static class GUIExtentions
|
||||
{
|
||||
#region EXT_METHODS
|
||||
|
||||
public static void AddToListView(this ListView listView, TextBox textBox)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(textBox.Text) && !listView.Items.Contains(textBox.Text))
|
||||
{
|
||||
listView.Items.Add(textBox.Text);
|
||||
textBox.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveSelectedItem(this ListView listView)
|
||||
{
|
||||
if (listView.SelectedItem != null)
|
||||
{
|
||||
listView.Items.RemoveAt(listView.SelectedIndex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion EXT_METHODS
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string result of the dialog
|
||||
/// </summary>
|
||||
/// <returns>Path if valid, or empty string</returns>
|
||||
public static string OpenFileDialog(bool dll = false)
|
||||
{
|
||||
var title = dll ? "Select a DLL File" : "Select a Json File";
|
||||
|
||||
var defaultExt = dll ? ".dll" : ".jsonc";
|
||||
|
||||
var dllFilter = "DLL files (*.dll)|*.dll|All files (*.*)|*.*";
|
||||
var jsonFilter = "JSON/JSONC files (*.json;*.jsonc)|*.json;*.jsonc|All files (*.*)|*.*";
|
||||
|
||||
var openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Title = title;
|
||||
openFileDialog.Filter = dll ? dllFilter : jsonFilter;
|
||||
openFileDialog.DefaultExt = defaultExt;
|
||||
|
||||
bool? result = openFileDialog.ShowDialog();
|
||||
|
||||
if (result == true)
|
||||
{
|
||||
return openFileDialog.FileName;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public static RemapModel CreateRemapFromGui(this MainWindow window)
|
||||
{
|
||||
var model = new RemapModel
|
||||
{
|
||||
NewTypeName = window.NewTypeNameTextBox.Text,
|
||||
OriginalTypeName = window.OriginalTypeNameTextBox.Text ?? string.Empty,
|
||||
UseForceRename = (bool)window.UseForceRenameCheckbox.IsChecked,
|
||||
SearchParams = new SearchParams
|
||||
{
|
||||
IsPublic = window.IsPublicComboBox.IsComboEnabled(),
|
||||
IsAbstract = window.IsAbstractComboBox.IsComboEnabled(),
|
||||
IsInterface = window.IsInterfaceComboBox.IsComboEnabled(),
|
||||
IsEnum = window.IsEnumComboBox.IsComboEnabled(),
|
||||
IsNested = window.IsNestedComboBox.IsComboEnabled(),
|
||||
IsSealed = window.IsSealedComboBox.IsComboEnabled(),
|
||||
HasAttribute = window.HasAttributeComboBox.IsComboEnabled(),
|
||||
IsDerived = window.IsDerivedComboBox.IsComboEnabled(),
|
||||
HasGenericParameters = window.HasAttributeComboBox.IsComboEnabled(),
|
||||
ParentName = window.ParentNameTextBox.GetText(),
|
||||
MatchBaseClass = window.IncludeBaseClassTextBox.GetText(),
|
||||
IgnoreBaseClass = window.IgnoreBaseClassTextBox.GetText(),
|
||||
ConstructorParameterCount = window.CtorParamCountUpDown.GetValIfEnabled(window.CtorCheckbox),
|
||||
MethodCount = window.MethodCountUpDown.GetValIfEnabled(window.MethodCheckbox),
|
||||
FieldCount = window.FieldCountUpDown.GetValIfEnabled(window.FieldCountCheckbox),
|
||||
PropertyCount = window.PropertyCountUpDown.GetValIfEnabled(window.PropertyCountCheckBox),
|
||||
NestedTypeCount = window.NestedTypeCountUpDown.GetValIfEnabled(window.NestedTypeCountCheckBox),
|
||||
IncludeMethods = window.MethodIncludeListView.GetItems(),
|
||||
ExcludeMethods = window.MethodExcludeListView.GetItems(),
|
||||
IncludeFields = window.FieldIncludeListView.GetItems(),
|
||||
ExcludeFields = window.FieldExcludeListView.GetItems(),
|
||||
IncludeProperties = window.PropertyIncludeListBox.GetItems(),
|
||||
ExcludeProperties = window.PropertyExcludeListBox.GetItems(),
|
||||
IncludeNestedTypes = window.NestedTypeIncludeListView.GetItems(),
|
||||
ExcludeNestedTypes = window.NestedTypeExcludeListView.GetItems(),
|
||||
}
|
||||
};
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True or false if selected, otherwise null
|
||||
/// </summary>
|
||||
/// <param name="comboBox"></param>
|
||||
/// <returns></returns>
|
||||
public static bool? IsComboEnabled(this ComboBox comboBox)
|
||||
{
|
||||
if (bool.TryParse(comboBox.Text, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns the text in the box if exists, or null
|
||||
/// </summary>
|
||||
/// <param name="textBox"></param>
|
||||
/// <returns></returns>
|
||||
public static string? GetText(this TextBox textBox)
|
||||
{
|
||||
if (textBox.Text != string.Empty)
|
||||
{
|
||||
return textBox.Text;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int? GetValIfEnabled(this IntegerUpDown intUpDown, CheckBox cBox)
|
||||
{
|
||||
if ((bool)cBox.IsChecked)
|
||||
{
|
||||
return intUpDown.Value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts list view objects to string list
|
||||
/// </summary>
|
||||
/// <param name="listView"></param>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetItems(this ListView listView)
|
||||
{
|
||||
var tmp = new List<string>();
|
||||
|
||||
foreach (var item in listView.Items)
|
||||
{
|
||||
tmp.Add(item.ToString());
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
}
|
197
ReCodeItGUI_WPF/MainWindow.xaml
Normal file
197
ReCodeItGUI_WPF/MainWindow.xaml
Normal file
@ -0,0 +1,197 @@
|
||||
<Window x:Class="ReCodeItGUI_WPF.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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"
|
||||
xmlns:local="clr-namespace:ReCodeItGUI_WPF"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
mc:Ignorable="d"
|
||||
Title="ReCodeIt V0.1.0" Height="800" Width="1216" Background="#FF676464">
|
||||
<Canvas>
|
||||
<TabControl Height="784" Width="1216.2" Background="#FF595454" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<TabItem Header="Manual ReMapper">
|
||||
<TabItem.Background>
|
||||
<LinearGradientBrush EndPoint="0,1">
|
||||
<GradientStop Color="#FFF0F0F0" />
|
||||
<GradientStop Color="#FF474242" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</TabItem.Background>
|
||||
<Grid Background="#FF595454">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle HorizontalAlignment="Left" Height="228" Margin="374,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="813" />
|
||||
<Rectangle HorizontalAlignment="Left" Height="244" Margin="374,243,0,0" Stroke="Black" VerticalAlignment="Top" Width="405" />
|
||||
<Rectangle HorizontalAlignment="Left" Height="114" Margin="10,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="360" />
|
||||
<TextBox x:Name="NewTypeNameTextBox" HorizontalAlignment="Left" Margin="20,21,0,0" TextWrapping="Wrap" Text="New Type Name" VerticalAlignment="Top" Width="120" />
|
||||
<TextBox x:Name="OriginalTypeNameTextBox" HorizontalAlignment="Left" Margin="20,44,0,0" TextWrapping="Wrap" Text="Original Type Name" VerticalAlignment="Top" Width="120" />
|
||||
<Button x:Name="SaveRemapButton" Content="Save Remap" HorizontalAlignment="Left" Margin="276,22,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.492,0.856" Width="86" Click="SaveRemapButton_Click" />
|
||||
<Button x:Name="RemoveRemapButton" Content="Remove Remap" HorizontalAlignment="Left" Margin="276,47,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.492,0.856" />
|
||||
<Button x:Name="RunRemapButton" Content="Run Remap" HorizontalAlignment="Left" Margin="276,72,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.492,0.856" Width="86" />
|
||||
<CheckBox x:Name="UseForceRenameCheckbox" Content="Use Force Rename" HorizontalAlignment="Left" Margin="20,70,0,0" VerticalAlignment="Top" />
|
||||
<ComboBox x:Name="IsNestedComboBox" HorizontalAlignment="Left" Margin="378,42,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
||||
<ComboBoxItem Content="True" />
|
||||
<ComboBoxItem Content="False" />
|
||||
</ComboBox>
|
||||
<Label Content="General section" HorizontalAlignment="Left" Margin="377,13,0,0" VerticalAlignment="Top" />
|
||||
<ComboBox x:Name="IsPublicComboBox" HorizontalAlignment="Left" Margin="378,69,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
||||
<ComboBoxItem Content="True" />
|
||||
<ComboBoxItem Content="False" />
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="IsAbstractComboBox" HorizontalAlignment="Left" Margin="378,96,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
||||
<ComboBoxItem Content="True" />
|
||||
<ComboBoxItem Content="False" />
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="IsInterfaceComboBox" HorizontalAlignment="Left" Margin="570,42,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
||||
<ComboBoxItem Content="True" />
|
||||
<ComboBoxItem Content="False" />
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="IsSealedComboBox" HorizontalAlignment="Left" Margin="570,69,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
||||
<ComboBoxItem Content="True" />
|
||||
<ComboBoxItem Content="False" />
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="IsEnumComboBox" HorizontalAlignment="Left" Margin="570,96,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
||||
<ComboBoxItem Content="True" />
|
||||
<ComboBoxItem Content="False" />
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="HasAttributeComboBox" HorizontalAlignment="Left" Margin="768,44,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
||||
<ComboBoxItem Content="True" />
|
||||
<ComboBoxItem Content="False" />
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="IsDerivedComboBox" HorizontalAlignment="Left" Margin="768,71,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
||||
<ComboBoxItem Content="True" />
|
||||
<ComboBoxItem Content="False" />
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="HasGenericParamsComboBox" HorizontalAlignment="Left" Margin="768,98,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
||||
<ComboBoxItem Content="True" />
|
||||
<ComboBoxItem Content="False" />
|
||||
</ComboBox>
|
||||
<TextBox x:Name="ParentNameTextBox" HorizontalAlignment="Left" Margin="378,124,0,0" TextWrapping="Wrap" Text="Parent Name" VerticalAlignment="Top" Width="120" />
|
||||
<TextBox x:Name="IncludeBaseClassTextBox" HorizontalAlignment="Left" Margin="378,151,0,0" TextWrapping="Wrap" Text="Include base class" VerticalAlignment="Top" Width="120" />
|
||||
<TextBox x:Name="IgnoreBaseClassTextBox" HorizontalAlignment="Left" Margin="378,178,0,0" TextWrapping="Wrap" Text="Ignore base class" VerticalAlignment="Top" Width="120" />
|
||||
<xctk:IntegerUpDown x:Name="CtorParamCountUpDown" FormatString="N0" Value="0" Increment="1" Minimum="0" Maximum="40" Margin="378,206,756,528" />
|
||||
<xctk:IntegerUpDown x:Name="MethodCountUpDown" FormatString="N0" Value="0" Increment="1" Minimum="0" Maximum="40" Margin="480,338,654,396" />
|
||||
<CheckBox x:Name="CtorCheckbox" Content="Constructor Param Count" HorizontalAlignment="Left" Margin="444,209,0,0" VerticalAlignment="Top" />
|
||||
<CheckBox x:Name="MethodCheckbox" Content="Method Count" HorizontalAlignment="Left" Margin="479,320,0,0" VerticalAlignment="Top" />
|
||||
<ListView x:Name="MethodIncludeListView" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="378,261,732,283" Width="100" Height="212.06">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="Methods" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<ListView x:Name="MethodExcludeListView" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="676,262,434,282" Height="212.04" Width="100">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="Methods" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<TextBox x:Name="MethodTextBox" HorizontalAlignment="Left" Margin="480,263,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="193" />
|
||||
<Button x:Name="MethodIncludeButton" Content="Include" HorizontalAlignment="Left" Margin="480,283,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="MethodIncludeButton_Click" />
|
||||
<Button x:Name="MethodExcludeButton" Content="Exclude" HorizontalAlignment="Left" Margin="610,283,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="MethodExcludeButton_Click" />
|
||||
<Button x:Name="MethodRemoveButton" Content="Remove" HorizontalAlignment="Left" Margin="545,283,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="MethodRemoveButton_Click" />
|
||||
<Rectangle HorizontalAlignment="Left" Height="244" Margin="374,489,0,0" Stroke="Black" VerticalAlignment="Top" Width="405" />
|
||||
<xctk:IntegerUpDown x:Name="FieldCountUpDown" FormatString="N0" Value="0" Increment="1" Minimum="0" Maximum="40" Margin="480,597,654,136" />
|
||||
<CheckBox x:Name="FieldCountCheckbox" Content="Field Count" HorizontalAlignment="Left" Margin="479,579,0,0" VerticalAlignment="Top" />
|
||||
<ListView x:Name="FieldIncludeListView" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="377,517,733,27" Width="100" Height="212.04">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="Field" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<ListView x:Name="FieldExcludeListView" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="676,517,434,27" Height="212.04" Width="100">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="Field" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<TextBox x:Name="FieldTextBox" HorizontalAlignment="Left" Margin="480,518,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="193" />
|
||||
<Button x:Name="FieldIncludeButton" Content="Include" HorizontalAlignment="Left" Margin="480,541,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="FieldIncludeButton_Click" />
|
||||
<Button x:Name="FieldExcludeButton" Content="Exclude" HorizontalAlignment="Left" Margin="611,541,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="FieldExcludeButton_Click" />
|
||||
<Button x:Name="FieldRemoveButton" Content="Remove" HorizontalAlignment="Left" Margin="545,541,0,0" VerticalAlignment="Top" Width="64" Height="34" Click="FieldRemoveButton_Click" />
|
||||
<Rectangle HorizontalAlignment="Left" Height="244" Margin="783,489,0,0" Stroke="Black" VerticalAlignment="Top" Width="405" />
|
||||
<xctk:IntegerUpDown x:Name="PropertyCountUpDown" FormatString="N0" Value="0" Increment="1" Minimum="0" Maximum="40" Margin="889,601,245,133" />
|
||||
<CheckBox x:Name="PropertyCountCheckBox" Content="Property Count" HorizontalAlignment="Left" Margin="888,583,0,0" VerticalAlignment="Top" />
|
||||
<ListView x:Name="PropertyIncludeListBox" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="787,517,323,27" Width="100">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="Property" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<ListView x:Name="PropertyExcludeListBox" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="1084,518,26,26" Width="100">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="Property" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<TextBox x:Name="PropertyTextBox" HorizontalAlignment="Left" Margin="889,518,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="193" Height="19" />
|
||||
<Button x:Name="PropertyIncludeButton" Content="Include" HorizontalAlignment="Left" Margin="889,543,0,0" VerticalAlignment="Top" Height="34" Width="63" Click="PropertyIncludeButton_Click" />
|
||||
<Button x:Name="PropertyExcludeButton" Content="Exclude" HorizontalAlignment="Left" Margin="1020,542,0,0" VerticalAlignment="Top" Height="35" Width="63" Click="PropertyExcludeButton_Click" />
|
||||
<Button x:Name="PropertyRemoveButton" Content="Remove" HorizontalAlignment="Left" Margin="955,542,0,0" VerticalAlignment="Top" Height="35" Width="63" Click="PropertyRemoveButton_Click" />
|
||||
<Rectangle HorizontalAlignment="Left" Height="244" Margin="783,243,0,0" Stroke="Black" VerticalAlignment="Top" Width="405" />
|
||||
<xctk:IntegerUpDown x:Name="NestedTypeCountUpDown" FormatString="N0" Value="0" Increment="1" Minimum="0" Maximum="40" Margin="890,340,244,394" />
|
||||
<CheckBox x:Name="NestedTypeCountCheckBox" Content="Nested Type Count" HorizontalAlignment="Left" Margin="889,322,0,0" VerticalAlignment="Top" />
|
||||
<ListView x:Name="NestedTypeIncludeListView" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="786,261,324,283" Width="100" Height="212.04">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="Nested Type" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<ListView x:Name="NestedTypeExcludeListView" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="1085,260,25,284" Height="212.04" Width="100">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="Nested Type" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<TextBox x:Name="NestTypeTextBox" HorizontalAlignment="Left" Margin="890,261,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="193" />
|
||||
<Button x:Name="NestedTypeIncludeAddButton" Content="Include" HorizontalAlignment="Left" Margin="890,282,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="NestedTypeIncludeAddButton_Click" />
|
||||
<Button x:Name="NestedTypeExcludeButton" Content="Exclude" HorizontalAlignment="Left" Margin="1020,282,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="NestedTypeExcludeButton_Click" />
|
||||
<Button x:Name="NestedTypeRemoveButton" Content="Remove" HorizontalAlignment="Left" Margin="955,282,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="NestedTypeRemoveButton_Click" />
|
||||
<Label Content="Is Nested" HorizontalAlignment="Left" Margin="503,40,0,0" VerticalAlignment="Top" Width="227" />
|
||||
<Label Content="Is Public" HorizontalAlignment="Left" Margin="503,66,0,0" VerticalAlignment="Top" Width="227" />
|
||||
<Label Content="Is Abstract" HorizontalAlignment="Left" Margin="503,92,0,0" VerticalAlignment="Top" Width="227" />
|
||||
<Label Content="Is Interface" HorizontalAlignment="Left" Margin="694,40,0,0" VerticalAlignment="Top" Width="228" />
|
||||
<Label Content="Is Sealed" HorizontalAlignment="Left" Margin="694,67,0,0" VerticalAlignment="Top" Width="228" />
|
||||
<Label Content="Is Enum" HorizontalAlignment="Left" Margin="694,94,0,0" VerticalAlignment="Top" Width="228" />
|
||||
<Label Content="Has Attribute" HorizontalAlignment="Left" Margin="893,42,0,0" VerticalAlignment="Top" Width="227" />
|
||||
<Label Content="Is Derived" HorizontalAlignment="Left" Margin="893,69,0,0" VerticalAlignment="Top" Width="227" />
|
||||
<Label Content="Has Generic Parameters" HorizontalAlignment="Left" Margin="893,94,0,0" VerticalAlignment="Top" Width="227" />
|
||||
<TreeView x:Name="RemapTreeView" Margin="6,153,840,23" Background="#FF484646" />
|
||||
<Label Content="Remaps" HorizontalAlignment="Left" Margin="10,129,0,0" VerticalAlignment="Top" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Auto ReMapper">
|
||||
<TabItem.Background>
|
||||
<LinearGradientBrush EndPoint="0,1">
|
||||
<GradientStop Color="#FFF0F0F0" />
|
||||
<GradientStop Color="#FF595454" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</TabItem.Background>
|
||||
<Grid Background="#FF595454" />
|
||||
</TabItem>
|
||||
<TabItem Header="Database">
|
||||
<TabItem.Background>
|
||||
<LinearGradientBrush EndPoint="0,1">
|
||||
<GradientStop Color="#FFF0F0F0" />
|
||||
<GradientStop Color="#FF595454" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</TabItem.Background>
|
||||
</TabItem>
|
||||
<TabItem BorderBrush="#FF8A8282" Header="Settings">
|
||||
<TabItem.Background>
|
||||
<LinearGradientBrush EndPoint="0,1">
|
||||
<GradientStop Color="#FFF0F0F0" Offset="0.33" />
|
||||
<GradientStop Color="#FF595454" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</TabItem.Background>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Canvas>
|
||||
</Window>
|
94
ReCodeItGUI_WPF/MainWindow.xaml.cs
Normal file
94
ReCodeItGUI_WPF/MainWindow.xaml.cs
Normal file
@ -0,0 +1,94 @@
|
||||
using ReCodeIt.Utils;
|
||||
using ReCodeItGUI_WPF.Helpers;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace ReCodeItGUI_WPF;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private ICommand deleteCommand;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataProvider.LoadAppSettings();
|
||||
DataProvider.LoadMappingFile();
|
||||
}
|
||||
|
||||
#region MANUAL_REMAPPER
|
||||
|
||||
private void SaveRemapButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.CreateRemapFromGui();
|
||||
}
|
||||
|
||||
private void MethodIncludeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MethodIncludeListView.AddToListView(MethodTextBox);
|
||||
}
|
||||
|
||||
private void MethodExcludeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MethodExcludeListView.AddToListView(MethodTextBox);
|
||||
}
|
||||
|
||||
private void MethodRemoveButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MethodIncludeListView.RemoveSelectedItem();
|
||||
MethodExcludeListView.RemoveSelectedItem();
|
||||
}
|
||||
|
||||
private void FieldIncludeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FieldIncludeListView.AddToListView(FieldTextBox);
|
||||
}
|
||||
|
||||
private void FieldExcludeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FieldExcludeListView.AddToListView(FieldTextBox);
|
||||
}
|
||||
|
||||
private void FieldRemoveButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FieldIncludeListView.RemoveSelectedItem();
|
||||
FieldExcludeListView.RemoveSelectedItem();
|
||||
}
|
||||
|
||||
private void PropertyIncludeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PropertyIncludeListBox.AddToListView(PropertyTextBox);
|
||||
}
|
||||
|
||||
private void PropertyExcludeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PropertyExcludeListBox.AddToListView(PropertyTextBox);
|
||||
}
|
||||
|
||||
private void PropertyRemoveButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PropertyIncludeListBox.RemoveSelectedItem();
|
||||
PropertyExcludeListBox.RemoveSelectedItem();
|
||||
}
|
||||
|
||||
private void NestedTypeIncludeAddButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
NestedTypeIncludeListView.AddToListView(NestTypeTextBox);
|
||||
}
|
||||
|
||||
private void NestedTypeExcludeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
NestedTypeExcludeListView.AddToListView(NestTypeTextBox);
|
||||
}
|
||||
|
||||
private void NestedTypeRemoveButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
NestedTypeIncludeListView.RemoveSelectedItem();
|
||||
NestedTypeExcludeListView.RemoveSelectedItem();
|
||||
}
|
||||
|
||||
#endregion MANUAL_REMAPPER
|
||||
}
|
23
ReCodeItGUI_WPF/ReCodeItGUI_WPF.csproj
Normal file
23
ReCodeItGUI_WPF/ReCodeItGUI_WPF.csproj
Normal file
@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RecodeItLib\ReCodeItLib.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="xcopy "$(SolutionDir)Templates" "$(TargetDir)Data" /E /I /Y" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReCodeItGUI", "RecodeItGUI\
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReCodeItLib", "RecodeItLib\ReCodeItLib.csproj", "{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReCodeItGUI_WPF", "ReCodeItGUI_WPF\ReCodeItGUI_WPF.csproj", "{86142D6E-DE7E-48A7-9905-55D3ECE377AD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -21,6 +23,10 @@ Global
|
||||
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{86142D6E-DE7E-48A7-9905-55D3ECE377AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{86142D6E-DE7E-48A7-9905-55D3ECE377AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{86142D6E-DE7E-48A7-9905-55D3ECE377AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{86142D6E-DE7E-48A7-9905-55D3ECE377AD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
50
RecodeItLib/Models/TypeDatabase.cs
Normal file
50
RecodeItLib/Models/TypeDatabase.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using Mono.Cecil;
|
||||
using Mono.Collections.Generic;
|
||||
|
||||
namespace ReCodeItLib.Models;
|
||||
|
||||
/// <summary>
|
||||
/// This is a database of type, field, property etc info collected into one place for an assembly.
|
||||
/// </summary>
|
||||
/// <param name="assembly"></param>
|
||||
internal class TypeDatabaseModel
|
||||
{
|
||||
public TypeDatabaseModel(ModuleDefinition moduleDefinition)
|
||||
{
|
||||
ModuleDefinition = moduleDefinition;
|
||||
|
||||
GetAllTypes(ModuleDefinition.Types);
|
||||
}
|
||||
|
||||
public ModuleDefinition ModuleDefinition { get; private set; }
|
||||
|
||||
public List<TypeDefinition> Types { get; private set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Key, the type definition the property belongs too
|
||||
/// </summary>
|
||||
public Dictionary<TypeDefinition, PropertyDefinition> Properties { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Key, the type definition the method belongs too
|
||||
/// </summary>
|
||||
public Dictionary<TypeDefinition, MethodDefinition> Methods { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Key, the type definition the field belongs too
|
||||
/// </summary>
|
||||
public Dictionary<TypeDefinition, FieldDefinition> Fields { get; private set; }
|
||||
|
||||
private void GetAllTypes(Collection<TypeDefinition> types)
|
||||
{
|
||||
foreach (var type in types)
|
||||
{
|
||||
if (type.HasNestedTypes)
|
||||
{
|
||||
GetAllTypes(type.NestedTypes);
|
||||
}
|
||||
|
||||
Types.Add(type);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user