From 99dbca1b36a9f41cd213c9e8378bf2e53ec4aedb Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sat, 25 Jun 2016 03:56:49 +0200 Subject: [PATCH] Code review --- ArchiSteamFarm/ConcurrentEnumerator.cs | 7 +------ ArchiSteamFarm/ConcurrentHashSet.cs | 2 +- ArchiSteamFarm/MobileAuthenticator.cs | 26 +++++++++++++++++++++++++- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/ArchiSteamFarm/ConcurrentEnumerator.cs b/ArchiSteamFarm/ConcurrentEnumerator.cs index 6ec5614b3..54f5b035c 100644 --- a/ArchiSteamFarm/ConcurrentEnumerator.cs +++ b/ArchiSteamFarm/ConcurrentEnumerator.cs @@ -49,11 +49,6 @@ namespace ArchiSteamFarm { public bool MoveNext() => Enumerator.MoveNext(); public void Reset() => Enumerator.Reset(); - - public void Dispose() { - if (Lock != null) { - Lock.ExitReadLock(); - } - } + public void Dispose() => Lock.ExitReadLock(); } } diff --git a/ArchiSteamFarm/ConcurrentHashSet.cs b/ArchiSteamFarm/ConcurrentHashSet.cs index 9f1bd39a7..fc3d54c91 100644 --- a/ArchiSteamFarm/ConcurrentHashSet.cs +++ b/ArchiSteamFarm/ConcurrentHashSet.cs @@ -31,7 +31,7 @@ using System.Threading; namespace ArchiSteamFarm { internal sealed class ConcurrentHashSet : ICollection, IDisposable { private readonly HashSet HashSet = new HashSet(); - private readonly ReaderWriterLockSlim Lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); + private readonly ReaderWriterLockSlim Lock = new ReaderWriterLockSlim(); public bool IsReadOnly => false; public IEnumerator GetEnumerator() => new ConcurrentEnumerator(HashSet, Lock); diff --git a/ArchiSteamFarm/MobileAuthenticator.cs b/ArchiSteamFarm/MobileAuthenticator.cs index eafae5a64..33d66b865 100644 --- a/ArchiSteamFarm/MobileAuthenticator.cs +++ b/ArchiSteamFarm/MobileAuthenticator.cs @@ -1,4 +1,28 @@ -using System; +/* + _ _ _ ____ _ _____ + / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___ + / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \ + / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | | +/_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_| + + Copyright 2015-2016 Łukasz "JustArchi" Domeradzki + Contact: JustArchi@JustArchi.net + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +using System; using System.Collections.Generic; using System.Security.Cryptography; using System.Text;