Misc string comparison optimizations

This commit is contained in:
JustArchi
2019-04-02 20:43:17 +02:00
parent a4e25f4523
commit 4920e28ac9
9 changed files with 60 additions and 47 deletions

View File

@@ -55,11 +55,11 @@ namespace ArchiSteamFarm {
[PublicAPI]
public static WebBrowser WebBrowser { get; internal set; }
private static readonly ConcurrentDictionary<string, object> LastWriteEvents = new ConcurrentDictionary<string, object>();
private static readonly SemaphoreSlim UpdateSemaphore = new SemaphoreSlim(1, 1);
private static Timer AutoUpdatesTimer;
private static FileSystemWatcher FileSystemWatcher;
private static ConcurrentDictionary<string, object> LastWriteEvents;
[PublicAPI]
public static bool IsOwner(ulong steamID) {
@@ -317,7 +317,7 @@ namespace ArchiSteamFarm {
}
private static void InitEvents() {
if (FileSystemWatcher != null) {
if ((FileSystemWatcher != null) || (LastWriteEvents != null)) {
return;
}
@@ -328,6 +328,8 @@ namespace ArchiSteamFarm {
FileSystemWatcher.Deleted += OnDeleted;
FileSystemWatcher.Renamed += OnRenamed;
LastWriteEvents = new ConcurrentDictionary<string, object>(Bot.BotsComparer);
FileSystemWatcher.EnableRaisingEvents = true;
}