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
|
|
@ -180,6 +180,7 @@
|
|||
<Compile Include="Interface\ISpawnIniValuesCollection.cs" />
|
||||
<Compile Include="Lib\Events\ProfileEventArgs.cs" />
|
||||
<Compile Include="Lib\Model\EngramAutoUnlock.cs" />
|
||||
<Compile Include="Lib\Model\PreventTransferOverride.cs" />
|
||||
<Compile Include="Lib\Model\StackSizeOverride.cs" />
|
||||
<Compile Include="Lib\Serialization\IniFileEntryAttribute.cs" />
|
||||
<Compile Include="Lib\Serialization\IniFiles.cs" />
|
||||
|
|
|
|||
|
|
@ -735,6 +735,12 @@
|
|||
<setting name="ManagePublicIPAutomatically" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="SectionPreventTransferOverridesIsExpanded" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="SectionPreventTransferOverridesEnabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</ServerManagerTool.Config>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
|
|
|
|||
24
src/ARKServerManager/Config.Designer.cs
generated
24
src/ARKServerManager/Config.Designer.cs
generated
|
|
@ -2539,5 +2539,29 @@ namespace ServerManagerTool {
|
|||
return ((string)(this["VersionFile"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool SectionPreventTransferOverridesIsExpanded {
|
||||
get {
|
||||
return ((bool)(this["SectionPreventTransferOverridesIsExpanded"]));
|
||||
}
|
||||
set {
|
||||
this["SectionPreventTransferOverridesIsExpanded"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool SectionPreventTransferOverridesEnabled {
|
||||
get {
|
||||
return ((bool)(this["SectionPreventTransferOverridesEnabled"]));
|
||||
}
|
||||
set {
|
||||
this["SectionPreventTransferOverridesEnabled"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -710,5 +710,11 @@
|
|||
<Setting Name="VersionFile" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">version.txt</Value>
|
||||
</Setting>
|
||||
<Setting Name="SectionPreventTransferOverridesIsExpanded" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="SectionPreventTransferOverridesEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
CraftingOverrides,
|
||||
SupplyCrateOverrides,
|
||||
StackSizeOverrides,
|
||||
PreventTransferOverrides,
|
||||
PGM,
|
||||
SOTF,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -445,6 +445,8 @@
|
|||
<sys:String x:Key="GlobalSettings_CustomOverrideMapSpawnerTooltip">If enabled, the map spawner overrides will be managed by the server manager.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_CustomOverrideSupplyCrateLabel">Enable Supply Crate Overrides</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_CustomOverrideSupplyCrateTooltip">If enabled, the supply crate overrides will be managed by the server manager.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_CustomOverridePreventTransferLabel">Enable Prevent Transfer Overrides</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_CustomOverridePreventTransferTooltip">If enabled, the prevent transfer overrides will be managed by the server manager.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_CustomOverridePGMLabel">Enable PGM Ark Settings</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_CustomOverridePGMTooltip">If enabled, the PGM settings will be managed by the server manager.</sys:String>
|
||||
<sys:String x:Key="GlobalSettings_CustomOverrideSOTFLabel">Enable SotF Settings</sys:String>
|
||||
|
|
@ -2270,6 +2272,23 @@
|
|||
<!--#endregion-->
|
||||
|
||||
<!--#endregion-->
|
||||
|
||||
<!--#region Server Settings - Prevent Transfer Overrides -->
|
||||
<sys:String x:Key="ServerSettings_PreventTransferOverridesLabel">Prevent Transfer Overrides</sys:String>
|
||||
<sys:String x:Key="ServerSettings_PreventTransferOverrides_ItemsLabel">Prevent Transfers</sys:String>
|
||||
<sys:String x:Key="ServerSettings_PreventTransferOverrides_SaveTitle">Prevent Transfer Override Settings</sys:String>
|
||||
<sys:String x:Key="ServerSettings_PreventTransferOverrides_DisableLabel">NOTE: If you want to manage your overrides manually or with another application, you can disable the option that will prevent the server manager managing the overrides. See the 'Custom Override Options' in the global settings.</sys:String>
|
||||
<sys:String x:Key="ServerSettings_PreventTransferOverrides_WarningLabel">WARNING: Adding dinos to this list will prevent them from being transferred to and from the server.</sys:String>
|
||||
|
||||
<sys:String x:Key="ServerSettings_PreventTransferOverrides_DinoClassColumnLabel">Dino</sys:String>
|
||||
<sys:String x:Key="ServerSettings_PreventTransferOverrides_DinoClassColumnTooltip">Dino Class String</sys:String>
|
||||
|
||||
<sys:String x:Key="ServerSettings_PreventTransferOverrides_AddItemTooltip">Add prevent transfer item</sys:String>
|
||||
<sys:String x:Key="ServerSettings_PreventTransferOverrides_ClearItemsTooltip">Delete all prevent transfer items</sys:String>
|
||||
<sys:String x:Key="ServerSettings_PreventTransferOverrides_PasteItemsTooltip">Paste prevent transfer items data</sys:String>
|
||||
<sys:String x:Key="ServerSettings_PreventTransferOverrides_RemoveItemTooltip">Delete prevent transfer item</sys:String>
|
||||
<sys:String x:Key="ServerSettings_PreventTransferOverrides_SaveItemsTooltip">Save prevent transfer items data</sys:String>
|
||||
<!--#endregion-->
|
||||
|
||||
<!--#region Player/Tribe Profile Window -->
|
||||
<sys:String x:Key="Profile_PlayerSectionLabel">Player Details</sys:String>
|
||||
|
|
@ -5451,6 +5470,7 @@
|
|||
<sys:String x:Key="ProfileSave_ConstructingMapSpawnerInformation">Constructing Map Spawner Information...</sys:String>
|
||||
<sys:String x:Key="ProfileSave_ConstructingSupplyCrateInformation">Constructing Supply Crate Information...</sys:String>
|
||||
<sys:String x:Key="ProfileSave_ConstructingStackSizeInformation">Constructing Stack Size Information...</sys:String>
|
||||
<sys:String x:Key="ProfileSave_ConstructingPreventTransferInformation">Constructing Prevent Transfer Information...</sys:String>
|
||||
<sys:String x:Key="ProfileSave_SavingProfileFile">Saving Profile File...</sys:String>
|
||||
<sys:String x:Key="ProfileSave_SavingConfigFiles">Saving Config Files...</sys:String>
|
||||
<sys:String x:Key="ProfileSave_SavingLauncherFile">Saving Launcher File...</sys:String>
|
||||
|
|
|
|||
76
src/ARKServerManager/Lib/Model/PreventTransferOverride.cs
Normal file
76
src/ARKServerManager/Lib/Model/PreventTransferOverride.cs
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
using ServerManagerTool.Common.Attibutes;
|
||||
using ServerManagerTool.Common.Model;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Windows;
|
||||
|
||||
namespace ServerManagerTool.Lib
|
||||
{
|
||||
[DataContract]
|
||||
public class PreventTransferOverrideList : AggregateIniValueList<PreventTransferOverride>
|
||||
{
|
||||
public PreventTransferOverrideList(string aggregateValueName)
|
||||
: base(aggregateValueName, null)
|
||||
{
|
||||
}
|
||||
|
||||
public string[] RenderToView()
|
||||
{
|
||||
List<string> errors = new List<string>();
|
||||
|
||||
|
||||
return errors.ToArray();
|
||||
}
|
||||
|
||||
public void RenderToModel()
|
||||
{
|
||||
}
|
||||
|
||||
public void UpdateForLocalization()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class PreventTransferOverride : AggregateIniValue
|
||||
{
|
||||
public static readonly DependencyProperty DinoClassStringProperty = DependencyProperty.Register(nameof(DinoClassString), typeof(string), typeof(PreventTransferOverride), new PropertyMetadata(string.Empty));
|
||||
[DataMember]
|
||||
[AggregateIniValueEntry(QuotedString = false, ExcludePropertyName = true)]
|
||||
public string DinoClassString
|
||||
{
|
||||
get { return (string)GetValue(DinoClassStringProperty); }
|
||||
set { SetValue(DinoClassStringProperty, value); }
|
||||
}
|
||||
|
||||
public override string GetSortKey()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool IsEquivalent(AggregateIniValue other)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void InitializeFromINIValue(string value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
return;
|
||||
|
||||
var kvPair = value.Split(new[] { '=' }, 2);
|
||||
var kvValue = kvPair[1].Trim(' ');
|
||||
|
||||
DinoClassString = kvValue;
|
||||
}
|
||||
|
||||
public override string ToINIValue()
|
||||
{
|
||||
return base.ToComplexINIValue(false);
|
||||
}
|
||||
|
||||
public string DisplayName => GameData.FriendlyItemNameForClass(DinoClassString);
|
||||
|
||||
public bool IsValid => !string.IsNullOrWhiteSpace(DinoClassString);
|
||||
}
|
||||
}
|
||||
|
|
@ -94,6 +94,7 @@ namespace ServerManagerTool.Lib
|
|||
this.ConfigOverrideItemCraftingCosts = new AggregateIniValueList<CraftingOverride>(nameof(ConfigOverrideItemCraftingCosts), null);
|
||||
this.ConfigOverrideItemMaxQuantity = new StackSizeOverrideList(nameof(ConfigOverrideItemMaxQuantity));
|
||||
this.ConfigOverrideSupplyCrateItems = new SupplyCrateOverrideList(nameof(ConfigOverrideSupplyCrateItems));
|
||||
this.PreventTransferForClassNames = new PreventTransferOverrideList(nameof(PreventTransferForClassNames));
|
||||
|
||||
this.ConfigAddNPCSpawnEntriesContainer = new NPCSpawnContainerList<NPCSpawnContainer>(nameof(ConfigAddNPCSpawnEntriesContainer), NPCSpawnContainerType.Add);
|
||||
this.ConfigSubtractNPCSpawnEntriesContainer = new NPCSpawnContainerList<NPCSpawnContainer>(nameof(ConfigSubtractNPCSpawnEntriesContainer), NPCSpawnContainerType.Subtract);
|
||||
|
|
@ -3202,6 +3203,16 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region Prevent Transfer Overrides
|
||||
public static readonly DependencyProperty PreventTransferForClassNamesProperty = DependencyProperty.Register(nameof(PreventTransferForClassNames), typeof(PreventTransferOverrideList), typeof(ServerProfile), new PropertyMetadata(null));
|
||||
[IniFileEntry(IniFiles.Game, IniSections.Game_ShooterGameMode, ServerProfileCategory.PreventTransferOverrides)]
|
||||
public PreventTransferOverrideList PreventTransferForClassNames
|
||||
{
|
||||
get { return (PreventTransferOverrideList)GetValue(PreventTransferForClassNamesProperty); }
|
||||
set { SetValue(PreventTransferForClassNamesProperty, value); }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Survival of the Fittest
|
||||
public static readonly DependencyProperty SOTF_EnabledProperty = DependencyProperty.Register(nameof(SOTF_Enabled), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false));
|
||||
[DataMember]
|
||||
|
|
@ -3520,6 +3531,11 @@ namespace ServerManagerTool.Lib
|
|||
exclusions.Add(ServerProfileCategory.StackSizeOverrides);
|
||||
}
|
||||
|
||||
if (!Config.Default.SectionPreventTransferOverridesEnabled)
|
||||
{
|
||||
exclusions.Add(ServerProfileCategory.PreventTransferOverrides);
|
||||
}
|
||||
|
||||
if (!Config.Default.SectionPGMEnabled)
|
||||
{
|
||||
exclusions.Add(ServerProfileCategory.PGM);
|
||||
|
|
@ -3909,6 +3925,8 @@ namespace ServerManagerTool.Lib
|
|||
profile.ConfigOverrideSupplyCrateItems.RenderToView();
|
||||
if (Config.Default.SectionStackSizeOverridesEnabled)
|
||||
profile.ConfigOverrideItemMaxQuantity.RenderToView();
|
||||
if (Config.Default.SectionPreventTransferOverridesEnabled)
|
||||
profile.PreventTransferForClassNames.RenderToView();
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
|
@ -4024,6 +4042,8 @@ namespace ServerManagerTool.Lib
|
|||
profile.ConfigOverrideSupplyCrateItems.RenderToView();
|
||||
if (Config.Default.SectionStackSizeOverridesEnabled)
|
||||
profile.ConfigOverrideItemMaxQuantity.RenderToView();
|
||||
if (Config.Default.SectionPreventTransferOverridesEnabled)
|
||||
profile.PreventTransferForClassNames.RenderToView();
|
||||
|
||||
profile.LoadServerFileAdministrators();
|
||||
profile.LoadServerFileExclusive();
|
||||
|
|
@ -4130,6 +4150,12 @@ namespace ServerManagerTool.Lib
|
|||
this.ConfigOverrideItemMaxQuantity.RenderToModel();
|
||||
}
|
||||
|
||||
if (Config.Default.SectionPreventTransferOverridesEnabled)
|
||||
{
|
||||
progressCallback?.Invoke(0, _globalizer.GetResourceString("ProfileSave_ConstructingPreventTransferInformation"));
|
||||
this.PreventTransferForClassNames.RenderToModel();
|
||||
}
|
||||
|
||||
if (!Config.Default.SectionPGMEnabled)
|
||||
{
|
||||
PGM_Enabled = false;
|
||||
|
|
@ -5327,6 +5353,12 @@ namespace ServerManagerTool.Lib
|
|||
this.PerLevelStatsMultiplier_Player = new StatsMultiplierArray(nameof(PerLevelStatsMultiplier_Player), GameData.GetPerLevelStatsMultipliers_Player, GameData.GetStatMultiplierInclusions_PlayerPerLevel(), true);
|
||||
}
|
||||
|
||||
public void ResetPreventTransferOverridesSection()
|
||||
{
|
||||
this.PreventTransferForClassNames = new PreventTransferOverrideList(nameof(PreventTransferForClassNames));
|
||||
this.PreventTransferForClassNames.Reset();
|
||||
}
|
||||
|
||||
public void ResetRulesSection()
|
||||
{
|
||||
this.ClearValue(EnableHardcoreProperty);
|
||||
|
|
@ -5613,6 +5645,9 @@ namespace ServerManagerTool.Lib
|
|||
case ServerProfileCategory.StackSizeOverrides:
|
||||
SyncStackSizeOverridesSection(sourceProfile);
|
||||
break;
|
||||
case ServerProfileCategory.PreventTransferOverrides:
|
||||
SyncPreventTransferOverridesSection(sourceProfile);
|
||||
break;
|
||||
case ServerProfileCategory.PGM:
|
||||
SyncPGMSection(sourceProfile);
|
||||
break;
|
||||
|
|
@ -5996,6 +6031,16 @@ namespace ServerManagerTool.Lib
|
|||
this.PerLevelStatsMultiplier_Player.IsEnabled = sourceProfile.PerLevelStatsMultiplier_Player.IsEnabled;
|
||||
}
|
||||
|
||||
private void SyncPreventTransferOverridesSection(ServerProfile sourceProfile)
|
||||
{
|
||||
sourceProfile.PreventTransferForClassNames.RenderToModel();
|
||||
|
||||
this.PreventTransferForClassNames.Clear();
|
||||
this.PreventTransferForClassNames.FromIniValues(sourceProfile.PreventTransferForClassNames.ToIniValues());
|
||||
this.PreventTransferForClassNames.IsEnabled = this.PreventTransferForClassNames.Count > 0;
|
||||
this.PreventTransferForClassNames.RenderToView();
|
||||
}
|
||||
|
||||
private void SyncRulesSection(ServerProfile sourceProfile)
|
||||
{
|
||||
this.SetValue(EnableHardcoreProperty, sourceProfile.EnableHardcore);
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@
|
|||
<title>Ark Server Manager Version Feed</title>
|
||||
<subtitle>This is the Ark Server Manager release version feed.</subtitle>
|
||||
<link href="http://arkservermanager.freeforums.net/" />
|
||||
<updated>2021-06-19T00:00:00Z</updated>
|
||||
<updated>2021-06-19T01:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:0A751BBA-54B5-40A6-AB09-C6B2539DAFE7</id>
|
||||
<title>1.1.399 (1.1.399.1)</title>
|
||||
<summary>1.1.399.1</summary>
|
||||
<title>1.1.399 (1.1.399.2)</title>
|
||||
<summary>1.1.399.2</summary>
|
||||
<link href="" />
|
||||
<updated>2021-06-19T00:00:00Z</updated>
|
||||
<updated>2021-06-19T01:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
|
||||
<p>
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
<br/>
|
||||
<ul>
|
||||
<li>Server Settings - Rules Section - Added new Genesis: Part 2 settings, bDisableWorldBuffs, bEnableWorldBuffScaling and WorldBuffScalingEfficacy.</li>
|
||||
<li>Server Settings - Prevent Transfer Section - Added new section to handle the PreventTransferForClassNames settings. This section can be enabled/disables from the global settings, if you want to management these manually.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -1081,7 +1082,7 @@
|
|||
<u style="font-size: .9em;">NEW</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Server Settings - Dino Section - added missing server setting Mating Speed Multiplier. This has been added to the Dino Breeding Multipliers group near the bottom of the section. (thanks @Norlinri)</li>
|
||||
<li>Server Settings - Dino Section - added missing server setting Mating Speed Multiplier. This has been added to the Dino Breeding Multipliers group near the bottom of the section. (thanks @Norlini)</li>
|
||||
</ul>
|
||||
<u style="font-size: .9em;">CHANGE</u>
|
||||
<br/>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,30 @@
|
|||
<title>Ark Server Manager Version Feed</title>
|
||||
<subtitle>This is the Ark Server Manager beta version feed.</subtitle>
|
||||
<link href="http://arkservermanager.freeforums.net/" />
|
||||
<updated>2021-06-19T00:00:00Z</updated>
|
||||
<updated>2021-06-19T01:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:0A751BBA-54B5-40A6-AB09-C6B2539DAFE7</id>
|
||||
<title>1.1.399 (1.1.399.2)</title>
|
||||
<summary>1.1.399.2</summary>
|
||||
<link href="" />
|
||||
<updated>2021-06-19T01:00:00Z</updated>
|
||||
<content type="xhtml">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
|
||||
<p>
|
||||
<u style="font-size: .9em;">NEW</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Server Settings - Prevent Transfer Section - Added new section to handle the PreventTransferForClassNames settings. This section can be enabled/disables from the global settings, if you want to management these manually.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:0A751BBA-54B5-40A6-AB09-C6B2539DAFE7</id>
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -35,13 +35,23 @@ namespace ServerManagerTool.Common.Attibutes
|
|||
public int BracketsAroundValueDelimiter = 1;
|
||||
|
||||
/// <summary>
|
||||
/// If true, then the property with not be written if empty. This does not work for collections, only value types.
|
||||
/// If true, then the property will not be written if empty. This does not work for collections, only value types.
|
||||
/// </summary>
|
||||
public bool ExcludeIfEmpty;
|
||||
|
||||
/// <summary>
|
||||
/// If true, then the property with not be written if false. This does not work for collections, only BOOLEAN types.
|
||||
/// If true, then the property will not be written if false. This does not work for collections, only BOOLEAN types.
|
||||
/// </summary>
|
||||
public bool ExcludeIfFalse = false;
|
||||
|
||||
/// <summary>
|
||||
/// If true, the value will always be written with quotes; otherwise without quotes.
|
||||
/// </summary>
|
||||
public bool QuotedString = true;
|
||||
|
||||
/// <summary>
|
||||
/// If true, then the property name will not be written. This does not work for collections, only value types.
|
||||
/// </summary>
|
||||
public bool ExcludePropertyName = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ namespace ServerManagerTool.Common.Model
|
|||
var propName = string.IsNullOrWhiteSpace(attr?.Key) ? prop.Name : attr.Key;
|
||||
|
||||
var val = prop.GetValue(this);
|
||||
var propValue = StringUtils.GetPropertyValue(val, prop);
|
||||
var propValue = StringUtils.GetPropertyValue(val, prop, attr?.QuotedString ?? true);
|
||||
|
||||
if ((attr?.ExcludeIfEmpty ?? false) && string.IsNullOrWhiteSpace(propValue))
|
||||
{
|
||||
|
|
@ -121,7 +121,9 @@ namespace ServerManagerTool.Common.Model
|
|||
}
|
||||
else
|
||||
{
|
||||
result.Append($"{propName}={propValue}");
|
||||
if (!(attr?.ExcludePropertyName ?? false))
|
||||
result.Append($"{propName}=");
|
||||
result.Append($"{propValue}");
|
||||
|
||||
delimiter = DELIMITER.ToString();
|
||||
}
|
||||
|
|
@ -242,10 +244,11 @@ namespace ServerManagerTool.Common.Model
|
|||
}
|
||||
else
|
||||
{
|
||||
var propValue = StringUtils.GetPropertyValue(val, prop);
|
||||
var propValue = StringUtils.GetPropertyValue(val, prop, attr?.QuotedString ?? true);
|
||||
|
||||
result.Append(delimiter);
|
||||
result.Append($"{propName}=");
|
||||
if (!(attr?.ExcludePropertyName ?? false))
|
||||
result.Append($"{propName}=");
|
||||
if (attr?.ValueWithinBrackets ?? false)
|
||||
result.Append("(");
|
||||
|
||||
|
|
|
|||
|
|
@ -10,14 +10,19 @@ namespace ServerManagerTool.Common.Utils
|
|||
{
|
||||
public const string DEFAULT_CULTURE_CODE = "en-US";
|
||||
|
||||
public static string GetPropertyValue(object value, PropertyInfo property)
|
||||
public static string GetPropertyValue(object value, PropertyInfo property, bool quotedString = true)
|
||||
{
|
||||
string convertedVal;
|
||||
|
||||
if (property.PropertyType == typeof(float))
|
||||
convertedVal = ((float)value).ToString("0.000000####", CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE));
|
||||
else if (property.PropertyType == typeof(string))
|
||||
convertedVal = $"\"{value}\"";
|
||||
{
|
||||
if (quotedString)
|
||||
convertedVal = $"\"{value}\"";
|
||||
else
|
||||
convertedVal = $"{value}";
|
||||
}
|
||||
else
|
||||
convertedVal = Convert.ToString(value, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue