Application crashes if its configuration file is locked while it attempts to write down changed configuration
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace EveOPreview.Configuration
|
||||
@@ -36,8 +37,16 @@ namespace EveOPreview.Configuration
|
||||
public void Save()
|
||||
{
|
||||
string rawData = JsonConvert.SerializeObject(this._thumbnailConfig, Formatting.Indented);
|
||||
string filename = this.GetConfigFileName();
|
||||
|
||||
File.WriteAllText(this.GetConfigFileName(), rawData);
|
||||
try
|
||||
{
|
||||
File.WriteAllText(filename, rawData);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// Ignore error if for some reason the updated config cannot be written down
|
||||
}
|
||||
}
|
||||
|
||||
private string GetConfigFileName()
|
||||
|
Reference in New Issue
Block a user