mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Added new section to handle the PreventTransferForClassNames settings.
This commit is contained in:
parent
afa461f956
commit
a54f1e5381
17 changed files with 484 additions and 35 deletions
|
|
@ -296,6 +296,7 @@
|
|||
|
||||
<CheckBox Grid.Row="1" Grid.Column="0" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_CustomOverrideMapSpawnerLabel}" IsChecked="{Binding CurrentConfig.SectionMapSpawnerOverridesEnabled, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_CustomOverrideMapSpawnerTooltip}" HorizontalAlignment="Left"/>
|
||||
<CheckBox Grid.Row="1" Grid.Column="1" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_CustomOverrideSupplyCrateLabel}" IsChecked="{Binding CurrentConfig.SectionSupplyCrateOverridesEnabled, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_CustomOverrideSupplyCrateTooltip}" HorizontalAlignment="Left"/>
|
||||
<CheckBox Grid.Row="1" Grid.Column="2" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_CustomOverridePreventTransferLabel}" IsChecked="{Binding CurrentConfig.SectionPreventTransferOverridesEnabled, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_CustomOverridePreventTransferTooltip}" HorizontalAlignment="Left"/>
|
||||
|
||||
<CheckBox Grid.Row="2" Grid.Column="0" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_CustomOverridePGMLabel}" IsChecked="{Binding CurrentConfig.SectionPGMEnabled, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_CustomOverridePGMTooltip}" HorizontalAlignment="Left"/>
|
||||
<CheckBox Grid.Row="2" Grid.Column="1" Margin="5,0,5,5" Content="{DynamicResource GlobalSettings_CustomOverrideSOTFLabel}" IsChecked="{Binding CurrentConfig.SectionSOTFEnabled, Mode=TwoWay}" ToolTip="{DynamicResource GlobalSettings_CustomOverrideSOTFTooltip}" HorizontalAlignment="Left"/>
|
||||
|
|
|
|||
|
|
@ -237,6 +237,8 @@ namespace ServerManagerTool
|
|||
SyncSections.Add(new SyncSection() { Selected = false, Category = ServerProfileCategory.SupplyCrateOverrides, SectionName = _globalizer.GetResourceString("ServerSettings_SupplyCrateOverridesLabel") });
|
||||
if (Config.Default.SectionStackSizeOverridesEnabled)
|
||||
SyncSections.Add(new SyncSection() { Selected = false, Category = ServerProfileCategory.StackSizeOverrides, SectionName = _globalizer.GetResourceString("ServerSettings_StackSizeOverridesLabel") });
|
||||
if (Config.Default.SectionPreventTransferOverridesEnabled)
|
||||
SyncSections.Add(new SyncSection() { Selected = false, Category = ServerProfileCategory.PreventTransferOverrides, SectionName = _globalizer.GetResourceString("ServerSettings_PreventTransferOverridesLabel") });
|
||||
if (Config.Default.SectionPGMEnabled)
|
||||
SyncSections.Add(new SyncSection() { Selected = false, Category = ServerProfileCategory.PGM, SectionName = _globalizer.GetResourceString("ServerSettings_PGMLabel") });
|
||||
if (Config.Default.SectionSOTFEnabled)
|
||||
|
|
|
|||
|
|
@ -2849,7 +2849,7 @@
|
|||
</DataGridTemplateColumn.CellStyle>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox IsEditable="True" ItemsSource="{Binding BaseDinoSettingsDinoList, ElementName=SettingsControl}" SelectedValue="{Binding ReplacementClass, Mode=TwoWay, UpdateSourceTrigger=Explicit}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" LostFocus="ComboBoxItemList_LostFocus" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
|
||||
<ComboBox IsEditable="True" ItemsSource="{Binding BaseDinoList, ElementName=SettingsControl}" SelectedValue="{Binding ReplacementClass, Mode=TwoWay, UpdateSourceTrigger=Explicit}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" LostFocus="ComboBoxItemList_LostFocus" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
|
@ -5322,7 +5322,7 @@
|
|||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox IsEditable="True" ItemsSource="{Binding BaseMapSpawnerDinoList, ElementName=SettingsControl}" SelectedValue="{Binding NPCClassString, Mode=TwoWay, UpdateSourceTrigger=Explicit}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" LostFocus="ComboBoxItemList_LostFocus" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
|
||||
<ComboBox IsEditable="True" ItemsSource="{Binding BaseDinoList, ElementName=SettingsControl}" SelectedValue="{Binding NPCClassString, Mode=TwoWay, UpdateSourceTrigger=Explicit}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" LostFocus="ComboBoxItemList_LostFocus" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
|
@ -5390,8 +5390,7 @@
|
|||
<RowDefinition Height="200"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<!--<ColumnDefinition Width="3*"/>-->
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" Margin="5" Text="{DynamicResource ServerSettings_SupplyCrate_DisableLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold" Foreground="DarkCyan"/>
|
||||
|
|
@ -5788,6 +5787,119 @@
|
|||
</Grid>
|
||||
</Expander>
|
||||
|
||||
<Expander Name="SectionPreventTransferOverrides" IsExpanded="{Binding CurrentConfig.SectionPreventTransferOverridesIsExpanded, ElementName=SettingsControl, FallbackValue=True, Mode=TwoWay}" Visibility="{Binding CurrentConfig.SectionPreventTransferOverridesEnabled, ElementName=SettingsControl, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Expander.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{DynamicResource ServerSettings_PreventTransferOverridesLabel}" Style="{StaticResource ExpanderHeaderTextStyle}"/>
|
||||
<Button Margin="20,0,0,0" ToolTip="{DynamicResource ServerSettings_ResetSectionTooltip}" Style="{StaticResource ButtonStyle1}"
|
||||
IsEnabled="{Binding ElementName=SectionPreventTransferOverrides, Path=IsExpanded}"
|
||||
Command="{Binding ResetActionCommand, ElementName=SettingsControl}" CommandParameter="{x:Static local:ServerSettingsResetAction.PreventTransferOverridesSection}">
|
||||
<Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Refresh.ico,Size=32}"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Expander.Header>
|
||||
|
||||
<Expander.Style>
|
||||
<Style BasedOn="{StaticResource ExpanderStyle1}" TargetType="{x:Type Expander}">
|
||||
<Setter Property="Template" Value="{StaticResource ExpanderTemplateSE}"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=EnableSOTFCheckbox, Path=IsChecked}" Value="True">
|
||||
<Setter Property="Template" Value="{StaticResource ExpanderTemplateSotF}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ElementName=EnablePGMCheckbox, Path=IsChecked}" Value="True">
|
||||
<Setter Property="Template" Value="{StaticResource ExpanderTemplatePGM}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Expander.Style>
|
||||
|
||||
<Grid Margin="-8,0,2,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" Margin="5" Text="{DynamicResource ServerSettings_PreventTransferOverrides_DisableLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold" Foreground="DarkCyan"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" Text="{DynamicResource ServerSettings_PreventTransferOverrides_WarningLabel}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold"/>
|
||||
|
||||
<GroupBox Grid.Row="2" Grid.Column="0" HorizontalAlignment="Stretch" Height="400" Style="{StaticResource GroupBoxStyle}">
|
||||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="{DynamicResource ServerSettings_PreventTransferOverrides_ItemsLabel}"/>
|
||||
<Button Width="22" Height="22" Click="AddPreventTransferOverride_Click" Margin="20,0,0,0" ToolTip="{DynamicResource ServerSettings_PreventTransferOverrides_AddItemTooltip}" Style="{StaticResource ButtonStyle1}">
|
||||
<Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Add.ico,Size=32}"/>
|
||||
</Button>
|
||||
<Button Width="22" Height="22" Click="PastePreventTransferOverride_Click" Margin="5,0,0,0" ToolTip="{DynamicResource ServerSettings_PreventTransferOverrides_PasteItemsTooltip}" Style="{StaticResource ButtonStyle1}">
|
||||
<Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Paste.ico,Size=32}"/>
|
||||
</Button>
|
||||
<Button Width="22" Height="22" Click="ClearPreventTransferOverrides_Click" Margin="10,0,0,0" ToolTip="{DynamicResource ServerSettings_PreventTransferOverrides_ClearItemsTooltip}" Style="{StaticResource ButtonStyle1}">
|
||||
<Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Delete.ico,Size=32}"/>
|
||||
</Button>
|
||||
<Button Width="22" Height="22" Click="SavePreventTransferOverride_Click" Margin="10,0,0,0" ToolTip="{DynamicResource ServerSettings_PreventTransferOverrides_SaveItemsTooltip}" Style="{StaticResource ButtonStyle1}">
|
||||
<Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Save.ico,Size=32}"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
|
||||
<DataGrid Name="PreventTransferOverrideGrid" ItemsSource="{Binding PreventTransferForClassNames}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserSortColumns="true" SelectionMode="Single" CanUserResizeRows="False" RowHeaderWidth="25">
|
||||
<DataGrid.Resources>
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Style.Resources>
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="{x:Static SystemColors.HighlightColor}"/>
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="{x:Static SystemColors.HighlightTextColor}"/>
|
||||
</Style.Resources>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
|
||||
<DataGrid.HorizontalGridLinesBrush>
|
||||
<SolidColorBrush Color="#FFB4B4B4"/>
|
||||
</DataGrid.HorizontalGridLinesBrush>
|
||||
<DataGrid.VerticalGridLinesBrush>
|
||||
<SolidColorBrush Color="#FFB4B4B4"/>
|
||||
</DataGrid.VerticalGridLinesBrush>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="2*" CanUserSort="True" SortMemberPath="DisplayName">
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock Text="{DynamicResource ServerSettings_PreventTransferOverrides_DinoClassColumnLabel}" ToolTip="{DynamicResource ServerSettings_PreventTransferOverrides_DinoClassColumnTooltip}" />
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox IsEditable="True" ItemsSource="{Binding BaseDinoList, ElementName=SettingsControl}" SelectedValue="{Binding DinoClassString, Mode=TwoWay, UpdateSourceTrigger=Explicit}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" LostFocus="ComboBoxItemList_LostFocus" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Width="30" CanUserReorder="False" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button Width="22" Height="22" Margin="0" IsTabStop="False" HorizontalAlignment="Center" VerticalAlignment="Center" Click="RemovePreventTransferOverrideItem_Click" ToolTip="{DynamicResource ServerSettings_PreventTransferOverrides_RemoveItemTooltip}">
|
||||
<Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Delete.ico,Size=32}"/>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Width="30" CanUserReorder="False" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button Width="22" Height="22" Margin="0" IsTabStop="False" HorizontalAlignment="Center" VerticalAlignment="Center" Click="SavePreventTransferOverrideItem_Click" ToolTip="{DynamicResource ServerSettings_PreventTransferOverrides_SaveItemsTooltip}">
|
||||
<Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Save.ico,Size=32}"/>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</Expander>
|
||||
|
||||
<Expander Name="SectionPGM" IsExpanded="{Binding CurrentConfig.SectionPGMIsExpanded, ElementName=SettingsControl, FallbackValue=True, Mode=TwoWay}" Visibility="{Binding CurrentConfig.SectionPGMEnabled, ElementName=SettingsControl, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Expander.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ using ServerManagerTool.Common.Serialization;
|
|||
using ServerManagerTool.Common.Utils;
|
||||
using ServerManagerTool.Enums;
|
||||
using ServerManagerTool.Lib;
|
||||
using ServerManagerTool.Lib.Model;
|
||||
using ServerManagerTool.Lib.ViewModel;
|
||||
using ServerManagerTool.Plugin.Common;
|
||||
using ServerManagerTool.Utils;
|
||||
|
|
@ -24,7 +23,6 @@ using System.Windows;
|
|||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using WPFSharp.Globalizer;
|
||||
|
||||
|
|
@ -59,6 +57,7 @@ namespace ServerManagerTool
|
|||
CraftingOverridesSection,
|
||||
SupplyCrateOverridesSection,
|
||||
StackSizeOverridesSection,
|
||||
PreventTransferOverridesSection,
|
||||
|
||||
// Properties
|
||||
MapNameTotalConversionProperty,
|
||||
|
|
@ -90,9 +89,8 @@ namespace ServerManagerTool
|
|||
public static readonly DependencyProperty BaseDinoModListProperty = DependencyProperty.Register(nameof(BaseDinoModList), typeof(ComboBoxItemList), typeof(ServerSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty BaseEngramModListProperty = DependencyProperty.Register(nameof(BaseEngramModList), typeof(ComboBoxItemList), typeof(ServerSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty BaseResourceModListProperty = DependencyProperty.Register(nameof(BaseResourceModList), typeof(ComboBoxItemList), typeof(ServerSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty BaseDinoSettingsDinoListProperty = DependencyProperty.Register(nameof(BaseDinoSettingsDinoList), typeof(ComboBoxItemList), typeof(ServerSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty BaseDinoListProperty = DependencyProperty.Register(nameof(BaseDinoList), typeof(ComboBoxItemList), typeof(ServerSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty BaseMapSpawnerListProperty = DependencyProperty.Register(nameof(BaseMapSpawnerList), typeof(ComboBoxItemList), typeof(ServerSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty BaseMapSpawnerDinoListProperty = DependencyProperty.Register(nameof(BaseMapSpawnerDinoList), typeof(ComboBoxItemList), typeof(ServerSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty BasePrimalItemListProperty = DependencyProperty.Register(nameof(BasePrimalItemList), typeof(ComboBoxItemList), typeof(ServerSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty BaseSupplyCrateListProperty = DependencyProperty.Register(nameof(BaseSupplyCrateList), typeof(ComboBoxItemList), typeof(ServerSettingsControl), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty BaseGameMapsProperty = DependencyProperty.Register(nameof(BaseGameMaps), typeof(ComboBoxItemList), typeof(ServerSettingsControl), new PropertyMetadata(null));
|
||||
|
|
@ -146,10 +144,10 @@ namespace ServerManagerTool
|
|||
set { SetValue(BaseResourceModListProperty, value); }
|
||||
}
|
||||
|
||||
public ComboBoxItemList BaseDinoSettingsDinoList
|
||||
public ComboBoxItemList BaseDinoList
|
||||
{
|
||||
get { return (ComboBoxItemList)GetValue(BaseDinoSettingsDinoListProperty); }
|
||||
set { SetValue(BaseDinoSettingsDinoListProperty, value); }
|
||||
get { return (ComboBoxItemList)GetValue(BaseDinoListProperty); }
|
||||
set { SetValue(BaseDinoListProperty, value); }
|
||||
}
|
||||
|
||||
public ComboBoxItemList BaseMapSpawnerList
|
||||
|
|
@ -158,12 +156,6 @@ namespace ServerManagerTool
|
|||
set { SetValue(BaseMapSpawnerListProperty, value); }
|
||||
}
|
||||
|
||||
public ComboBoxItemList BaseMapSpawnerDinoList
|
||||
{
|
||||
get { return (ComboBoxItemList)GetValue(BaseMapSpawnerDinoListProperty); }
|
||||
set { SetValue(BaseMapSpawnerDinoListProperty, value); }
|
||||
}
|
||||
|
||||
public ComboBoxItemList BasePrimalItemList
|
||||
{
|
||||
get { return (ComboBoxItemList)GetValue(BasePrimalItemListProperty); }
|
||||
|
|
@ -380,9 +372,8 @@ namespace ServerManagerTool
|
|||
RefreshBaseResourceModList();
|
||||
RefreshCustomLevelProgressionsInformation();
|
||||
|
||||
this.BaseDinoSettingsDinoList = new ComboBoxItemList();
|
||||
this.BaseDinoList = new ComboBoxItemList();
|
||||
this.BaseMapSpawnerList = new ComboBoxItemList();
|
||||
this.BaseMapSpawnerDinoList = new ComboBoxItemList();
|
||||
this.BasePrimalItemList = new ComboBoxItemList();
|
||||
this.BaseSupplyCrateList = new ComboBoxItemList();
|
||||
this.BaseGameMaps = new ComboBoxItemList();
|
||||
|
|
@ -933,6 +924,7 @@ namespace ServerManagerTool
|
|||
comment.AppendLine($"SectionMapSpawnerOverridesEnabled: {Config.Default.SectionMapSpawnerOverridesEnabled}");
|
||||
comment.AppendLine($"SectionSupplyCrateOverridesEnabled: {Config.Default.SectionSupplyCrateOverridesEnabled}");
|
||||
comment.AppendLine($"SectionStackSizeOverridesEnabled: {Config.Default.SectionStackSizeOverridesEnabled}");
|
||||
comment.AppendLine($"SectionPreventTransferOverridesEnabled: {Config.Default.SectionPreventTransferOverridesEnabled}");
|
||||
|
||||
comment.AppendLine($"AutoBackup_EnableBackup: {Config.Default.AutoBackup_EnableBackup}");
|
||||
comment.AppendLine($"AutoBackup_BackupPeriod: {Config.Default.AutoBackup_BackupPeriod}");
|
||||
|
|
@ -3301,6 +3293,106 @@ namespace ServerManagerTool
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region Prevent Transfer Overrides
|
||||
private void AddPreventTransferOverride_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Settings.PreventTransferForClassNames.Add(new PreventTransferOverride());
|
||||
Settings.PreventTransferForClassNames.IsEnabled = true;
|
||||
}
|
||||
|
||||
private void ClearPreventTransferOverrides_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MessageBox.Show(_globalizer.GetResourceString("ServerSettings_ClearLabel"), _globalizer.GetResourceString("ServerSettings_ClearTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
|
||||
return;
|
||||
|
||||
Settings.PreventTransferForClassNames.Clear();
|
||||
Settings.PreventTransferForClassNames.IsEnabled = false;
|
||||
}
|
||||
|
||||
private void PastePreventTransferOverride_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var window = new CustomConfigDataWindow();
|
||||
window.Owner = Window.GetWindow(this);
|
||||
window.Closed += Window_Closed;
|
||||
var result = window.ShowDialog();
|
||||
|
||||
if (!result.HasValue || !result.Value)
|
||||
return;
|
||||
|
||||
// read the pasted data into an ini file.
|
||||
var iniFile = IniFileUtils.ReadString(window.ConfigData.Replace(" ", ""));
|
||||
|
||||
Server.Profile.PreventTransferForClassNames.RenderToModel();
|
||||
|
||||
// cycle through the sections, adding them to the list. Will bypass any sections that are named as per the ARK default sections.
|
||||
foreach (var section in iniFile.Sections.Where(s => s.SectionName != null && !SystemIniFile.IniSectionNames.ContainsValue(s.SectionName)))
|
||||
{
|
||||
var preventTransferForClassNames = new AggregateIniValueList<PreventTransferOverride>(nameof(Server.Profile.PreventTransferForClassNames), null);
|
||||
preventTransferForClassNames.FromIniValues(section.KeysToStringArray().Where(s => s.StartsWith($"{preventTransferForClassNames.IniCollectionKey}=")));
|
||||
Server.Profile.PreventTransferForClassNames.AddRange(preventTransferForClassNames);
|
||||
Server.Profile.PreventTransferForClassNames.IsEnabled |= preventTransferForClassNames.IsEnabled;
|
||||
}
|
||||
|
||||
var errors = Server.Profile.PreventTransferForClassNames.RenderToView();
|
||||
|
||||
RefreshBaseDinoList();
|
||||
|
||||
if (errors.Length > 0)
|
||||
{
|
||||
var error = $"The following errors have been found:\r\n\r\n{string.Join("\r\n", errors)}";
|
||||
|
||||
var window2 = new CommandLineWindow(error);
|
||||
window2.OutputTextWrapping = TextWrapping.NoWrap;
|
||||
window2.Height = 500;
|
||||
window2.Title = "Import Errors";
|
||||
window2.Owner = Window.GetWindow(this);
|
||||
window2.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void RemovePreventTransferOverrideItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MessageBox.Show(_globalizer.GetResourceString("ServerSettings_DeleteLabel"), _globalizer.GetResourceString("ServerSettings_DeleteTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
|
||||
return;
|
||||
|
||||
var item = ((PreventTransferOverride)((Button)e.Source).DataContext);
|
||||
Settings.PreventTransferForClassNames.Remove(item);
|
||||
Settings.PreventTransferForClassNames.IsEnabled = Settings.PreventTransferForClassNames.Count > 0;
|
||||
}
|
||||
|
||||
private void SavePreventTransferOverride_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Settings.PreventTransferForClassNames.RenderToModel();
|
||||
|
||||
var iniValues = Settings.PreventTransferForClassNames.ToIniValues().ToList();
|
||||
var iniValue = string.Join("\r\n", iniValues);
|
||||
|
||||
var window = new CommandLineWindow(iniValue);
|
||||
window.OutputTextWrapping = TextWrapping.NoWrap;
|
||||
window.Height = 500;
|
||||
window.Title = _globalizer.GetResourceString("ServerSettings_PreventTransferOverrides_SaveTitle");
|
||||
window.Owner = Window.GetWindow(this);
|
||||
window.ShowDialog();
|
||||
}
|
||||
|
||||
private void SavePreventTransferOverrideItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var item = ((PreventTransferOverride)((Button)e.Source).DataContext);
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
var iniName = Settings.PreventTransferForClassNames.IniCollectionKey;
|
||||
var iniValue = $"{iniName}={item.ToINIValue()}";
|
||||
|
||||
var window = new CommandLineWindow(iniValue);
|
||||
window.OutputTextWrapping = TextWrapping.Wrap;
|
||||
window.Height = 500;
|
||||
window.Title = _globalizer.GetResourceString("ServerSettings_PreventTransferOverrides_SaveTitle");
|
||||
window.Owner = Window.GetWindow(this);
|
||||
window.ShowDialog();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
|
@ -3445,18 +3537,34 @@ namespace ServerManagerTool
|
|||
}
|
||||
}
|
||||
|
||||
foreach (var preventTransfer in this.Settings.PreventTransferForClassNames)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(preventTransfer.DinoClassString))
|
||||
continue;
|
||||
|
||||
if (!newList.Any(s => s.ValueMember.Equals(preventTransfer.DinoClassString, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
newList.Add(new Common.Model.ComboBoxItem
|
||||
{
|
||||
DisplayMember = preventTransfer.DinoClassString,
|
||||
ValueMember = preventTransfer.DinoClassString,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.DinoSettingsGrid.BeginInit();
|
||||
this.NPCSpawnEntrySettingsGrid.BeginInit();
|
||||
this.PreventTransferOverrideGrid.BeginInit();
|
||||
|
||||
this.BaseDinoSettingsDinoList = newList;
|
||||
this.BaseMapSpawnerDinoList = newList;
|
||||
this.BaseDinoList = newList;
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.DinoSettingsGrid.EndInit();
|
||||
this.NPCSpawnEntrySettingsGrid.EndInit();
|
||||
this.PreventTransferOverrideGrid.EndInit();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3934,6 +4042,11 @@ namespace ServerManagerTool
|
|||
RefreshBasePrimalItemList();
|
||||
break;
|
||||
|
||||
case ServerSettingsResetAction.PreventTransferOverridesSection:
|
||||
this.Settings.ResetPreventTransferOverridesSection();
|
||||
RefreshBaseDinoList();
|
||||
break;
|
||||
|
||||
// Properties
|
||||
case ServerSettingsResetAction.MapNameTotalConversionProperty:
|
||||
// set the map name to the ARK default.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue