From c602654800a55d683363755d51863db6c27ff06a Mon Sep 17 00:00:00 2001 From: JustArchi Date: Fri, 7 Jul 2017 06:54:54 +0200 Subject: [PATCH] Misc --- ArchiSteamFarm/ASF.cs | 8 ++++---- ArchiSteamFarm/ArchiSteamFarm.csproj | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ArchiSteamFarm/ASF.cs b/ArchiSteamFarm/ASF.cs index fe45d4c74..fd96ba543 100644 --- a/ArchiSteamFarm/ASF.cs +++ b/ArchiSteamFarm/ASF.cs @@ -113,7 +113,7 @@ namespace ArchiSteamFarm { } // Cleanup from previous update - old non-runtime in-use files - foreach (string file in Directory.GetFiles(targetDirectory, "*.old", SearchOption.AllDirectories)) { + foreach (string file in Directory.EnumerateFiles(targetDirectory, "*.old", SearchOption.AllDirectories)) { try { File.Delete(file); } catch (Exception e) { @@ -217,7 +217,7 @@ namespace ArchiSteamFarm { // Before attempting to connect, initialize our list of CMs await Bot.InitializeCMs(Program.GlobalDatabase.CellID, Program.GlobalDatabase.ServerListProvider).ConfigureAwait(false); - foreach (string botName in Directory.EnumerateFiles(SharedInfo.ConfigDirectory, "*.json").Select(Path.GetFileNameWithoutExtension).Where(botName => !string.IsNullOrEmpty(botName) && (botName[0] != '.'))) { + foreach (string botName in Directory.EnumerateFiles(SharedInfo.ConfigDirectory, "*.json").Select(Path.GetFileNameWithoutExtension).Where(botName => !string.IsNullOrEmpty(botName) && (botName[0] != '.')).OrderBy(botName => botName)) { switch (botName) { case SharedInfo.ASF: case "example": @@ -438,7 +438,7 @@ namespace ArchiSteamFarm { // Move top-level runtime in-use files to other directory // We must do it in order to not crash at later stage - all libraries/executables must keep original names - foreach (string file in Directory.GetFiles(targetDirectory)) { + foreach (string file in Directory.EnumerateFiles(targetDirectory)) { string target = Path.Combine(backupDirectory, Path.GetFileName(file)); File.Move(file, target); } @@ -446,7 +446,7 @@ namespace ArchiSteamFarm { // In generic ASF variant there can also be "runtimes" directory in need of same approach string runtimesDirectory = Path.Combine(targetDirectory, "runtimes"); if (Directory.Exists(runtimesDirectory)) { - foreach (string file in Directory.GetFiles(runtimesDirectory, "*", SearchOption.AllDirectories)) { + foreach (string file in Directory.EnumerateFiles(runtimesDirectory, "*", SearchOption.AllDirectories)) { string directory = Path.Combine(backupDirectory, Path.GetDirectoryName(Path.GetRelativePath(targetDirectory, file))); Directory.CreateDirectory(directory); diff --git a/ArchiSteamFarm/ArchiSteamFarm.csproj b/ArchiSteamFarm/ArchiSteamFarm.csproj index 8f73489cb..6420a2ac6 100644 --- a/ArchiSteamFarm/ArchiSteamFarm.csproj +++ b/ArchiSteamFarm/ArchiSteamFarm.csproj @@ -19,7 +19,7 @@ - +