From 6916d2c070818f2bdbd847442d1520c81094cd40 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Tue, 2 Jan 2018 08:16:41 +0100 Subject: [PATCH] Misc --- ArchiSteamFarm/BotDatabase.cs | 11 +++++------ ArchiSteamFarm/GlobalDatabase.cs | 5 ++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ArchiSteamFarm/BotDatabase.cs b/ArchiSteamFarm/BotDatabase.cs index 66ac9e341..463b5fdfe 100644 --- a/ArchiSteamFarm/BotDatabase.cs +++ b/ArchiSteamFarm/BotDatabase.cs @@ -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); diff --git a/ArchiSteamFarm/GlobalDatabase.cs b/ArchiSteamFarm/GlobalDatabase.cs index 4374aaa6d..083d80a52 100644 --- a/ArchiSteamFarm/GlobalDatabase.cs +++ b/ArchiSteamFarm/GlobalDatabase.cs @@ -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);