mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-12 20:30:43 -05:00
Remove automapper from config, start removal of automapper from gui
This commit is contained in:
parent
3de6be24ce
commit
15af480254
@ -8,44 +8,12 @@
|
||||
"OutputPath": "",
|
||||
"MappingPath": "",
|
||||
"UseProjectMappings": false,
|
||||
"MappingSettings": {
|
||||
"RenameFields": true,
|
||||
"RenameProperties": true,
|
||||
"Publicize": true,
|
||||
"Unseal": true
|
||||
}
|
||||
},
|
||||
"AutoMapper": {
|
||||
"AssemblyPath": "",
|
||||
"OutputPath": "",
|
||||
"RequiredMatches": 5,
|
||||
"MinLengthToMatch": 7,
|
||||
"SearchMethods": true,
|
||||
"MappingSettings": {
|
||||
"RenameFields": true,
|
||||
"RenameProperties": true,
|
||||
"Publicize": true,
|
||||
"Unseal": true
|
||||
},
|
||||
"TypesToIgnore": [
|
||||
"Boolean",
|
||||
"List",
|
||||
"Dictionary",
|
||||
"Byte",
|
||||
"Int16",
|
||||
"Int32",
|
||||
"Func",
|
||||
"Action",
|
||||
"Object",
|
||||
"String",
|
||||
"Vector2",
|
||||
"Vector3",
|
||||
"Vector4",
|
||||
"Stream",
|
||||
"HashSet",
|
||||
"Double",
|
||||
"IEnumerator"
|
||||
],
|
||||
"TokensToMatch": [
|
||||
"Class",
|
||||
"GClass",
|
||||
@ -54,18 +22,6 @@
|
||||
"ValueStruct",
|
||||
"Interface",
|
||||
"GInterface"
|
||||
],
|
||||
"PropertyFieldBlackList": [
|
||||
"Columns",
|
||||
"mColumns",
|
||||
"Template",
|
||||
"Condition",
|
||||
"Conditions",
|
||||
"Counter",
|
||||
"Instance",
|
||||
"Command",
|
||||
"_template"
|
||||
],
|
||||
"MethodParamaterBlackList": []
|
||||
]
|
||||
}
|
||||
}
|
@ -172,16 +172,7 @@ public partial class ReCodeItForm : Form
|
||||
DataProvider.Remaps = DataProvider.LoadMappingFile(AppSettings.Remapper.MappingPath);
|
||||
LoadedMappingFilePath.Text = AppSettings.Remapper.MappingPath;
|
||||
}
|
||||
|
||||
private void UseProjectAutoMapping_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
var remaps = DataProvider.Remaps;
|
||||
|
||||
LoadedMappingFilePath.Text = AppSettings.Remapper?.MappingPath;
|
||||
|
||||
ReloadRemapTreeView(remaps!);
|
||||
}
|
||||
|
||||
|
||||
#region BUTTONS
|
||||
|
||||
#region MAIN_BUTTONS
|
||||
@ -682,35 +673,17 @@ public partial class ReCodeItForm : Form
|
||||
|
||||
private void AutoMapperExcludeAddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (AutoMapperTypesToIgnoreTextField.Text == string.Empty) return;
|
||||
|
||||
if (!AutoMapperTypesExcludeBox.Items.Contains(AutoMapperTypesToIgnoreTextField.Text))
|
||||
{
|
||||
DataProvider.Settings.AutoMapper.TypesToIgnore.Add(AutoMapperTypesToIgnoreTextField.Text);
|
||||
AutoMapperTypesExcludeBox.Items.Add(AutoMapperTypesToIgnoreTextField.Text);
|
||||
AutoMapperTypesToIgnoreTextField.Clear();
|
||||
|
||||
DataProvider.SaveAppSettings();
|
||||
}
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperExcludeRemoveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (AutoMapperTypesExcludeBox.SelectedItem != null)
|
||||
{
|
||||
DataProvider.Settings.AutoMapper.TypesToIgnore.RemoveAt(AutoMapperTypesExcludeBox.SelectedIndex);
|
||||
AutoMapperTypesExcludeBox.Items.Remove(AutoMapperTypesExcludeBox.SelectedItem);
|
||||
|
||||
DataProvider.SaveAppSettings();
|
||||
}
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void RunAutoRemapButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(DataProvider.Settings.AutoMapper.AssemblyPath))
|
||||
{
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
#endregion LISTBOX_BUTTONS
|
||||
@ -773,16 +746,7 @@ public partial class ReCodeItForm : Form
|
||||
}
|
||||
|
||||
#endregion CHECKBOXES
|
||||
|
||||
#region UPDOWNS
|
||||
|
||||
private void AutoMapperRequiredMatchesUpDown_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
DataProvider.Settings.AutoMapper.RequiredMatches = (int)AutoMapperRequiredMatchesUpDown.Value;
|
||||
}
|
||||
|
||||
#endregion UPDOWNS
|
||||
|
||||
|
||||
#endregion SETTINGS_TAB
|
||||
|
||||
#region AUTOMAPPER
|
||||
@ -792,166 +756,81 @@ public partial class ReCodeItForm : Form
|
||||
AutoMapperTypesExcludeBox.Items.Clear();
|
||||
AutoMapperTokensBox.Items.Clear();
|
||||
AutoMapperFPBox.Items.Clear();
|
||||
|
||||
var settings = AppSettings.AutoMapper;
|
||||
|
||||
AutoMapperRequiredMatchesUpDown.Value = settings.RequiredMatches;
|
||||
AutoMapperMinLengthUpDown.Value = settings.MinLengthToMatch;
|
||||
AutoMapperSearchMethodsCheckBox.Checked = settings.SearchMethods;
|
||||
AutoMapperRenameFields.Checked = settings.MappingSettings.RenameFields;
|
||||
AutoMapperRenameProps.Checked = settings.MappingSettings.RenameProperties;
|
||||
AutoMapperPublicize.Checked = settings.MappingSettings.Publicize;
|
||||
AutoMapperUnseal.Checked = settings.MappingSettings.Unseal;
|
||||
|
||||
foreach (var type in settings.TypesToIgnore)
|
||||
{
|
||||
AutoMapperTypesExcludeBox.Items.Add(type);
|
||||
}
|
||||
|
||||
foreach (var token in settings.TokensToMatch)
|
||||
{
|
||||
AutoMapperTokensBox.Items.Add(token);
|
||||
}
|
||||
|
||||
foreach (var fp in settings.PropertyFieldBlackList)
|
||||
{
|
||||
AutoMapperFPBox.Items.Add(fp);
|
||||
}
|
||||
|
||||
foreach (var mp in settings.MethodParameterBlackList)
|
||||
{
|
||||
AutoMapperMethodBox.Items.Add(mp);
|
||||
}
|
||||
}
|
||||
|
||||
private void AutoMapperChooseTargetPathButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var result = GUIHelpers.OpenFileDialog("Select a DLL file",
|
||||
"DLL Files (*.dll)|*.dll|All Files (*.*)|*.*");
|
||||
|
||||
if (result != string.Empty)
|
||||
{
|
||||
AppSettings.AutoMapper.AssemblyPath = result;
|
||||
AutoMapperTargetPath.Text = result;
|
||||
}
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperChooseOutpathButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var result = GUIHelpers.OpenFolderDialog("Select an output directory");
|
||||
|
||||
if (result != string.Empty)
|
||||
{
|
||||
AppSettings.AutoMapper.OutputPath = result;
|
||||
AutoMapperOuputPath.Text = result;
|
||||
}
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperRequiredMatchesUpDown_ValueChanged_1(object sender, EventArgs e)
|
||||
{
|
||||
AppSettings.AutoMapper.RequiredMatches = (int)AutoMapperRequiredMatchesUpDown.Value;
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperMinLengthUpDown_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
AppSettings.AutoMapper.MinLengthToMatch = (int)AutoMapperMinLengthUpDown.Value;
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperTokensAddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!AutoMapperTokensBox.Items.Contains(AutoMapperTokensTextField.Text))
|
||||
{
|
||||
AutoMapperTokensBox.Items.Add(AutoMapperTokensTextField.Text);
|
||||
AppSettings.AutoMapper.TokensToMatch.Add(AutoMapperTokensTextField.Text);
|
||||
|
||||
DataProvider.SaveAppSettings();
|
||||
AutoMapperTokensTextField.Clear();
|
||||
}
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperTokensRemoveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (AutoMapperTokensBox.SelectedItem != null)
|
||||
{
|
||||
AppSettings.AutoMapper.TokensToMatch.RemoveAt(AutoMapperTokensBox.SelectedIndex);
|
||||
AutoMapperTokensBox.Items.Remove(AutoMapperTokensBox.SelectedItem);
|
||||
DataProvider.SaveAppSettings();
|
||||
}
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperFPAddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!AutoMapperFPBox.Items.Contains(AutoMapperFPTextField.Text))
|
||||
{
|
||||
AutoMapperFPBox.Items.Add(AutoMapperFPTextField.Text);
|
||||
AppSettings.AutoMapper.PropertyFieldBlackList.Add(AutoMapperFPTextField.Text);
|
||||
|
||||
DataProvider.SaveAppSettings();
|
||||
AutoMapperFPTextField.Clear();
|
||||
}
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperFPRemoveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (AutoMapperFPBox.SelectedItem != null)
|
||||
{
|
||||
AppSettings.AutoMapper.PropertyFieldBlackList.RemoveAt(AutoMapperFPBox.SelectedIndex);
|
||||
AutoMapperFPBox.Items.Remove(AutoMapperFPBox.SelectedItem);
|
||||
|
||||
DataProvider.SaveAppSettings();
|
||||
}
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperMethodAddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!AutoMapperMethodBox.Items.Contains(AutoMapperMethodTextBox.Text))
|
||||
{
|
||||
AutoMapperMethodBox.Items.Add(AutoMapperMethodTextBox.Text);
|
||||
|
||||
AppSettings.AutoMapper.MethodParameterBlackList.Add(AutoMapperMethodTextBox.Text);
|
||||
|
||||
DataProvider.SaveAppSettings();
|
||||
AutoMapperMethodTextBox.Clear();
|
||||
}
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperMethodRemoveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (AutoMapperMethodBox.SelectedItem != null)
|
||||
{
|
||||
AppSettings.AutoMapper.MethodParameterBlackList
|
||||
.RemoveAt(AutoMapperMethodBox.SelectedIndex);
|
||||
|
||||
AutoMapperMethodBox.Items
|
||||
.Remove(AutoMapperMethodBox.SelectedItem);
|
||||
|
||||
DataProvider.SaveAppSettings();
|
||||
}
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void SearchMethodsCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
AppSettings.AutoMapper.SearchMethods = AutoMapperSearchMethodsCheckBox.Checked;
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperRenameFields_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
AppSettings.AutoMapper.MappingSettings.RenameFields = AutoMapperRenameFields.Checked;
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperRenameProps_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
AppSettings.AutoMapper.MappingSettings.RenameProperties = AutoMapperRenameProps.Checked;
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperPublicize_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
AppSettings.AutoMapper.MappingSettings.Publicize = AutoMapperPublicize.Checked;
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
private void AutoMapperUnseal_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
AppSettings.AutoMapper.MappingSettings.Unseal = AutoMapperUnseal.Checked;
|
||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
||||
}
|
||||
|
||||
#endregion AUTOMAPPER
|
||||
|
@ -30,18 +30,6 @@ public class Settings
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private AutoMapperSettings? _autoMapper;
|
||||
|
||||
public AutoMapperSettings? AutoMapper
|
||||
{
|
||||
get { return _autoMapper; }
|
||||
set
|
||||
{
|
||||
_autoMapper = value;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
@ -161,124 +149,10 @@ public class RemapperSettings
|
||||
}
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
DataProvider.SaveAppSettings();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// These are settings for the auto mapping
|
||||
/// </summary>
|
||||
public class AutoMapperSettings
|
||||
{
|
||||
private string _assemblyPath = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Path to the assembly we want to remap
|
||||
/// </summary>
|
||||
public string AssemblyPath
|
||||
{
|
||||
get { return _assemblyPath; }
|
||||
set
|
||||
{
|
||||
_assemblyPath = value;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private string _outputPath = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Path including the filename and extension we want to write the changes to
|
||||
/// </summary>
|
||||
public string OutputPath
|
||||
{
|
||||
get { return _outputPath; }
|
||||
set
|
||||
{
|
||||
_outputPath = value;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private int _requiredMatches;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum number of times a member must have this name in the assembly before considering it
|
||||
/// for remapping
|
||||
/// </summary>
|
||||
public int RequiredMatches
|
||||
{
|
||||
get { return _requiredMatches; }
|
||||
set
|
||||
{
|
||||
_requiredMatches = value;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private int _minLengthToMatch;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum length of the field/property name in code before it will be considered for a rename
|
||||
/// </summary>
|
||||
public int MinLengthToMatch
|
||||
{
|
||||
get { return _minLengthToMatch; }
|
||||
set
|
||||
{
|
||||
_minLengthToMatch = value;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private bool _searchMethods;
|
||||
|
||||
/// <summary>
|
||||
/// Will attempt to map types from method meta data and parameters
|
||||
/// </summary>
|
||||
public bool SearchMethods
|
||||
{
|
||||
get { return _searchMethods; }
|
||||
set
|
||||
{
|
||||
_searchMethods = value;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private MappingSettings? _mappingSettings;
|
||||
|
||||
public MappingSettings? MappingSettings
|
||||
{
|
||||
get { return _mappingSettings; }
|
||||
set
|
||||
{
|
||||
_mappingSettings = value;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> _typesToIgnore = [];
|
||||
|
||||
/// <summary>
|
||||
/// Any member name you want to ignore while iterating through the assembly
|
||||
/// </summary>
|
||||
public List<string> TypesToIgnore
|
||||
{
|
||||
get { return _typesToIgnore; }
|
||||
set
|
||||
{
|
||||
_typesToIgnore = value;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> _tokensToMatch = [];
|
||||
|
||||
/// <summary>
|
||||
/// The auto mapper will look for these tokens in class names and prioritize those
|
||||
/// The re-mapper will look for these tokens in class names, otherwise they will be skipped
|
||||
/// </summary>
|
||||
public List<string> TokensToMatch
|
||||
{
|
||||
@ -289,37 +163,7 @@ public class AutoMapperSettings
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> _propertyFieldBlacklist = [];
|
||||
|
||||
/// <summary>
|
||||
/// Property or fields names to ignore in the automap, these are case sanitized so case does not matter
|
||||
/// </summary>
|
||||
public List<string> PropertyFieldBlackList
|
||||
{
|
||||
get { return _propertyFieldBlacklist; }
|
||||
set
|
||||
{
|
||||
_propertyFieldBlacklist = value;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> _methodParameterBlackList = [];
|
||||
|
||||
/// <summary>
|
||||
/// method parameter names to ignore in the automap, these are case sanitized so case does not matter
|
||||
/// </summary>
|
||||
public List<string> MethodParameterBlackList
|
||||
{
|
||||
get { return _methodParameterBlackList; }
|
||||
set
|
||||
{
|
||||
_methodParameterBlackList = value;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Save()
|
||||
{
|
||||
DataProvider.SaveAppSettings();
|
||||
|
@ -160,7 +160,7 @@ public class ReCodeItRemapper
|
||||
/// <param name="mapping">Mapping to score</param>
|
||||
private void ScoreMapping(RemapModel mapping, IEnumerable<TypeDef> types)
|
||||
{
|
||||
var tokens = DataProvider.Settings?.AutoMapper?.TokensToMatch;
|
||||
var tokens = DataProvider.Settings?.Remapper?.TokensToMatch;
|
||||
|
||||
if (mapping.UseForceRename)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ namespace ReCodeIt.ReMapper;
|
||||
|
||||
internal static class RenameHelper
|
||||
{
|
||||
private static List<string>? TokensToMatch => DataProvider.Settings?.AutoMapper?.TokensToMatch;
|
||||
private static List<string>? TokensToMatch => DataProvider.Settings?.Remapper?.TokensToMatch;
|
||||
|
||||
/// <summary>
|
||||
/// Only used by the manual remapper, should probably be removed
|
||||
|
Loading…
x
Reference in New Issue
Block a user