using ReCodeIt.Utils;
namespace ReCodeIt.Models;
///
/// All settings container
///
public class Settings
{
private AppSettings? _appSettings;
public AppSettings? AppSettings
{
get { return _appSettings; }
set
{
_appSettings = value;
Save();
}
}
private RemapperSettings? _remapper;
public RemapperSettings? Remapper
{
get { return _remapper; }
set
{
_remapper = value;
Save();
}
}
private AutoMapperSettings? _autoMapper;
public AutoMapperSettings? AutoMapper
{
get { return _autoMapper; }
set
{
_autoMapper = value;
Save();
}
}
private void Save()
{
DataProvider.SaveAppSettings();
}
}
///
/// These are settings for the application
///
public class AppSettings
{
private bool _debug;
public bool Debug
{
get { return _debug; }
set
{
_debug = value;
Save();
}
}
private bool _silentMode;
public bool SilentMode
{
get { return _silentMode; }
set
{
_silentMode = value;
Save();
}
}
private void Save()
{
DataProvider.SaveAppSettings();
}
}
///
/// These are settings for the manual remapper
///
public class RemapperSettings
{
private string _assemblyPath = string.Empty;
///
/// Path to the assembly we want to remap
///
public string AssemblyPath
{
get { return _assemblyPath; }
set
{
_assemblyPath = value;
Save();
}
}
private string _outputPath = string.Empty;
///
/// Path including the filename and extension we want to write the changes to
///
public string OutputPath
{
get { return _outputPath; }
set
{
_outputPath = value;
Save();
}
}
private string _mappingPath = string.Empty;
///
/// Path to the mapping file
///
public string MappingPath
{
get { return _mappingPath; }
set
{
_mappingPath = value;
Save();
}
}
private bool _useProjectMappings;
///
/// Use the projects mappings instead of a standalone file
///
public bool UseProjectMappings
{
get { return _useProjectMappings; }
set
{
_useProjectMappings = value;
Save();
}
}
private MappingSettings? _mappingSettings;
public MappingSettings? MappingSettings
{
get { return _mappingSettings; }
set
{
_mappingSettings = value;
Save();
}
}
private void Save()
{
DataProvider.SaveAppSettings();
}
}
///
/// These are settings for the auto mapping
///
public class AutoMapperSettings
{
private string _assemblyPath = string.Empty;
///
/// Path to the assembly we want to remap
///
public string AssemblyPath
{
get { return _assemblyPath; }
set
{
_assemblyPath = value;
Save();
}
}
private string _outputPath = string.Empty;
///
/// Path including the filename and extension we want to write the changes to
///
public string OutputPath
{
get { return _outputPath; }
set
{
_outputPath = value;
Save();
}
}
private int _requiredMatches;
///
/// Minimum number of times a member must have this name in the assembly before considering it
/// for remapping
///
public int RequiredMatches
{
get { return _requiredMatches; }
set
{
_requiredMatches = value;
Save();
}
}
private int _minLengthToMatch;
///
/// Minimum length of the field/property name in code before it will be considered for a rename
///
public int MinLengthToMatch
{
get { return _minLengthToMatch; }
set
{
_minLengthToMatch = value;
Save();
}
}
private bool _searchMethods;
///
/// Will attempt to map types from method meta data and parameters
///
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 _typesToIgnore = [];
///
/// Any member name you want to ignore while iterating through the assembly
///
public List TypesToIgnore
{
get { return _typesToIgnore; }
set
{
_typesToIgnore = value;
Save();
}
}
private List _tokensToMatch = [];
///
/// The auto mapper will look for these tokens in class names and prioritize those
///
public List TokensToMatch
{
get { return _tokensToMatch; }
set
{
_tokensToMatch = value;
Save();
}
}
private List _propertyFieldBlacklist = [];
///
/// Property or fields names to ignore in the automap, these are case sanitized so case does not matter
///
public List PropertyFieldBlackList
{
get { return _propertyFieldBlacklist; }
set
{
_propertyFieldBlacklist = value;
Save();
}
}
private List _methodParameterBlackList = [];
///
/// method parameter names to ignore in the automap, these are case sanitized so case does not matter
///
public List MethodParameterBlackList
{
get { return _methodParameterBlackList; }
set
{
_methodParameterBlackList = value;
Save();
}
}
private void Save()
{
DataProvider.SaveAppSettings();
}
}
///
/// These are settings that all versions of the remappers use
///
public class MappingSettings
{
private bool _renameFields;
///
/// Names of fields of the matched type will be renamed to the type name with approproiate convention
///
public bool RenameFields
{
get { return _renameFields; }
set
{
_renameFields = value;
Save();
}
}
private bool _renameProps;
///
/// Names of properties of the matched type will be renamed to the type name with approproiate convention
///
public bool RenameProperties
{
get { return _renameProps; }
set
{
_renameProps = value;
Save();
}
}
private bool _publicize;
///
/// Publicize all types, methods, and properties : NOTE: Not run until after the remap has completed
///
public bool Publicize
{
get { return _publicize; }
set
{
_publicize = value;
Save();
}
}
private bool _unseal;
///
/// Unseal all types : NOTE: Not run until after the remap has completed
///
public bool Unseal
{
get { return _unseal; }
set
{
_unseal = value;
Save();
}
}
private void Save()
{
DataProvider.SaveAppSettings();
}
}