Compare commits

...

2 Commits

Author SHA1 Message Date
aebf458923 make location textbox read only 2022-01-09 11:37:09 +01:00
47436f42b0 properly trunk global config 2022-01-09 11:36:59 +01:00
2 changed files with 8 additions and 4 deletions

View File

@ -112,7 +112,7 @@
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Content="Location on disk for the player journal. There is usually no need to change this setting." Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.08,0.496"/> <Label Content="Location on disk for the player journal. There is usually no need to change this setting." Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.08,0.496"/>
<TextBox x:Name="journallocation" Text="" Grid.Row="1" Grid.Column="0" Margin="5,0,5,10" TextWrapping="Wrap" /> <TextBox x:Name="journallocation" IsReadOnly="true" Text="" Grid.Row="1" Grid.Column="0" Margin="5,0,5,10" TextWrapping="Wrap" />
<Button x:Name="browsejournallocation" Content="Browse" Grid.Row="1" Grid.Column="1" Margin="0,0,0,0" Width="Auto" VerticalAlignment="Top" HorizontalAlignment="Left" Click="browsejournallocation_Click"/> <Button x:Name="browsejournallocation" Content="Browse" Grid.Row="1" Grid.Column="1" Margin="0,0,0,0" Width="Auto" VerticalAlignment="Top" HorizontalAlignment="Left" Click="browsejournallocation_Click"/>
</Grid> </Grid>
</GroupBox> </GroupBox>

View File

@ -45,11 +45,15 @@ namespace EliteBGS.Util {
public void SaveGlobal() { public void SaveGlobal() {
var serializer = JsonSerializer.CreateDefault(); var serializer = JsonSerializer.CreateDefault();
using (var file = new StreamWriter(File.OpenWrite(config_file), Encoding.UTF8)) { using (FileStream filestream = File.OpenWrite(config_file)) {
filestream.SetLength(0);
filestream.Flush();
using (StreamWriter file = new StreamWriter(filestream, Encoding.UTF8)) {
var stream = new JsonTextWriter(file); var stream = new JsonTextWriter(file);
serializer.Serialize(stream, global_config); serializer.Serialize(stream, global_config);
} }
} }
}
public void LoadGlobal() { public void LoadGlobal() {
var serializer = JsonSerializer.CreateDefault(); var serializer = JsonSerializer.CreateDefault();