refactor: ObfuzSettingsProvider draws all fields by reflection
parent
0b6b8a92c0
commit
c143f6b7e6
|
|
@ -44,27 +44,6 @@ namespace Obfuz.Settings
|
|||
|
||||
|
||||
private SerializedObject _serializedObject;
|
||||
private SerializedProperty _buildPipelineSettings;
|
||||
private SerializedProperty _compatibilitySettings;
|
||||
|
||||
private SerializedProperty _assemblySettings;
|
||||
private SerializedProperty _obfuscationPassSettings;
|
||||
private SerializedProperty _secretSettings;
|
||||
private SerializedProperty _encryptionVMSettings;
|
||||
|
||||
private SerializedProperty _symbolObfusSettings;
|
||||
private SerializedProperty _constEncryptSettings;
|
||||
private SerializedProperty _removeConstFieldSettings;
|
||||
private SerializedProperty _evalStackObfusSettings;
|
||||
private SerializedProperty _fieldEncryptSettings;
|
||||
private SerializedProperty _callObfusSettings;
|
||||
private SerializedProperty _exprObfusSettings;
|
||||
private SerializedProperty _controlFlowObfusSettings;
|
||||
|
||||
private SerializedProperty _garbageCodeGenerationSettings;
|
||||
private SerializedProperty _watermarkSettings;
|
||||
|
||||
private SerializedProperty _polymorphicDllSettings;
|
||||
|
||||
public ObfuzSettingsProvider() : base("Project/Obfuz", SettingsScope.Project)
|
||||
{
|
||||
|
|
@ -86,28 +65,6 @@ namespace Obfuz.Settings
|
|||
var setting = ObfuzSettings.Instance;
|
||||
_serializedObject?.Dispose();
|
||||
_serializedObject = new SerializedObject(setting);
|
||||
_buildPipelineSettings = _serializedObject.FindProperty("buildPipelineSettings");
|
||||
_compatibilitySettings = _serializedObject.FindProperty("compatibilitySettings");
|
||||
|
||||
_assemblySettings = _serializedObject.FindProperty("assemblySettings");
|
||||
_obfuscationPassSettings = _serializedObject.FindProperty("obfuscationPassSettings");
|
||||
_secretSettings = _serializedObject.FindProperty("secretSettings");
|
||||
|
||||
_encryptionVMSettings = _serializedObject.FindProperty("encryptionVMSettings");
|
||||
|
||||
_symbolObfusSettings = _serializedObject.FindProperty("symbolObfusSettings");
|
||||
_constEncryptSettings = _serializedObject.FindProperty("constEncryptSettings");
|
||||
_removeConstFieldSettings = _serializedObject.FindProperty("removeConstFieldSettings");
|
||||
_evalStackObfusSettings = _serializedObject.FindProperty("evalStackObfusSettings");
|
||||
_exprObfusSettings = _serializedObject.FindProperty("exprObfusSettings");
|
||||
_fieldEncryptSettings = _serializedObject.FindProperty("fieldEncryptSettings");
|
||||
_callObfusSettings = _serializedObject.FindProperty("callObfusSettings");
|
||||
_controlFlowObfusSettings = _serializedObject.FindProperty("controlFlowObfusSettings");
|
||||
|
||||
_garbageCodeGenerationSettings = _serializedObject.FindProperty("garbageCodeGenerationSettings");
|
||||
_watermarkSettings = _serializedObject.FindProperty("watermarkSettings");
|
||||
|
||||
_polymorphicDllSettings = _serializedObject.FindProperty("polymorphicDllSettings");
|
||||
}
|
||||
|
||||
public override void OnGUI(string searchContext)
|
||||
|
|
@ -119,28 +76,22 @@ namespace Obfuz.Settings
|
|||
_serializedObject.Update();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUILayout.PropertyField(_buildPipelineSettings);
|
||||
EditorGUILayout.PropertyField(_compatibilitySettings);
|
||||
using (var prop = _serializedObject.GetIterator())
|
||||
{
|
||||
if (prop.NextVisible(true))
|
||||
{
|
||||
do
|
||||
{
|
||||
if (prop.name == "m_Script")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(_assemblySettings);
|
||||
EditorGUILayout.PropertyField(_obfuscationPassSettings);
|
||||
EditorGUILayout.PropertyField(_secretSettings);
|
||||
|
||||
EditorGUILayout.PropertyField(_encryptionVMSettings);
|
||||
|
||||
EditorGUILayout.PropertyField(_symbolObfusSettings);
|
||||
EditorGUILayout.PropertyField(_constEncryptSettings);
|
||||
EditorGUILayout.PropertyField(_removeConstFieldSettings);
|
||||
EditorGUILayout.PropertyField(_evalStackObfusSettings);
|
||||
EditorGUILayout.PropertyField(_exprObfusSettings);
|
||||
EditorGUILayout.PropertyField(_fieldEncryptSettings);
|
||||
EditorGUILayout.PropertyField(_callObfusSettings);
|
||||
EditorGUILayout.PropertyField(_controlFlowObfusSettings);
|
||||
|
||||
EditorGUILayout.PropertyField(_garbageCodeGenerationSettings);
|
||||
EditorGUILayout.PropertyField(_watermarkSettings);
|
||||
|
||||
EditorGUILayout.PropertyField(_polymorphicDllSettings);
|
||||
EditorGUILayout.PropertyField(prop, true);
|
||||
}
|
||||
while (prop.NextVisible(false));
|
||||
}
|
||||
}
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue