private static bool DisplaySwitch(DiagnosticSwitch diagnosticSwitch)
{
GUIContent label = new GUIContent(diagnosticSwitch.name, diagnosticSwitch.name + "\n\n" + diagnosticSwitch.description);
bool flag = !object.Equals(diagnosticSwitch.value, diagnosticSwitch.persistentValue);
EditorGUI.BeginChangeCheck();
using (new EditorGUILayout.HorizontalScope(new GUILayoutOption[0]))
{
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(true) };
Rect position = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.label, options);
Rect rect2 = new Rect(position.x, position.y, position.height, position.height);
position.xMin += rect2.width + 3f;
if (flag && (Event.current.type == EventType.Repaint))
{
GUI.DrawTexture(rect2, s_Resources.smallWarningIcon);
}
if (diagnosticSwitch.value is bool)
{
diagnosticSwitch.persistentValue = EditorGUI.Toggle(position, label, (bool) diagnosticSwitch.persistentValue);
}
else if (diagnosticSwitch.enumInfo != null)
{
if (diagnosticSwitch.enumInfo.isFlags)
{
int num = 0;
foreach (int num2 in diagnosticSwitch.enumInfo.values)
{
num |= num2;
}
string[] names = diagnosticSwitch.enumInfo.names;
int[] values = diagnosticSwitch.enumInfo.values;
if (diagnosticSwitch.enumInfo.values[0] == 0)
{
names = new string[names.Length - 1];
values = new int[values.Length - 1];
Array.Copy(diagnosticSwitch.enumInfo.names, 1, names, 0, names.Length);
Array.Copy(diagnosticSwitch.enumInfo.values, 1, values, 0, values.Length);
}
diagnosticSwitch.persistentValue = EditorGUI.MaskFieldInternal(position, label, (int) diagnosticSwitch.persistentValue, names, values, EditorStyles.popup) & num;
}
else
{
diagnosticSwitch.persistentValue = EditorGUI.IntPopup(position, label, (int) diagnosticSwitch.persistentValue, diagnosticSwitch.enumInfo.guiNames, diagnosticSwitch.enumInfo.values);
}
}
else if (diagnosticSwitch.value is uint)
{
uint minValue = (uint) diagnosticSwitch.minValue;
uint maxValue = (uint) diagnosticSwitch.maxValue;
if ((((maxValue - minValue) <= 10) && ((maxValue - minValue) > 0)) && ((minValue < 0x7fffffff) && (maxValue < 0x7fffffff)))
{
diagnosticSwitch.persistentValue = (uint) EditorGUI.IntSlider(position, label, (int) ((uint) diagnosticSwitch.persistentValue), (int) minValue, (int) maxValue);
}
else
{
diagnosticSwitch.persistentValue = (uint) EditorGUI.IntField(position, label, (int) ((uint) diagnosticSwitch.persistentValue));
}
}
else if (diagnosticSwitch.value is string)
{
diagnosticSwitch.persistentValue = EditorGUI.TextField(position, label, (string) diagnosticSwitch.persistentValue);
}
}
if (EditorGUI.EndChangeCheck())
{
Debug.SetDiagnosticSwitch(diagnosticSwitch.name, diagnosticSwitch.persistentValue, true);
}
return flag;
}