Deprecate ReservedPlayers in Torch cfg

Add a scrollpanel to fix clipped controls
This commit is contained in:
Brant Martin
2019-01-10 21:35:48 -05:00
parent f990d27851
commit 8b7a07ffe7
4 changed files with 99 additions and 83 deletions

View File

@@ -167,6 +167,16 @@ namespace Torch.Server.Managers
public void SaveConfig() public void SaveConfig()
{ {
var cf = Torch.Config as TorchConfig;
if (cf?.ReservedPlayers?.Count > 0)
{
foreach (var res in cf.ReservedPlayers)
{
if (!DedicatedConfig.Reserved.Contains(res))
DedicatedConfig.Reserved.Add(res);
}
}
DedicatedConfig.Save(Path.Combine(Torch.Config.InstancePath, CONFIG_NAME)); DedicatedConfig.Save(Path.Combine(Torch.Config.InstancePath, CONFIG_NAME));
Log.Info("Saved dedicated config."); Log.Info("Saved dedicated config.");

View File

@@ -219,8 +219,7 @@ namespace Torch.Server.Managers
_log.Warn($"Rejecting user {info.SteamID} because they are not whitelisted in Torch.cfg."); _log.Warn($"Rejecting user {info.SteamID} because they are not whitelisted in Torch.cfg.");
internalAuth = JoinResult.NotInGroup; internalAuth = JoinResult.NotInGroup;
} }
else if (config.EnableReservedSlots && (config.ReservedPlayers.Contains(info.SteamID) || else if (MySandboxGame.ConfigDedicated.Reserved.Contains(info.SteamID))
MySandboxGame.ConfigDedicated.Reserved.Contains(info.SteamID)))
internalAuth = JoinResult.OK; internalAuth = JoinResult.OK;
//Admins can bypass member limit //Admins can bypass member limit
else if (MySandboxGame.ConfigDedicated.Administrators.Contains(info.SteamID.ToString()) || else if (MySandboxGame.ConfigDedicated.Administrators.Contains(info.SteamID.ToString()) ||

View File

@@ -68,9 +68,14 @@ namespace Torch.Server
public string LastUsedTheme { get; set; } = "Torch Theme"; public string LastUsedTheme { get; set; } = "Torch Theme";
public bool EnableReservedSlots { get; set; } = false; //TODO: REMOVE ME BY JULY 2019
[Obsolete("Use vanilla reserved slot config")]
public HashSet<ulong> ReservedPlayers { get; set; } = new HashSet<ulong>(); public HashSet<ulong> ReservedPlayers { get; set; } = new HashSet<ulong>();
//Prevent reserved players being written to disk, but allow it to bre read
//remove this when ReservedPlayers is removed
private bool ShouldSerializeReservedPlayers() => false;
[XmlIgnore] [XmlIgnore]
private string _path; private string _path;

View File

@@ -58,6 +58,7 @@
<RowDefinition /> <RowDefinition />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
@@ -139,6 +140,7 @@
</TextBox> </TextBox>
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer>
<Button Grid.Row="1" Content="Save Config" Margin="3" Click="Save_OnClick" /> <Button Grid.Row="1" Content="Save Config" Margin="3" Click="Save_OnClick" />
</Grid> </Grid>
<views:PropertyGrid Grid.Column="1" Margin="3" DataContext="{Binding SessionSettings}" IgnoreDisplay ="True" /> <views:PropertyGrid Grid.Column="1" Margin="3" DataContext="{Binding SessionSettings}" IgnoreDisplay ="True" />