AssemblyTool/RecodeItLib/Models/AppSettingsModel.cs

451 lines
8.9 KiB
C#
Raw Normal View History

using ReCodeIt.Utils;
namespace ReCodeIt.Models;
2024-06-11 19:18:48 -04:00
/// <summary>
2024-06-17 18:19:17 -04:00
/// All settings container
2024-06-11 19:18:48 -04:00
/// </summary>
2024-06-13 18:15:52 -04:00
public class Settings
2024-06-13 17:55:06 -04:00
{
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 CrossCompilerSettings _crossCompiler;
public CrossCompilerSettings CrossCompiler
{
get { return _crossCompiler; }
set
{
_crossCompiler = value;
Save();
}
}
private void Save()
{
DataProvider.SaveAppSettings();
}
2024-06-13 17:55:06 -04:00
}
2024-06-17 18:19:17 -04:00
/// <summary>
/// These are settings for the application
/// </summary>
2024-06-13 18:15:52 -04:00
public class AppSettings
2024-06-11 19:18:48 -04:00
{
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();
}
2024-06-17 17:29:26 -04:00
}
2024-06-17 18:19:17 -04:00
/// <summary>
/// These are settings for the manual remapper
/// </summary>
2024-06-17 17:29:26 -04:00
public class RemapperSettings
{
private string _assemblyPath;
2024-06-17 19:14:47 -04:00
/// <summary>
/// Path to the assembly we want to remap
/// </summary>
public string AssemblyPath
{
get { return _assemblyPath; }
set
{
_assemblyPath = value;
Save();
}
}
private string _outputPath;
2024-06-17 19:14:47 -04:00
/// <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 string _mappingPath;
2024-06-17 19:14:47 -04:00
/// <summary>
/// Path to the mapping file
/// </summary>
public string MappingPath
{
get { return _mappingPath; }
set
{
_mappingPath = value;
Save();
}
}
private bool _useProjectMappings;
2024-06-17 19:14:47 -04:00
2024-06-18 23:45:00 -04:00
/// <summary>
/// Use the projects mappings instead of a standalone file
/// </summary>
public bool UseProjectMappings
{
get { return _useProjectMappings; }
set
{
_useProjectMappings = value;
Save();
}
}
private MappingSettings _mappingSettings;
public MappingSettings MappingSettings
{
get { return _mappingSettings; }
set
{
_mappingSettings = value;
Save();
}
}
2024-06-18 23:45:00 -04:00
private void Save()
{
DataProvider.SaveAppSettings();
}
2024-06-14 18:07:01 -04:00
}
2024-06-11 19:18:48 -04:00
2024-06-17 18:19:17 -04:00
/// <summary>
/// These are settings for the auto mapping
/// </summary>
2024-06-13 18:15:52 -04:00
public class AutoMapperSettings
2024-06-13 17:55:06 -04:00
{
private string _assemblyPath;
2024-06-17 19:14:47 -04:00
/// <summary>
/// Path to the assembly we want to remap
/// </summary>
public string AssemblyPath
{
get { return _assemblyPath; }
set
{
_assemblyPath = value;
Save();
}
}
private string _outputPath;
2024-06-17 19:14:47 -04:00
/// <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;
2024-06-17 19:14:47 -04:00
/// <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;
2024-06-17 19:14:47 -04:00
/// <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;
2024-06-17 19:14:47 -04:00
/// <summary>
/// Will attempt to map types from method meta data and parameters
/// </summary>
public bool SearchMethods
{
get { return _searchMethods; }
set
{
_searchMethods = value;
Save();
}
}
2024-06-17 19:14:47 -04:00
private MappingSettings _mappingSettings;
public MappingSettings MappingSettings
{
get { return _mappingSettings; }
set
{
_mappingSettings = value;
Save();
}
}
private List<string> _typesToIgnore;
2024-06-17 19:14:47 -04:00
/// <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;
2024-06-15 16:21:12 -04:00
2024-06-17 19:14:47 -04:00
/// <summary>
/// The auto mapper will look for these tokens in class names and prioritize those
/// </summary>
public List<string> TokensToMatch
{
get { return _tokensToMatch; }
set
{
_tokensToMatch = value;
Save();
}
}
private List<string> _propertyFieldBlacklist;
2024-06-15 16:45:34 -04:00
2024-06-17 19:14:47 -04:00
/// <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> _methodParamaterBlackList;
2024-06-16 16:21:42 -04:00
2024-06-17 19:14:47 -04:00
/// <summary>
/// method parameter names to ignore in the automap, these are case sanitized so case does not matter
/// </summary>
public List<string> MethodParamaterBlackList
{
get { return _methodParamaterBlackList; }
set
{
_methodParamaterBlackList = value;
Save();
}
}
private void Save()
{
DataProvider.SaveAppSettings();
}
2024-06-17 18:19:17 -04:00
}
/// <summary>
2024-06-18 17:35:31 -04:00
/// These are settings for the cross compiler module
2024-06-17 18:19:17 -04:00
/// </summary>
2024-06-18 17:35:31 -04:00
public class CrossCompilerSettings
2024-06-17 18:19:17 -04:00
{
private string _lastLoadedProject;
2024-06-17 19:14:47 -04:00
/// <summary>
/// Last Loaded Project Path
2024-06-17 19:14:47 -04:00
/// </summary>
public string LastLoadedProject
{
get { return _lastLoadedProject; }
set
{
_lastLoadedProject = value;
Save();
}
}
private bool _autoLoadLastActiveProj;
2024-06-18 21:06:37 -04:00
/// <summary>
/// Should the last active project be auto loaded
/// </summary>
public bool AutoLoadLastActiveProject
{
get { return _autoLoadLastActiveProj; }
set
{
_autoLoadLastActiveProj = value;
Save();
}
}
private void Save()
{
DataProvider.SaveAppSettings();
}
2024-06-17 18:19:17 -04:00
}
/// <summary>
/// These are settings that all versions of the remappers use
/// </summary>
public class MappingSettings
{
private bool _renameFields;
2024-06-17 19:14:47 -04:00
/// <summary>
/// Names of fields of the matched type will be renamed to the type name with approproiate convention
/// </summary>
public bool RenameFields
{
get { return _renameFields; }
set
{
_renameFields = value;
Save();
}
}
private bool _renameProps;
2024-06-17 19:14:47 -04:00
/// <summary>
/// Names of properties of the matched type will be renamed to the type name with approproiate convention
/// </summary>
public bool RenameProperties
{
get { return _renameProps; }
set
{
_renameProps = value;
Save();
}
}
private bool _publicize;
2024-06-17 19:14:47 -04:00
/// <summary>
/// Publicize all types, methods, and properties : NOTE: Not run until after the remap has completed
/// </summary>
public bool Publicize
{
get { return _publicize; }
set
{
_unseal = value;
Save();
}
}
private bool _unseal;
2024-06-17 19:14:47 -04:00
/// <summary>
/// Unseal all types : NOTE: Not run until after the remap has completed
/// </summary>
public bool Unseal
{
get { return _unseal; }
set
{
_unseal = value;
Save();
}
}
private void Save()
{
DataProvider.SaveAppSettings();
}
2024-06-11 19:18:48 -04:00
}