This commit is contained in:
JustArchi
2018-01-02 08:16:41 +01:00
parent c515bd9241
commit 6916d2c070
2 changed files with 7 additions and 9 deletions

View File

@@ -251,17 +251,16 @@ namespace ArchiSteamFarm {
await FileSemaphore.WaitAsync().ConfigureAwait(false);
if (ReadOnly) {
return;
}
try {
await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
if (ReadOnly) {
return;
}
if (File.Exists(FilePath)) {
await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
File.Replace(newFilePath, FilePath, null);
} else {
File.Move(newFilePath, FilePath);
await File.WriteAllTextAsync(FilePath, json).ConfigureAwait(false);
}
} catch (Exception e) {
ASF.ArchiLogger.LogGenericException(e);

View File

@@ -166,12 +166,11 @@ namespace ArchiSteamFarm {
await FileSemaphore.WaitAsync().ConfigureAwait(false);
try {
await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
if (File.Exists(FilePath)) {
await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
File.Replace(newFilePath, FilePath, null);
} else {
File.Move(newFilePath, FilePath);
await File.WriteAllTextAsync(FilePath, json).ConfigureAwait(false);
}
} catch (Exception e) {
ASF.ArchiLogger.LogGenericException(e);