mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 15:14:41 +00:00
R# code review
This commit is contained in:
parent
8a04530353
commit
74fd861b87
4 changed files with 8 additions and 10 deletions
|
@ -35,6 +35,7 @@ namespace ArchiSteamFarm.CustomPlugins.ExamplePlugin {
|
||||||
// Your plugin class should inherit the plugin interfaces it wants to handle
|
// Your plugin class should inherit the plugin interfaces it wants to handle
|
||||||
// If you do not want to handle a particular action (e.g. OnBotMessage that is offered in IBotMessage), it's the best idea to not inherit it at all
|
// If you do not want to handle a particular action (e.g. OnBotMessage that is offered in IBotMessage), it's the best idea to not inherit it at all
|
||||||
// This will keep your code compact, efficient and less dependent. You can always add additional interfaces when you'll need them, this example project will inherit quite a bit of them to show you potential usage
|
// This will keep your code compact, efficient and less dependent. You can always add additional interfaces when you'll need them, this example project will inherit quite a bit of them to show you potential usage
|
||||||
|
// ReSharper disable once UnusedMember.Global - this is example plugin class that isn't used in our main code
|
||||||
internal sealed class ExamplePlugin : IASF, IBot, IBotCommand, IBotConnection, IBotFriendRequest, IBotMessage, IBotModules, IBotTradeOffer {
|
internal sealed class ExamplePlugin : IASF, IBot, IBotCommand, IBotConnection, IBotFriendRequest, IBotMessage, IBotModules, IBotTradeOffer {
|
||||||
// This is used for identification purposes, typically you want to use a friendly name of your plugin here, such as the name of your main class
|
// This is used for identification purposes, typically you want to use a friendly name of your plugin here, such as the name of your main class
|
||||||
// Please note that this property can have direct dependencies only on structures that were initialized by the constructor, as it's possible to be called before OnLoaded() takes place
|
// Please note that this property can have direct dependencies only on structures that were initialized by the constructor, as it's possible to be called before OnLoaded() takes place
|
||||||
|
|
|
@ -127,8 +127,7 @@ namespace ArchiSteamFarm.Collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
|
void ICollection<T>.Add([NotNull] T item) => Add(item);
|
||||||
void ICollection<T>.Add(T item) => Add(item);
|
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
|
||||||
|
@ -75,7 +74,7 @@ namespace ArchiSteamFarm.Collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CopyTo(T[] array, int arrayIndex) {
|
public void CopyTo([NotNull] T[] array, int arrayIndex) {
|
||||||
CollectionSemaphore.Wait();
|
CollectionSemaphore.Wait();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -97,6 +96,7 @@ namespace ArchiSteamFarm.Collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NotNull]
|
||||||
public IEnumerator<T> GetEnumerator() => new ConcurrentEnumerator<T>(BackingCollection, CollectionSemaphore);
|
public IEnumerator<T> GetEnumerator() => new ConcurrentEnumerator<T>(BackingCollection, CollectionSemaphore);
|
||||||
|
|
||||||
public void IntersectWith(IEnumerable<T> other) {
|
public void IntersectWith(IEnumerable<T> other) {
|
||||||
|
@ -199,9 +199,9 @@ namespace ArchiSteamFarm.Collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
|
void ICollection<T>.Add([NotNull] T item) => Add(item);
|
||||||
void ICollection<T>.Add(T item) => Add(item);
|
|
||||||
|
|
||||||
|
[NotNull]
|
||||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||||
|
|
||||||
internal void ReplaceWith([NotNull] IEnumerable<T> other) {
|
internal void ReplaceWith([NotNull] IEnumerable<T> other) {
|
||||||
|
|
|
@ -375,10 +375,8 @@ namespace ArchiSteamFarm.NLog {
|
||||||
|
|
||||||
bool reconfigure = false;
|
bool reconfigure = false;
|
||||||
|
|
||||||
foreach (LoggingRule consoleLoggingRule in ConsoleLoggingRules) {
|
foreach (LoggingRule _ in ConsoleLoggingRules.Where(consoleLoggingRule => LogManager.Configuration.LoggingRules.Remove(consoleLoggingRule))) {
|
||||||
if (LogManager.Configuration.LoggingRules.Remove(consoleLoggingRule)) {
|
reconfigure = true;
|
||||||
reconfigure = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reconfigure) {
|
if (reconfigure) {
|
||||||
|
|
Loading…
Reference in a new issue