Browse Source

Expose AcceptableValueList.AcceptableValues

ManlyMarco 5 years ago
parent
commit
6abda092cb
1 changed files with 8 additions and 5 deletions
  1. 8 5
      BepInEx/Configuration/AcceptableValueList.cs

+ 8 - 5
BepInEx/Configuration/AcceptableValueList.cs

@@ -8,7 +8,10 @@ namespace BepInEx.Configuration
 	/// </summary>
 	public sealed class AcceptableValueList<T> : AcceptableValueBase where T : IEquatable<T>
 	{
-		private readonly T[] _acceptableValues;
+		/// <summary>
+		/// List of values that a setting can take.
+		/// </summary>
+		public T[] AcceptableValues { get; }
 
 		/// <summary>
 		/// Specify the list of acceptable values for a setting.
@@ -19,7 +22,7 @@ namespace BepInEx.Configuration
 			if (acceptableValues == null) throw new ArgumentNullException(nameof(acceptableValues));
 			if (acceptableValues.Length == 0) throw new ArgumentException("At least one acceptable value is needed", nameof(acceptableValues));
 
-			_acceptableValues = acceptableValues;
+			AcceptableValues = acceptableValues;
 		}
 
 		/// <inheritdoc />
@@ -28,19 +31,19 @@ namespace BepInEx.Configuration
 			if (IsValid(value))
 				return value;
 
-			return _acceptableValues[0];
+			return AcceptableValues[0];
 		}
 
 		/// <inheritdoc />
 		public override bool IsValid(object value)
 		{
-			return value is T v && _acceptableValues.Any(x => x.Equals(v));
+			return value is T v && AcceptableValues.Any(x => x.Equals(v));
 		}
 
 		/// <inheritdoc />
 		public override string ToSerializedString()
 		{
-			return "# Acceptable values: " + string.Join(", ", _acceptableValues.Select(x => x.ToString()).ToArray());
+			return "# Acceptable values: " + string.Join(", ", AcceptableValues.Select(x => x.ToString()).ToArray());
 		}
 	}
 }