mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
clamp monitor index
This commit is contained in:
@@ -178,7 +178,16 @@ internal sealed class LaunchOptions : DbStoreOptions
|
||||
[AllowNull]
|
||||
public NameValue<int> Monitor
|
||||
{
|
||||
get => GetOption(ref monitor, SettingEntry.LaunchMonitor, index => Monitors[int.Parse(index, CultureInfo.InvariantCulture) - 1], Monitors[0]);
|
||||
get
|
||||
{
|
||||
return GetOption(ref monitor, SettingEntry.LaunchMonitor, index => Monitors[RestrictIndex(Monitors, index)], Monitors[0]);
|
||||
|
||||
static int RestrictIndex(List<NameValue<int>> monitors, string index)
|
||||
{
|
||||
return Math.Clamp(int.Parse(index, CultureInfo.InvariantCulture) - 1, 0, monitors.Count);
|
||||
}
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value is not null)
|
||||
|
||||
Reference in New Issue
Block a user