mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-13 01:30:45 -05:00
mappings structure change part 1
This commit is contained in:
parent
6c8cfb8d08
commit
a49c2b3aee
16028
Assets/mappings.jsonc
16028
Assets/mappings.jsonc
File diff suppressed because it is too large
Load Diff
@ -239,23 +239,37 @@ public partial class ReCodeItForm : Form
|
|||||||
IgnoreBaseClass = BaseClassExcludeTextField.Text == string.Empty
|
IgnoreBaseClass = BaseClassExcludeTextField.Text == string.Empty
|
||||||
? null
|
? null
|
||||||
: BaseClassExcludeTextField.Text,
|
: BaseClassExcludeTextField.Text,
|
||||||
|
|
||||||
// Constructor - TODO
|
Methods =
|
||||||
ConstructorParameterCount = ConstructorCountEnabled.GetCount(ConstuctorCountUpDown),
|
{
|
||||||
MethodCount = MethodCountEnabled.GetCount(MethodCountUpDown),
|
ConstructorParameterCount = (int)ConstructorCountEnabled.GetCount(ConstuctorCountUpDown),
|
||||||
FieldCount = FieldCountEnabled.GetCount(FieldCountUpDown),
|
MethodCount = (int)MethodCountEnabled.GetCount(MethodCountUpDown),
|
||||||
PropertyCount = PropertyCountEnabled.GetCount(PropertyCountUpDown),
|
IncludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodIncludeBox),
|
||||||
NestedTypeCount = NestedTypeCountEnabled.GetCount(NestedTypeCountUpDown),
|
ExcludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodExcludeBox),
|
||||||
IncludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodIncludeBox),
|
},
|
||||||
ExcludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodExcludeBox),
|
Fields =
|
||||||
IncludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldIncludeBox),
|
{
|
||||||
ExcludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldExcludeBox),
|
FieldCount = (int)FieldCountEnabled.GetCount(FieldCountUpDown),
|
||||||
IncludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesIncludeBox),
|
IncludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldIncludeBox),
|
||||||
ExcludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesExcludeBox),
|
ExcludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldExcludeBox),
|
||||||
IncludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesIncludeBox),
|
},
|
||||||
ExcludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesExcludeBox),
|
Properties =
|
||||||
IncludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsIncludeBox),
|
{
|
||||||
ExcludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsExcludeBox)
|
PropertyCount = (int)PropertyCountEnabled.GetCount(PropertyCountUpDown),
|
||||||
|
IncludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesIncludeBox),
|
||||||
|
ExcludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesExcludeBox),
|
||||||
|
},
|
||||||
|
NestedTypes =
|
||||||
|
{
|
||||||
|
NestedTypeCount = (int)NestedTypeCountEnabled.GetCount(NestedTypeCountUpDown),
|
||||||
|
IncludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesIncludeBox),
|
||||||
|
ExcludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesExcludeBox),
|
||||||
|
},
|
||||||
|
Events =
|
||||||
|
{
|
||||||
|
IncludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsIncludeBox),
|
||||||
|
ExcludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsExcludeBox)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -815,45 +829,25 @@ public partial class ReCodeItForm : Form
|
|||||||
BaseClassExcludeTextField.Text = remap.SearchParams.IgnoreBaseClass;
|
BaseClassExcludeTextField.Text = remap.SearchParams.IgnoreBaseClass;
|
||||||
NestedTypeParentName.Text = remap.SearchParams.NTParentName;
|
NestedTypeParentName.Text = remap.SearchParams.NTParentName;
|
||||||
|
|
||||||
ConstructorCountEnabled.Checked = remap.SearchParams.ConstructorParameterCount is not null
|
ConstructorCountEnabled.Checked = remap.SearchParams.Methods.ConstructorParameterCount >= 0;
|
||||||
? remap.SearchParams.ConstructorParameterCount > 0
|
|
||||||
: false;
|
|
||||||
|
|
||||||
MethodCountEnabled.Checked = remap.SearchParams.MethodCount is not null
|
MethodCountEnabled.Checked = remap.SearchParams.Methods.MethodCount >= 0;
|
||||||
? remap.SearchParams.MethodCount >= 0
|
|
||||||
: false;
|
|
||||||
|
|
||||||
FieldCountEnabled.Checked = remap.SearchParams.FieldCount is not null
|
FieldCountEnabled.Checked = remap.SearchParams.Fields.FieldCount >= 0;
|
||||||
? remap.SearchParams.FieldCount >= 0
|
|
||||||
: false;
|
|
||||||
|
|
||||||
PropertyCountEnabled.Checked = remap.SearchParams.PropertyCount is not null
|
PropertyCountEnabled.Checked = remap.SearchParams.Properties.PropertyCount >= 0;
|
||||||
? remap.SearchParams.PropertyCount >= 0
|
|
||||||
: false;
|
|
||||||
|
|
||||||
NestedTypeCountEnabled.Checked = remap.SearchParams.NestedTypeCount is not null
|
NestedTypeCountEnabled.Checked = remap.SearchParams.NestedTypes.NestedTypeCount >= 0;
|
||||||
? remap.SearchParams.NestedTypeCount >= 0
|
|
||||||
: false;
|
|
||||||
|
|
||||||
ConstuctorCountUpDown.Value = (decimal)((remap.SearchParams.ConstructorParameterCount != null
|
ConstuctorCountUpDown.Value = remap.SearchParams.Methods.ConstructorParameterCount;
|
||||||
? remap.SearchParams.ConstructorParameterCount
|
|
||||||
: 0));
|
|
||||||
|
|
||||||
MethodCountUpDown.Value = (decimal)(remap.SearchParams.MethodCount != null
|
MethodCountUpDown.Value = remap.SearchParams.Methods.MethodCount;
|
||||||
? remap.SearchParams.MethodCount
|
|
||||||
: 0);
|
|
||||||
|
|
||||||
FieldCountUpDown.Value = (decimal)(remap.SearchParams.FieldCount != null
|
FieldCountUpDown.Value = remap.SearchParams.Fields.FieldCount;
|
||||||
? remap.SearchParams.FieldCount
|
|
||||||
: 0);
|
|
||||||
|
|
||||||
PropertyCountUpDown.Value = (decimal)(remap.SearchParams.PropertyCount != null
|
PropertyCountUpDown.Value = remap.SearchParams.Properties.PropertyCount;
|
||||||
? remap.SearchParams.PropertyCount
|
|
||||||
: 0);
|
|
||||||
|
|
||||||
NestedTypeCountUpDown.Value = (decimal)(remap.SearchParams.NestedTypeCount != null
|
NestedTypeCountUpDown.Value = remap.SearchParams.NestedTypes.NestedTypeCount;
|
||||||
? remap.SearchParams.NestedTypeCount
|
|
||||||
: 0);
|
|
||||||
|
|
||||||
IsPublicComboBox.SelectedItem = remap.SearchParams.IsPublic.ToString();
|
IsPublicComboBox.SelectedItem = remap.SearchParams.IsPublic.ToString();
|
||||||
|
|
||||||
@ -888,52 +882,52 @@ public partial class ReCodeItForm : Form
|
|||||||
IsNestedUpDown.BuildStringList("IsNested", false, remap.SearchParams.IsNested);
|
IsNestedUpDown.BuildStringList("IsNested", false, remap.SearchParams.IsNested);
|
||||||
IsDerivedUpDown.BuildStringList("IsDerived", false, remap.SearchParams.IsDerived);
|
IsDerivedUpDown.BuildStringList("IsDerived", false, remap.SearchParams.IsDerived);
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.IncludeMethods)
|
foreach (var method in remap.SearchParams.Methods.IncludeMethods)
|
||||||
{
|
{
|
||||||
MethodIncludeBox.Items.Add(method);
|
MethodIncludeBox.Items.Add(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.ExcludeMethods)
|
foreach (var method in remap.SearchParams.Methods.ExcludeMethods)
|
||||||
{
|
{
|
||||||
MethodExcludeBox.Items.Add(method);
|
MethodExcludeBox.Items.Add(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.IncludeFields)
|
foreach (var method in remap.SearchParams.Fields.IncludeFields)
|
||||||
{
|
{
|
||||||
FieldIncludeBox.Items.Add(method);
|
FieldIncludeBox.Items.Add(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.ExcludeFields)
|
foreach (var method in remap.SearchParams.Fields.ExcludeFields)
|
||||||
{
|
{
|
||||||
FieldExcludeBox.Items.Add(method);
|
FieldExcludeBox.Items.Add(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.IncludeProperties)
|
foreach (var method in remap.SearchParams.Properties.IncludeProperties)
|
||||||
{
|
{
|
||||||
PropertiesIncludeBox.Items.Add(method);
|
PropertiesIncludeBox.Items.Add(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.ExcludeProperties)
|
foreach (var method in remap.SearchParams.Properties.ExcludeProperties)
|
||||||
{
|
{
|
||||||
PropertiesExcludeBox.Items.Add(method);
|
PropertiesExcludeBox.Items.Add(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.IncludeNestedTypes)
|
foreach (var method in remap.SearchParams.NestedTypes.IncludeNestedTypes)
|
||||||
{
|
{
|
||||||
NestedTypesIncludeBox.Items.Add(method);
|
NestedTypesIncludeBox.Items.Add(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.ExcludeNestedTypes)
|
foreach (var method in remap.SearchParams.NestedTypes.ExcludeNestedTypes)
|
||||||
{
|
{
|
||||||
NestedTypesExcludeBox.Items.Add(method);
|
NestedTypesExcludeBox.Items.Add(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.IncludeEvents)
|
foreach (var method in remap.SearchParams.Events.IncludeEvents)
|
||||||
{
|
{
|
||||||
EventsIncludeBox.Items.Add(method);
|
EventsIncludeBox.Items.Add(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.ExcludeEvents)
|
foreach (var method in remap.SearchParams.Events.ExcludeEvents)
|
||||||
{
|
{
|
||||||
EventsExcludeBox.Items.Add(method);
|
EventsExcludeBox.Items.Add(method);
|
||||||
}
|
}
|
||||||
|
@ -170,107 +170,107 @@ internal static class GUIHelpers
|
|||||||
remapTreeItem.Nodes.Add(new TreeNode($"HasGenericParameters: {HasGenericParameters}"));
|
remapTreeItem.Nodes.Add(new TreeNode($"HasGenericParameters: {HasGenericParameters}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.ConstructorParameterCount > 0)
|
if (model.SearchParams.Methods.ConstructorParameterCount > 0)
|
||||||
{
|
{
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"Constructor Parameter Count: {model.SearchParams.ConstructorParameterCount}"));
|
remapTreeItem.Nodes.Add(new TreeNode($"Constructor Parameter Count: {model.SearchParams.Methods.ConstructorParameterCount}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.MethodCount is not null)
|
if (model.SearchParams.Methods.MethodCount >= 0)
|
||||||
{
|
{
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"Method Count: {model.SearchParams.MethodCount}"));
|
remapTreeItem.Nodes.Add(new TreeNode($"Method Count: {model.SearchParams.Methods.MethodCount}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.FieldCount is not null)
|
if (model.SearchParams.Fields.FieldCount >= 0)
|
||||||
{
|
{
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"Field Count: {model.SearchParams.FieldCount}"));
|
remapTreeItem.Nodes.Add(new TreeNode($"Field Count: {model.SearchParams.Fields.FieldCount}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.PropertyCount is not null)
|
if (model.SearchParams.Properties.PropertyCount >= 0)
|
||||||
{
|
{
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"Property Count: {model.SearchParams.PropertyCount}"));
|
remapTreeItem.Nodes.Add(new TreeNode($"Property Count: {model.SearchParams.Properties.PropertyCount}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.NestedTypeCount is not null)
|
if (model.SearchParams.NestedTypes.NestedTypeCount >= 0)
|
||||||
{
|
{
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"Nested OriginalTypeRef Count: {model.SearchParams.NestedTypeCount}"));
|
remapTreeItem.Nodes.Add(new TreeNode($"Nested OriginalTypeRef Count: {model.SearchParams.NestedTypes.NestedTypeCount}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.IncludeMethods?.Count > 0)
|
if (model.SearchParams.Methods.IncludeMethods.Count > 0)
|
||||||
{
|
{
|
||||||
var includeMethodsNode =
|
var includeMethodsNode =
|
||||||
GenerateNodeFromList(model.SearchParams.IncludeMethods, "Include Methods");
|
GenerateNodeFromList(model.SearchParams.Methods.IncludeMethods, "Include Methods");
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(includeMethodsNode);
|
remapTreeItem.Nodes.Add(includeMethodsNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.ExcludeMethods?.Count > 0)
|
if (model.SearchParams.Methods.ExcludeMethods?.Count > 0)
|
||||||
{
|
{
|
||||||
var excludeMethodsNode =
|
var excludeMethodsNode =
|
||||||
GenerateNodeFromList(model.SearchParams.ExcludeMethods, "Exclude Methods");
|
GenerateNodeFromList(model.SearchParams.Methods.ExcludeMethods, "Exclude Methods");
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(excludeMethodsNode);
|
remapTreeItem.Nodes.Add(excludeMethodsNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.IncludeFields?.Count > 0)
|
if (model.SearchParams.Fields.IncludeFields?.Count > 0)
|
||||||
{
|
{
|
||||||
var includeFieldsNode =
|
var includeFieldsNode =
|
||||||
GenerateNodeFromList(model.SearchParams.IncludeFields, "Include Fields");
|
GenerateNodeFromList(model.SearchParams.Fields.IncludeFields, "Include Fields");
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(includeFieldsNode);
|
remapTreeItem.Nodes.Add(includeFieldsNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.ExcludeFields?.Count > 0)
|
if (model.SearchParams.Fields.ExcludeFields?.Count > 0)
|
||||||
{
|
{
|
||||||
var excludeFieldsNode =
|
var excludeFieldsNode =
|
||||||
GenerateNodeFromList(model.SearchParams.ExcludeFields, "Exclude Fields");
|
GenerateNodeFromList(model.SearchParams.Fields.ExcludeFields, "Exclude Fields");
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(excludeFieldsNode);
|
remapTreeItem.Nodes.Add(excludeFieldsNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.IncludeProperties?.Count > 0)
|
if (model.SearchParams.Properties.IncludeProperties?.Count > 0)
|
||||||
{
|
{
|
||||||
var includeProperties =
|
var includeProperties =
|
||||||
GenerateNodeFromList(model.SearchParams.IncludeProperties, "Include Properties");
|
GenerateNodeFromList(model.SearchParams.Properties.IncludeProperties, "Include Properties");
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(includeProperties);
|
remapTreeItem.Nodes.Add(includeProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.ExcludeProperties?.Count > 0)
|
if (model.SearchParams.Properties.ExcludeProperties?.Count > 0)
|
||||||
{
|
{
|
||||||
var excludeProperties =
|
var excludeProperties =
|
||||||
GenerateNodeFromList(model.SearchParams.ExcludeProperties, "Exclude Properties");
|
GenerateNodeFromList(model.SearchParams.Properties.ExcludeProperties, "Exclude Properties");
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(excludeProperties);
|
remapTreeItem.Nodes.Add(excludeProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.IncludeNestedTypes?.Count > 0)
|
if (model.SearchParams.NestedTypes.IncludeNestedTypes?.Count > 0)
|
||||||
{
|
{
|
||||||
var includeNestedTypes =
|
var includeNestedTypes =
|
||||||
GenerateNodeFromList(model.SearchParams.IncludeNestedTypes, "Include Nested Types");
|
GenerateNodeFromList(model.SearchParams.NestedTypes.IncludeNestedTypes, "Include Nested Types");
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(includeNestedTypes);
|
remapTreeItem.Nodes.Add(includeNestedTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.ExcludeNestedTypes?.Count > 0)
|
if (model.SearchParams.NestedTypes.ExcludeNestedTypes?.Count > 0)
|
||||||
{
|
{
|
||||||
var excludeNestedTypes =
|
var excludeNestedTypes =
|
||||||
GenerateNodeFromList(model.SearchParams.ExcludeNestedTypes, "Exclude Nested Types");
|
GenerateNodeFromList(model.SearchParams.NestedTypes.ExcludeNestedTypes, "Exclude Nested Types");
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(excludeNestedTypes);
|
remapTreeItem.Nodes.Add(excludeNestedTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.IncludeEvents?.Count > 0)
|
if (model.SearchParams.Events.IncludeEvents?.Count > 0)
|
||||||
{
|
{
|
||||||
var includeEvents =
|
var includeEvents =
|
||||||
GenerateNodeFromList(model.SearchParams.IncludeEvents, "Include Events");
|
GenerateNodeFromList(model.SearchParams.Events.IncludeEvents, "Include Events");
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(includeEvents);
|
remapTreeItem.Nodes.Add(includeEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.SearchParams.ExcludeEvents?.Count > 0)
|
if (model.SearchParams.Events.ExcludeEvents?.Count > 0)
|
||||||
{
|
{
|
||||||
var excludeEvents =
|
var excludeEvents =
|
||||||
GenerateNodeFromList(model.SearchParams.ExcludeEvents, "Exclude Events");
|
GenerateNodeFromList(model.SearchParams.Events.ExcludeEvents, "Exclude Events");
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(excludeEvents);
|
remapTreeItem.Nodes.Add(excludeEvents);
|
||||||
}
|
}
|
||||||
|
@ -80,33 +80,49 @@ public class SearchParams
|
|||||||
public string? IgnoreBaseClass { get; set; } = null;
|
public string? IgnoreBaseClass { get; set; } = null;
|
||||||
|
|
||||||
#endregion STR_PARAMS
|
#endregion STR_PARAMS
|
||||||
|
|
||||||
#region INT_PARAMS
|
|
||||||
|
|
||||||
public int? ConstructorParameterCount { get; set; } = null;
|
|
||||||
public int? MethodCount { get; set; } = null;
|
|
||||||
public int? FieldCount { get; set; } = null;
|
|
||||||
public int? PropertyCount { get; set; } = null;
|
|
||||||
public int? NestedTypeCount { get; set; } = null;
|
|
||||||
|
|
||||||
#endregion INT_PARAMS
|
|
||||||
|
|
||||||
#region LISTS
|
#region LISTS
|
||||||
|
|
||||||
public List<string> IncludeMethods { get; init; } = [];
|
public MethodParams Methods { get; set; } = new();
|
||||||
public List<string> ExcludeMethods { get; init; } = [];
|
public FieldParams Fields { get; set; } = new();
|
||||||
public List<string> IncludeFields { get; init; } = [];
|
public PropertyParams Properties { get; set; } = new();
|
||||||
public List<string> ExcludeFields { get; init; } = [];
|
public NestedTypeParams NestedTypes { get; set; } = new();
|
||||||
public List<string> IncludeProperties { get; init; } = [];
|
public EventParams Events { get; set; } = new();
|
||||||
public List<string> ExcludeProperties { get; init; } = [];
|
|
||||||
public List<string> IncludeNestedTypes { get; init; } = [];
|
|
||||||
public List<string> ExcludeNestedTypes { get; init; } = [];
|
|
||||||
public List<string> IncludeEvents { get; init; } = [];
|
|
||||||
public List<string> ExcludeEvents { get; init; } = [];
|
|
||||||
|
|
||||||
#endregion LISTS
|
#endregion LISTS
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class AdvancedSearchParams
|
public class MethodParams
|
||||||
{
|
{
|
||||||
|
public int ConstructorParameterCount { get; set; } = -1;
|
||||||
|
public int MethodCount { get; set; } = -1;
|
||||||
|
public List<string> IncludeMethods { get; set; } = [];
|
||||||
|
public List<string> ExcludeMethods { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FieldParams
|
||||||
|
{
|
||||||
|
public int FieldCount { get; set; } = -1;
|
||||||
|
public List<string> IncludeFields { get; set; } = [];
|
||||||
|
public List<string> ExcludeFields { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PropertyParams
|
||||||
|
{
|
||||||
|
public int PropertyCount { get; set; } = -1;
|
||||||
|
public List<string> IncludeProperties { get; set; } = [];
|
||||||
|
public List<string> ExcludeProperties { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NestedTypeParams
|
||||||
|
{
|
||||||
|
public int NestedTypeCount { get; set; } = -1;
|
||||||
|
public List<string> IncludeNestedTypes { get; set; } = [];
|
||||||
|
public List<string> ExcludeNestedTypes { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public class EventParams
|
||||||
|
{
|
||||||
|
public List<string> IncludeEvents { get; set; } = [];
|
||||||
|
public List<string> ExcludeEvents { get; set; } = [];
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ internal static class CtorTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByParameterCount(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByParameterCount(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.ConstructorParameterCount is null) return types;
|
if (parms.Methods.ConstructorParameterCount == -1) return types;
|
||||||
|
|
||||||
return types.Where(type =>
|
return types.Where(type =>
|
||||||
{
|
{
|
||||||
@ -23,7 +23,7 @@ internal static class CtorTypeFilters
|
|||||||
// Ensure Parameters isn't null before checking Count
|
// Ensure Parameters isn't null before checking Count
|
||||||
var parameters = ctor.Parameters;
|
var parameters = ctor.Parameters;
|
||||||
// This +1 offset is needed for some reason, needs investigation
|
// This +1 offset is needed for some reason, needs investigation
|
||||||
return parameters != null && parameters.Count == parms.ConstructorParameterCount + 1;
|
return parameters != null && parameters.Count == parms.Methods.ConstructorParameterCount + 1;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,13 @@ internal static class EventTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByInclude(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByInclude(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.IncludeEvents.Count == 0) return types;
|
if (parms.Events.IncludeEvents.Count == 0) return types;
|
||||||
|
|
||||||
List<TypeDef> filteredTypes = [];
|
List<TypeDef> filteredTypes = [];
|
||||||
|
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
if (parms.IncludeEvents
|
if (parms.Events.IncludeEvents
|
||||||
.All(includeName => type.Events
|
.All(includeName => type.Events
|
||||||
.Any(ev => ev.Name.String == includeName)))
|
.Any(ev => ev.Name.String == includeName)))
|
||||||
{
|
{
|
||||||
@ -38,14 +38,14 @@ internal static class EventTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByExclude(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByExclude(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.ExcludeEvents.Count == 0) return types;
|
if (parms.Events.ExcludeEvents.Count == 0) return types;
|
||||||
|
|
||||||
List<TypeDef> filteredTypes = [];
|
List<TypeDef> filteredTypes = [];
|
||||||
|
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
var match = type.Events
|
var match = type.Events
|
||||||
.Where(prop => parms.ExcludeEvents.Contains(prop.Name.String));
|
.Where(prop => parms.Events.ExcludeEvents.Contains(prop.Name.String));
|
||||||
|
|
||||||
if (!match.Any())
|
if (!match.Any())
|
||||||
{
|
{
|
||||||
|
@ -13,13 +13,13 @@ internal static class FieldTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByInclude(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByInclude(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.IncludeFields.Count == 0) return types;
|
if (parms.Fields.IncludeFields.Count == 0) return types;
|
||||||
|
|
||||||
List<TypeDef> filteredTypes = [];
|
List<TypeDef> filteredTypes = [];
|
||||||
|
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
if (parms.IncludeFields
|
if (parms.Fields.IncludeFields
|
||||||
.All(includeName => type.Fields
|
.All(includeName => type.Fields
|
||||||
.Any(field => field.Name.String == includeName)))
|
.Any(field => field.Name.String == includeName)))
|
||||||
{
|
{
|
||||||
@ -38,14 +38,14 @@ internal static class FieldTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByExclude(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByExclude(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.ExcludeFields.Count == 0) return types;
|
if (parms.Fields.ExcludeFields.Count == 0) return types;
|
||||||
|
|
||||||
List<TypeDef> filteredTypes = [];
|
List<TypeDef> filteredTypes = [];
|
||||||
|
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
var match = type.Fields
|
var match = type.Fields
|
||||||
.Where(field => parms.ExcludeFields.Contains(field.Name.String));
|
.Where(field => parms.Fields.ExcludeFields.Contains(field.Name.String));
|
||||||
|
|
||||||
if (!match.Any())
|
if (!match.Any())
|
||||||
{
|
{
|
||||||
@ -64,11 +64,11 @@ internal static class FieldTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByCount(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByCount(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.FieldCount is null) return types;
|
if (parms.Fields.FieldCount == -1) return types;
|
||||||
|
|
||||||
if (parms.FieldCount >= 0)
|
if (parms.Fields.FieldCount >= 0)
|
||||||
{
|
{
|
||||||
types = types.Where(t => t.Fields.Count == parms.FieldCount);
|
types = types.Where(t => t.Fields.Count == parms.Fields.FieldCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return types;
|
return types;
|
||||||
|
@ -13,13 +13,13 @@ internal static class MethodTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByInclude(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByInclude(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.IncludeMethods.Count == 0) return types;
|
if (parms.Methods.IncludeMethods.Count == 0) return types;
|
||||||
|
|
||||||
List<TypeDef> filteredTypes = [];
|
List<TypeDef> filteredTypes = [];
|
||||||
|
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
if (parms.IncludeMethods
|
if (parms.Methods.IncludeMethods
|
||||||
.All(includeName => type.Methods
|
.All(includeName => type.Methods
|
||||||
.Any(method => method.Name.String == includeName)))
|
.Any(method => method.Name.String == includeName)))
|
||||||
{
|
{
|
||||||
@ -38,14 +38,14 @@ internal static class MethodTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByExclude(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByExclude(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.ExcludeMethods.Count == 0) return types;
|
if (parms.Methods.ExcludeMethods.Count == 0) return types;
|
||||||
|
|
||||||
List<TypeDef> filteredTypes = [];
|
List<TypeDef> filteredTypes = [];
|
||||||
|
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
var match = type.Methods
|
var match = type.Methods
|
||||||
.Where(method => parms.ExcludeMethods.Contains(method.Name.String));
|
.Where(method => parms.Methods.ExcludeMethods.Contains(method.Name.String));
|
||||||
|
|
||||||
if (!match.Any())
|
if (!match.Any())
|
||||||
{
|
{
|
||||||
@ -64,11 +64,11 @@ internal static class MethodTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByCount(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByCount(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.MethodCount is null) return types;
|
if (parms.Methods.MethodCount == -1) return types;
|
||||||
|
|
||||||
if (parms.MethodCount >= 0)
|
if (parms.Methods.MethodCount >= 0)
|
||||||
{
|
{
|
||||||
types = types.Where(t => GetMethodCountExcludingConstructors(t) == parms.MethodCount);
|
types = types.Where(t => GetMethodCountExcludingConstructors(t) == parms.Methods.MethodCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return types;
|
return types;
|
||||||
|
@ -13,13 +13,13 @@ internal static class NestedTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByInclude(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByInclude(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.IncludeNestedTypes.Count == 0) return types;
|
if (parms.NestedTypes.IncludeNestedTypes.Count == 0) return types;
|
||||||
|
|
||||||
List<TypeDef> filteredTypes = [];
|
List<TypeDef> filteredTypes = [];
|
||||||
|
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
if (parms.IncludeNestedTypes
|
if (parms.NestedTypes.IncludeNestedTypes
|
||||||
.All(includeName => type.NestedTypes
|
.All(includeName => type.NestedTypes
|
||||||
.Any(nestedType => nestedType.Name.String == includeName)))
|
.Any(nestedType => nestedType.Name.String == includeName)))
|
||||||
{
|
{
|
||||||
@ -38,14 +38,14 @@ internal static class NestedTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByExclude(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByExclude(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.ExcludeNestedTypes.Count == 0) return types;
|
if (parms.NestedTypes.ExcludeNestedTypes.Count == 0) return types;
|
||||||
|
|
||||||
List<TypeDef> filteredTypes = [];
|
List<TypeDef> filteredTypes = [];
|
||||||
|
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
var match = type.Fields
|
var match = type.Fields
|
||||||
.Where(field => parms.ExcludeNestedTypes.Contains(field.Name.String));
|
.Where(field => parms.NestedTypes.ExcludeNestedTypes.Contains(field.Name.String));
|
||||||
|
|
||||||
if (!match.Any())
|
if (!match.Any())
|
||||||
{
|
{
|
||||||
@ -64,11 +64,9 @@ internal static class NestedTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByCount(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByCount(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.NestedTypeCount is null) return types;
|
if (parms.NestedTypes.NestedTypeCount >= 0)
|
||||||
|
|
||||||
if (parms.NestedTypeCount >= 0)
|
|
||||||
{
|
{
|
||||||
types = types.Where(t => t.NestedTypes.Count == parms.NestedTypeCount);
|
types = types.Where(t => t.NestedTypes.Count == parms.NestedTypes.NestedTypeCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return types;
|
return types;
|
||||||
|
@ -13,13 +13,13 @@ internal static class PropertyTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByInclude(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByInclude(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.IncludeProperties.Count == 0) return types;
|
if (parms.Properties.IncludeProperties.Count == 0) return types;
|
||||||
|
|
||||||
List<TypeDef> filteredTypes = [];
|
List<TypeDef> filteredTypes = [];
|
||||||
|
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
if (parms.IncludeProperties
|
if (parms.Properties.IncludeProperties
|
||||||
.All(includeName => type.Properties
|
.All(includeName => type.Properties
|
||||||
.Any(prop => prop.Name.String == includeName)))
|
.Any(prop => prop.Name.String == includeName)))
|
||||||
{
|
{
|
||||||
@ -38,14 +38,14 @@ internal static class PropertyTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByExclude(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByExclude(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.ExcludeProperties.Count == 0) return types;
|
if (parms.Properties.ExcludeProperties.Count == 0) return types;
|
||||||
|
|
||||||
List<TypeDef> filteredTypes = [];
|
List<TypeDef> filteredTypes = [];
|
||||||
|
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
var match = type.Properties
|
var match = type.Properties
|
||||||
.Where(prop => parms.ExcludeProperties.Contains(prop.Name.String));
|
.Where(prop => parms.Properties.ExcludeProperties.Contains(prop.Name.String));
|
||||||
|
|
||||||
if (!match.Any())
|
if (!match.Any())
|
||||||
{
|
{
|
||||||
@ -64,11 +64,11 @@ internal static class PropertyTypeFilters
|
|||||||
/// <returns>Filtered list</returns>
|
/// <returns>Filtered list</returns>
|
||||||
public static IEnumerable<TypeDef> FilterByCount(IEnumerable<TypeDef> types, SearchParams parms)
|
public static IEnumerable<TypeDef> FilterByCount(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.PropertyCount is null) return types;
|
if (parms.Properties.PropertyCount == -1) return types;
|
||||||
|
|
||||||
if (parms.PropertyCount >= 0)
|
if (parms.Properties.PropertyCount >= 0)
|
||||||
{
|
{
|
||||||
types = types.Where(t => t.Properties.Count == parms.PropertyCount);
|
types = types.Where(t => t.Properties.Count == parms.Properties.PropertyCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return types;
|
return types;
|
||||||
|
@ -37,7 +37,7 @@ public static class DataProvider
|
|||||||
|
|
||||||
Settings = JsonConvert.DeserializeObject<Settings>(jsonText, settings);
|
Settings = JsonConvert.DeserializeObject<Settings>(jsonText, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SaveAppSettings()
|
public static void SaveAppSettings()
|
||||||
{
|
{
|
||||||
if (IsCli) { return; }
|
if (IsCli) { return; }
|
||||||
@ -73,10 +73,30 @@ public static class DataProvider
|
|||||||
var jsonText = File.ReadAllText(path);
|
var jsonText = File.ReadAllText(path);
|
||||||
|
|
||||||
var remaps = JsonConvert.DeserializeObject<List<RemapModel>>(jsonText);
|
var remaps = JsonConvert.DeserializeObject<List<RemapModel>>(jsonText);
|
||||||
|
|
||||||
|
if (remaps is null) return [];
|
||||||
|
|
||||||
return remaps!;
|
MigrateMappings(remaps);
|
||||||
|
|
||||||
|
return remaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void MigrateMappings(List<RemapModel> models)
|
||||||
|
{
|
||||||
|
foreach (var model in models)
|
||||||
|
{
|
||||||
|
MigrateMapping(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateMapping(Path.Combine(DataPath, "Mappings-migrated.jsonc"), models);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void MigrateMapping(RemapModel model)
|
||||||
|
{
|
||||||
|
var searchParams = model.SearchParams;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void SaveMapping()
|
public static void SaveMapping()
|
||||||
{
|
{
|
||||||
JsonSerializerSettings settings = new()
|
JsonSerializerSettings settings = new()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user