Check for config existance before loading
This commit is contained in:
@@ -12,5 +12,5 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.0.89.507")]
|
[assembly: AssemblyVersion("1.0.89.540")]
|
||||||
[assembly: AssemblyFileVersion("1.0.89.507")]
|
[assembly: AssemblyFileVersion("1.0.89.540")]
|
@@ -117,9 +117,17 @@
|
|||||||
</Expander>
|
</Expander>
|
||||||
<Expander Header="Players">
|
<Expander Header="Players">
|
||||||
<StackPanel Margin="10,0,0,0">
|
<StackPanel Margin="10,0,0,0">
|
||||||
|
<DockPanel>
|
||||||
|
<TextBox Text="{Binding MaxPlayers}" Margin="3" Width="70"/>
|
||||||
|
<Label Content="Max Players"/>
|
||||||
|
</DockPanel>
|
||||||
<CheckBox IsChecked="{Binding EnableAutoHealing}" Content="Auto Healing" Margin="3"/>
|
<CheckBox IsChecked="{Binding EnableAutoHealing}" Content="Auto Healing" Margin="3"/>
|
||||||
<CheckBox IsChecked="{Binding EnableCopyPaste}" Content="Enable Copy/Paste" Margin="3"/>
|
<CheckBox IsChecked="{Binding EnableCopyPaste}" Content="Enable Copy/Paste" Margin="3"/>
|
||||||
<CheckBox IsChecked="{Binding ShowPlayerNamesOnHud}" Content="Show Player Names on HUD" Margin="3"/>
|
<CheckBox IsChecked="{Binding ShowPlayerNamesOnHud}" Content="Show Player Names on HUD" Margin="3"/>
|
||||||
|
<DockPanel>
|
||||||
|
<TextBox Text="{Binding SpawnTimeMultiplier}" Margin="3" Width="70"/>
|
||||||
|
<Label Content="Respawn Time Multiplier"/>
|
||||||
|
</DockPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Expander>
|
</Expander>
|
||||||
<Expander Header="Miscellaneous">
|
<Expander Header="Miscellaneous">
|
||||||
@@ -161,18 +169,12 @@
|
|||||||
<TextBox Text="{Binding MaxGridSize}" Margin="3" Width="70"/>
|
<TextBox Text="{Binding MaxGridSize}" Margin="3" Width="70"/>
|
||||||
<Label Content="Max Grid Size"/>
|
<Label Content="Max Grid Size"/>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<DockPanel>
|
|
||||||
<TextBox Text="{Binding MaxPlayers}" Margin="3" Width="70"/>
|
|
||||||
<Label Content="Max Players"/>
|
|
||||||
</DockPanel>
|
|
||||||
<DockPanel ToolTip="Increases physics precision at the cost of performance.">
|
<DockPanel ToolTip="Increases physics precision at the cost of performance.">
|
||||||
<TextBox Text="{Binding PhysicsIterations}" Margin="3" Width="70"/>
|
<TextBox Text="{Binding PhysicsIterations}" Margin="3" Width="70"/>
|
||||||
<Label Content="Physics Iterations"/>
|
<Label Content="Physics Iterations"/>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<DockPanel>
|
|
||||||
<TextBox Text="{Binding SpawnTimeMultiplier}" Margin="3" Width="70"/>
|
|
||||||
<Label Content="Respawn Time Multiplier"/>
|
|
||||||
</DockPanel>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Expander>
|
</Expander>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
@@ -33,7 +33,6 @@ namespace Torch.Server.Views
|
|||||||
public ConfigControl()
|
public ConfigControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
LoadDedicatedConfig(@"C:\ProgramData\Torch\Torch\SpaceEngineers-Dedicated.cfg");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveConfig()
|
public void SaveConfig()
|
||||||
@@ -41,18 +40,16 @@ namespace Torch.Server.Views
|
|||||||
Config.Save(_configPath);
|
Config.Save(_configPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadDedicatedConfig(string path)
|
|
||||||
{
|
|
||||||
Config = new MyConfigDedicated<MyObjectBuilder_SessionSettings>(path);
|
|
||||||
Config.Load(path);
|
|
||||||
|
|
||||||
_viewModel = new ConfigDedicatedViewModel(Config);
|
|
||||||
DataContext = _viewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadDedicatedConfig(TorchConfig torchConfig)
|
public void LoadDedicatedConfig(TorchConfig torchConfig)
|
||||||
{
|
{
|
||||||
var path = Path.Combine(torchConfig.InstancePath, "SpaceEngineers-Dedicated.cfg");
|
var path = Path.Combine(torchConfig.InstancePath, "SpaceEngineers-Dedicated.cfg");
|
||||||
|
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
DataContext = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Config = new MyConfigDedicated<MyObjectBuilder_SessionSettings>(path);
|
Config = new MyConfigDedicated<MyObjectBuilder_SessionSettings>(path);
|
||||||
Config.Load(path);
|
Config.Load(path);
|
||||||
_configPath = path;
|
_configPath = path;
|
||||||
|
@@ -18,7 +18,10 @@
|
|||||||
<TabControl x:Name="TabControl" DockPanel.Dock="Bottom" Margin="5,0,5,5">
|
<TabControl x:Name="TabControl" DockPanel.Dock="Bottom" Margin="5,0,5,5">
|
||||||
<TabItem Header="Configuration">
|
<TabItem Header="Configuration">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBox x:Name="InstancePathBox" Margin="3" Height="20" TextChanged="InstancePathBox_OnTextChanged"/>
|
<DockPanel>
|
||||||
|
<Label Content="Instance Path: " Margin="3"/>
|
||||||
|
<TextBox x:Name="InstancePathBox" Margin="3" Height="20" TextChanged="InstancePathBox_OnTextChanged"/>
|
||||||
|
</DockPanel>
|
||||||
<views:ConfigControl x:Name="ConfigControl" Margin="3"/>
|
<views:ConfigControl x:Name="ConfigControl" Margin="3"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
Reference in New Issue
Block a user