mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-12 21:10: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
|
||||
? null
|
||||
: BaseClassExcludeTextField.Text,
|
||||
|
||||
// Constructor - TODO
|
||||
ConstructorParameterCount = ConstructorCountEnabled.GetCount(ConstuctorCountUpDown),
|
||||
MethodCount = MethodCountEnabled.GetCount(MethodCountUpDown),
|
||||
FieldCount = FieldCountEnabled.GetCount(FieldCountUpDown),
|
||||
PropertyCount = PropertyCountEnabled.GetCount(PropertyCountUpDown),
|
||||
NestedTypeCount = NestedTypeCountEnabled.GetCount(NestedTypeCountUpDown),
|
||||
IncludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodIncludeBox),
|
||||
ExcludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodExcludeBox),
|
||||
IncludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldIncludeBox),
|
||||
ExcludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldExcludeBox),
|
||||
IncludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesIncludeBox),
|
||||
ExcludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesExcludeBox),
|
||||
IncludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesIncludeBox),
|
||||
ExcludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesExcludeBox),
|
||||
IncludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsIncludeBox),
|
||||
ExcludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsExcludeBox)
|
||||
|
||||
Methods =
|
||||
{
|
||||
ConstructorParameterCount = (int)ConstructorCountEnabled.GetCount(ConstuctorCountUpDown),
|
||||
MethodCount = (int)MethodCountEnabled.GetCount(MethodCountUpDown),
|
||||
IncludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodIncludeBox),
|
||||
ExcludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodExcludeBox),
|
||||
},
|
||||
Fields =
|
||||
{
|
||||
FieldCount = (int)FieldCountEnabled.GetCount(FieldCountUpDown),
|
||||
IncludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldIncludeBox),
|
||||
ExcludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldExcludeBox),
|
||||
},
|
||||
Properties =
|
||||
{
|
||||
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;
|
||||
NestedTypeParentName.Text = remap.SearchParams.NTParentName;
|
||||
|
||||
ConstructorCountEnabled.Checked = remap.SearchParams.ConstructorParameterCount is not null
|
||||
? remap.SearchParams.ConstructorParameterCount > 0
|
||||
: false;
|
||||
ConstructorCountEnabled.Checked = remap.SearchParams.Methods.ConstructorParameterCount >= 0;
|
||||
|
||||
MethodCountEnabled.Checked = remap.SearchParams.MethodCount is not null
|
||||
? remap.SearchParams.MethodCount >= 0
|
||||
: false;
|
||||
MethodCountEnabled.Checked = remap.SearchParams.Methods.MethodCount >= 0;
|
||||
|
||||
FieldCountEnabled.Checked = remap.SearchParams.FieldCount is not null
|
||||
? remap.SearchParams.FieldCount >= 0
|
||||
: false;
|
||||
FieldCountEnabled.Checked = remap.SearchParams.Fields.FieldCount >= 0;
|
||||
|
||||
PropertyCountEnabled.Checked = remap.SearchParams.PropertyCount is not null
|
||||
? remap.SearchParams.PropertyCount >= 0
|
||||
: false;
|
||||
PropertyCountEnabled.Checked = remap.SearchParams.Properties.PropertyCount >= 0;
|
||||
|
||||
NestedTypeCountEnabled.Checked = remap.SearchParams.NestedTypeCount is not null
|
||||
? remap.SearchParams.NestedTypeCount >= 0
|
||||
: false;
|
||||
NestedTypeCountEnabled.Checked = remap.SearchParams.NestedTypes.NestedTypeCount >= 0;
|
||||
|
||||
ConstuctorCountUpDown.Value = (decimal)((remap.SearchParams.ConstructorParameterCount != null
|
||||
? remap.SearchParams.ConstructorParameterCount
|
||||
: 0));
|
||||
ConstuctorCountUpDown.Value = remap.SearchParams.Methods.ConstructorParameterCount;
|
||||
|
||||
MethodCountUpDown.Value = (decimal)(remap.SearchParams.MethodCount != null
|
||||
? remap.SearchParams.MethodCount
|
||||
: 0);
|
||||
MethodCountUpDown.Value = remap.SearchParams.Methods.MethodCount;
|
||||
|
||||
FieldCountUpDown.Value = (decimal)(remap.SearchParams.FieldCount != null
|
||||
? remap.SearchParams.FieldCount
|
||||
: 0);
|
||||
FieldCountUpDown.Value = remap.SearchParams.Fields.FieldCount;
|
||||
|
||||
PropertyCountUpDown.Value = (decimal)(remap.SearchParams.PropertyCount != null
|
||||
? remap.SearchParams.PropertyCount
|
||||
: 0);
|
||||
PropertyCountUpDown.Value = remap.SearchParams.Properties.PropertyCount;
|
||||
|
||||
NestedTypeCountUpDown.Value = (decimal)(remap.SearchParams.NestedTypeCount != null
|
||||
? remap.SearchParams.NestedTypeCount
|
||||
: 0);
|
||||
NestedTypeCountUpDown.Value = remap.SearchParams.NestedTypes.NestedTypeCount;
|
||||
|
||||
IsPublicComboBox.SelectedItem = remap.SearchParams.IsPublic.ToString();
|
||||
|
||||
@ -888,52 +882,52 @@ public partial class ReCodeItForm : Form
|
||||
IsNestedUpDown.BuildStringList("IsNested", false, remap.SearchParams.IsNested);
|
||||
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);
|
||||
}
|
||||
|
||||
foreach (var method in remap.SearchParams.ExcludeMethods)
|
||||
foreach (var method in remap.SearchParams.Methods.ExcludeMethods)
|
||||
{
|
||||
MethodExcludeBox.Items.Add(method);
|
||||
}
|
||||
|
||||
foreach (var method in remap.SearchParams.IncludeFields)
|
||||
foreach (var method in remap.SearchParams.Fields.IncludeFields)
|
||||
{
|
||||
FieldIncludeBox.Items.Add(method);
|
||||
}
|
||||
|
||||
foreach (var method in remap.SearchParams.ExcludeFields)
|
||||
foreach (var method in remap.SearchParams.Fields.ExcludeFields)
|
||||
{
|
||||
FieldExcludeBox.Items.Add(method);
|
||||
}
|
||||
|
||||
foreach (var method in remap.SearchParams.IncludeProperties)
|
||||
foreach (var method in remap.SearchParams.Properties.IncludeProperties)
|
||||
{
|
||||
PropertiesIncludeBox.Items.Add(method);
|
||||
}
|
||||
|
||||
foreach (var method in remap.SearchParams.ExcludeProperties)
|
||||
foreach (var method in remap.SearchParams.Properties.ExcludeProperties)
|
||||
{
|
||||
PropertiesExcludeBox.Items.Add(method);
|
||||
}
|
||||
|
||||
foreach (var method in remap.SearchParams.IncludeNestedTypes)
|
||||
foreach (var method in remap.SearchParams.NestedTypes.IncludeNestedTypes)
|
||||
{
|
||||
NestedTypesIncludeBox.Items.Add(method);
|
||||
}
|
||||
|
||||
foreach (var method in remap.SearchParams.ExcludeNestedTypes)
|
||||
foreach (var method in remap.SearchParams.NestedTypes.ExcludeNestedTypes)
|
||||
{
|
||||
NestedTypesExcludeBox.Items.Add(method);
|
||||
}
|
||||
|
||||
foreach (var method in remap.SearchParams.IncludeEvents)
|
||||
foreach (var method in remap.SearchParams.Events.IncludeEvents)
|
||||
{
|
||||
EventsIncludeBox.Items.Add(method);
|
||||
}
|
||||
|
||||
foreach (var method in remap.SearchParams.ExcludeEvents)
|
||||
foreach (var method in remap.SearchParams.Events.ExcludeEvents)
|
||||
{
|
||||
EventsExcludeBox.Items.Add(method);
|
||||
}
|
||||
|
@ -170,107 +170,107 @@ internal static class GUIHelpers
|
||||
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 =
|
||||
GenerateNodeFromList(model.SearchParams.IncludeMethods, "Include Methods");
|
||||
GenerateNodeFromList(model.SearchParams.Methods.IncludeMethods, "Include Methods");
|
||||
|
||||
remapTreeItem.Nodes.Add(includeMethodsNode);
|
||||
}
|
||||
|
||||
if (model.SearchParams.ExcludeMethods?.Count > 0)
|
||||
if (model.SearchParams.Methods.ExcludeMethods?.Count > 0)
|
||||
{
|
||||
var excludeMethodsNode =
|
||||
GenerateNodeFromList(model.SearchParams.ExcludeMethods, "Exclude Methods");
|
||||
GenerateNodeFromList(model.SearchParams.Methods.ExcludeMethods, "Exclude Methods");
|
||||
|
||||
remapTreeItem.Nodes.Add(excludeMethodsNode);
|
||||
}
|
||||
|
||||
if (model.SearchParams.IncludeFields?.Count > 0)
|
||||
if (model.SearchParams.Fields.IncludeFields?.Count > 0)
|
||||
{
|
||||
var includeFieldsNode =
|
||||
GenerateNodeFromList(model.SearchParams.IncludeFields, "Include Fields");
|
||||
GenerateNodeFromList(model.SearchParams.Fields.IncludeFields, "Include Fields");
|
||||
|
||||
remapTreeItem.Nodes.Add(includeFieldsNode);
|
||||
}
|
||||
|
||||
if (model.SearchParams.ExcludeFields?.Count > 0)
|
||||
if (model.SearchParams.Fields.ExcludeFields?.Count > 0)
|
||||
{
|
||||
var excludeFieldsNode =
|
||||
GenerateNodeFromList(model.SearchParams.ExcludeFields, "Exclude Fields");
|
||||
GenerateNodeFromList(model.SearchParams.Fields.ExcludeFields, "Exclude Fields");
|
||||
|
||||
remapTreeItem.Nodes.Add(excludeFieldsNode);
|
||||
}
|
||||
|
||||
if (model.SearchParams.IncludeProperties?.Count > 0)
|
||||
if (model.SearchParams.Properties.IncludeProperties?.Count > 0)
|
||||
{
|
||||
var includeProperties =
|
||||
GenerateNodeFromList(model.SearchParams.IncludeProperties, "Include Properties");
|
||||
GenerateNodeFromList(model.SearchParams.Properties.IncludeProperties, "Include Properties");
|
||||
|
||||
remapTreeItem.Nodes.Add(includeProperties);
|
||||
}
|
||||
|
||||
if (model.SearchParams.ExcludeProperties?.Count > 0)
|
||||
if (model.SearchParams.Properties.ExcludeProperties?.Count > 0)
|
||||
{
|
||||
var excludeProperties =
|
||||
GenerateNodeFromList(model.SearchParams.ExcludeProperties, "Exclude Properties");
|
||||
GenerateNodeFromList(model.SearchParams.Properties.ExcludeProperties, "Exclude Properties");
|
||||
|
||||
remapTreeItem.Nodes.Add(excludeProperties);
|
||||
}
|
||||
|
||||
if (model.SearchParams.IncludeNestedTypes?.Count > 0)
|
||||
if (model.SearchParams.NestedTypes.IncludeNestedTypes?.Count > 0)
|
||||
{
|
||||
var includeNestedTypes =
|
||||
GenerateNodeFromList(model.SearchParams.IncludeNestedTypes, "Include Nested Types");
|
||||
GenerateNodeFromList(model.SearchParams.NestedTypes.IncludeNestedTypes, "Include Nested Types");
|
||||
|
||||
remapTreeItem.Nodes.Add(includeNestedTypes);
|
||||
}
|
||||
|
||||
if (model.SearchParams.ExcludeNestedTypes?.Count > 0)
|
||||
if (model.SearchParams.NestedTypes.ExcludeNestedTypes?.Count > 0)
|
||||
{
|
||||
var excludeNestedTypes =
|
||||
GenerateNodeFromList(model.SearchParams.ExcludeNestedTypes, "Exclude Nested Types");
|
||||
GenerateNodeFromList(model.SearchParams.NestedTypes.ExcludeNestedTypes, "Exclude Nested Types");
|
||||
|
||||
remapTreeItem.Nodes.Add(excludeNestedTypes);
|
||||
}
|
||||
|
||||
if (model.SearchParams.IncludeEvents?.Count > 0)
|
||||
if (model.SearchParams.Events.IncludeEvents?.Count > 0)
|
||||
{
|
||||
var includeEvents =
|
||||
GenerateNodeFromList(model.SearchParams.IncludeEvents, "Include Events");
|
||||
GenerateNodeFromList(model.SearchParams.Events.IncludeEvents, "Include Events");
|
||||
|
||||
remapTreeItem.Nodes.Add(includeEvents);
|
||||
}
|
||||
|
||||
if (model.SearchParams.ExcludeEvents?.Count > 0)
|
||||
if (model.SearchParams.Events.ExcludeEvents?.Count > 0)
|
||||
{
|
||||
var excludeEvents =
|
||||
GenerateNodeFromList(model.SearchParams.ExcludeEvents, "Exclude Events");
|
||||
GenerateNodeFromList(model.SearchParams.Events.ExcludeEvents, "Exclude Events");
|
||||
|
||||
remapTreeItem.Nodes.Add(excludeEvents);
|
||||
}
|
||||
|
@ -80,33 +80,49 @@ public class SearchParams
|
||||
public string? IgnoreBaseClass { get; set; } = null;
|
||||
|
||||
#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
|
||||
|
||||
public List<string> IncludeMethods { get; init; } = [];
|
||||
public List<string> ExcludeMethods { get; init; } = [];
|
||||
public List<string> IncludeFields { get; init; } = [];
|
||||
public List<string> ExcludeFields { get; init; } = [];
|
||||
public List<string> IncludeProperties { get; init; } = [];
|
||||
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; } = [];
|
||||
|
||||
public MethodParams Methods { get; set; } = new();
|
||||
public FieldParams Fields { get; set; } = new();
|
||||
public PropertyParams Properties { get; set; } = new();
|
||||
public NestedTypeParams NestedTypes { get; set; } = new();
|
||||
public EventParams Events { get; set; } = new();
|
||||
|
||||
#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>
|
||||
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 =>
|
||||
{
|
||||
@ -23,7 +23,7 @@ internal static class CtorTypeFilters
|
||||
// Ensure Parameters isn't null before checking Count
|
||||
var parameters = ctor.Parameters;
|
||||
// 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>
|
||||
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 = [];
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
if (parms.IncludeEvents
|
||||
if (parms.Events.IncludeEvents
|
||||
.All(includeName => type.Events
|
||||
.Any(ev => ev.Name.String == includeName)))
|
||||
{
|
||||
@ -38,14 +38,14 @@ internal static class EventTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
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 = [];
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
var match = type.Events
|
||||
.Where(prop => parms.ExcludeEvents.Contains(prop.Name.String));
|
||||
.Where(prop => parms.Events.ExcludeEvents.Contains(prop.Name.String));
|
||||
|
||||
if (!match.Any())
|
||||
{
|
||||
|
@ -13,13 +13,13 @@ internal static class FieldTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
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 = [];
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
if (parms.IncludeFields
|
||||
if (parms.Fields.IncludeFields
|
||||
.All(includeName => type.Fields
|
||||
.Any(field => field.Name.String == includeName)))
|
||||
{
|
||||
@ -38,14 +38,14 @@ internal static class FieldTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
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 = [];
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
var match = type.Fields
|
||||
.Where(field => parms.ExcludeFields.Contains(field.Name.String));
|
||||
.Where(field => parms.Fields.ExcludeFields.Contains(field.Name.String));
|
||||
|
||||
if (!match.Any())
|
||||
{
|
||||
@ -64,11 +64,11 @@ internal static class FieldTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
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;
|
||||
|
@ -13,13 +13,13 @@ internal static class MethodTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
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 = [];
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
if (parms.IncludeMethods
|
||||
if (parms.Methods.IncludeMethods
|
||||
.All(includeName => type.Methods
|
||||
.Any(method => method.Name.String == includeName)))
|
||||
{
|
||||
@ -38,14 +38,14 @@ internal static class MethodTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
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 = [];
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
var match = type.Methods
|
||||
.Where(method => parms.ExcludeMethods.Contains(method.Name.String));
|
||||
.Where(method => parms.Methods.ExcludeMethods.Contains(method.Name.String));
|
||||
|
||||
if (!match.Any())
|
||||
{
|
||||
@ -64,11 +64,11 @@ internal static class MethodTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
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;
|
||||
|
@ -13,13 +13,13 @@ internal static class NestedTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
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 = [];
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
if (parms.IncludeNestedTypes
|
||||
if (parms.NestedTypes.IncludeNestedTypes
|
||||
.All(includeName => type.NestedTypes
|
||||
.Any(nestedType => nestedType.Name.String == includeName)))
|
||||
{
|
||||
@ -38,14 +38,14 @@ internal static class NestedTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
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 = [];
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
var match = type.Fields
|
||||
.Where(field => parms.ExcludeNestedTypes.Contains(field.Name.String));
|
||||
.Where(field => parms.NestedTypes.ExcludeNestedTypes.Contains(field.Name.String));
|
||||
|
||||
if (!match.Any())
|
||||
{
|
||||
@ -64,11 +64,9 @@ internal static class NestedTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
public static IEnumerable<TypeDef> FilterByCount(IEnumerable<TypeDef> types, SearchParams parms)
|
||||
{
|
||||
if (parms.NestedTypeCount is null) return types;
|
||||
|
||||
if (parms.NestedTypeCount >= 0)
|
||||
if (parms.NestedTypes.NestedTypeCount >= 0)
|
||||
{
|
||||
types = types.Where(t => t.NestedTypes.Count == parms.NestedTypeCount);
|
||||
types = types.Where(t => t.NestedTypes.Count == parms.NestedTypes.NestedTypeCount);
|
||||
}
|
||||
|
||||
return types;
|
||||
|
@ -13,13 +13,13 @@ internal static class PropertyTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
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 = [];
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
if (parms.IncludeProperties
|
||||
if (parms.Properties.IncludeProperties
|
||||
.All(includeName => type.Properties
|
||||
.Any(prop => prop.Name.String == includeName)))
|
||||
{
|
||||
@ -38,14 +38,14 @@ internal static class PropertyTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
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 = [];
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
var match = type.Properties
|
||||
.Where(prop => parms.ExcludeProperties.Contains(prop.Name.String));
|
||||
.Where(prop => parms.Properties.ExcludeProperties.Contains(prop.Name.String));
|
||||
|
||||
if (!match.Any())
|
||||
{
|
||||
@ -64,11 +64,11 @@ internal static class PropertyTypeFilters
|
||||
/// <returns>Filtered list</returns>
|
||||
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;
|
||||
|
@ -37,7 +37,7 @@ public static class DataProvider
|
||||
|
||||
Settings = JsonConvert.DeserializeObject<Settings>(jsonText, settings);
|
||||
}
|
||||
|
||||
|
||||
public static void SaveAppSettings()
|
||||
{
|
||||
if (IsCli) { return; }
|
||||
@ -73,10 +73,30 @@ public static class DataProvider
|
||||
var jsonText = File.ReadAllText(path);
|
||||
|
||||
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()
|
||||
{
|
||||
JsonSerializerSettings settings = new()
|
||||
|
Loading…
x
Reference in New Issue
Block a user