2024-06-19 17:44:47 -04:00
|
|
|
|
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
|
|
|
|
{
|
2024-12-31 03:13:29 -05:00
|
|
|
|
private AppSettings? _appSettings;
|
2024-06-19 17:44:47 -04:00
|
|
|
|
|
2024-12-31 03:13:29 -05:00
|
|
|
|
public AppSettings? AppSettings
|
2024-06-19 17:44:47 -04:00
|
|
|
|
{
|
|
|
|
|
get { return _appSettings; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_appSettings = value;
|
|
|
|
|
Save();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-31 03:13:29 -05:00
|
|
|
|
private RemapperSettings? _remapper;
|
2024-06-19 17:44:47 -04:00
|
|
|
|
|
2024-12-31 03:13:29 -05:00
|
|
|
|
public RemapperSettings? Remapper
|
2024-06-19 17:44:47 -04:00
|
|
|
|
{
|
|
|
|
|
get { return _remapper; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_remapper = value;
|
|
|
|
|
Save();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-09 23:31:30 -04:00
|
|
|
|
|
2024-06-19 17:44:47 -04:00
|
|
|
|
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
|
|
|
|
{
|
2024-06-19 17:44:47 -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
|
|
|
|
|
{
|
2024-12-31 03:13:29 -05:00
|
|
|
|
private string _assemblyPath = string.Empty;
|
2024-06-19 17:44:47 -04:00
|
|
|
|
|
2024-06-17 19:14:47 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Path to the assembly we want to remap
|
|
|
|
|
/// </summary>
|
2024-06-19 17:44:47 -04:00
|
|
|
|
public string AssemblyPath
|
|
|
|
|
{
|
|
|
|
|
get { return _assemblyPath; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_assemblyPath = value;
|
|
|
|
|
Save();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-31 03:13:29 -05:00
|
|
|
|
private string _outputPath = string.Empty;
|
2024-06-17 19:14:47 -04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Path including the filename and extension we want to write the changes to
|
|
|
|
|
/// </summary>
|
2024-06-19 17:44:47 -04:00
|
|
|
|
public string OutputPath
|
|
|
|
|
{
|
|
|
|
|
get { return _outputPath; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_outputPath = value;
|
|
|
|
|
Save();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-31 03:13:29 -05:00
|
|
|
|
private string _mappingPath = string.Empty;
|
2024-06-17 19:14:47 -04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Path to the mapping file
|
|
|
|
|
/// </summary>
|
2024-06-19 17:44:47 -04:00
|
|
|
|
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>
|
2024-06-19 17:44:47 -04:00
|
|
|
|
public bool UseProjectMappings
|
|
|
|
|
{
|
|
|
|
|
get { return _useProjectMappings; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_useProjectMappings = value;
|
|
|
|
|
Save();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-31 03:13:29 -05:00
|
|
|
|
private MappingSettings? _mappingSettings;
|
2024-06-19 17:44:47 -04:00
|
|
|
|
|
2024-12-31 03:13:29 -05:00
|
|
|
|
public MappingSettings? MappingSettings
|
2024-06-19 17:44:47 -04:00
|
|
|
|
{
|
|
|
|
|
get { return _mappingSettings; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_mappingSettings = value;
|
|
|
|
|
Save();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-06-18 23:45:00 -04:00
|
|
|
|
|
2024-12-31 03:13:29 -05:00
|
|
|
|
private List<string> _tokensToMatch = [];
|
2024-06-15 16:21:12 -04:00
|
|
|
|
|
2024-06-17 19:14:47 -04:00
|
|
|
|
/// <summary>
|
2024-12-31 03:28:46 -05:00
|
|
|
|
/// The re-mapper will look for these tokens in class names, otherwise they will be skipped
|
2024-06-17 19:14:47 -04:00
|
|
|
|
/// </summary>
|
2024-06-19 17:44:47 -04:00
|
|
|
|
public List<string> TokensToMatch
|
|
|
|
|
{
|
|
|
|
|
get { return _tokensToMatch; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_tokensToMatch = value;
|
|
|
|
|
Save();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-31 03:28:46 -05:00
|
|
|
|
|
2024-06-19 17:44:47 -04:00
|
|
|
|
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
|
|
|
|
|
{
|
2024-06-19 17:44:47 -04:00
|
|
|
|
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>
|
2024-06-19 17:44:47 -04:00
|
|
|
|
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>
|
2024-06-19 17:44:47 -04:00
|
|
|
|
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>
|
2024-06-19 17:44:47 -04:00
|
|
|
|
public bool Publicize
|
|
|
|
|
{
|
|
|
|
|
get { return _publicize; }
|
|
|
|
|
set
|
|
|
|
|
{
|
2024-06-22 01:27:34 -04:00
|
|
|
|
_publicize = value;
|
2024-06-19 17:44:47 -04:00
|
|
|
|
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>
|
2024-06-19 17:44:47 -04:00
|
|
|
|
public bool Unseal
|
|
|
|
|
{
|
|
|
|
|
get { return _unseal; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_unseal = value;
|
|
|
|
|
Save();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Save()
|
|
|
|
|
{
|
|
|
|
|
DataProvider.SaveAppSettings();
|
|
|
|
|
}
|
2024-06-11 19:18:48 -04:00
|
|
|
|
}
|