Implement plugin system (#1020)

* Implement basic plugin system

* The dawn of new era

* Add plugins warning

* Move more members to PublicAPI

* Open commands for the plugins

* Add IBotHackNewChat

* Run plugin events in parallel

* Use properties in IPlugin

* Hook our custom plugin into CI to ensure it compiles

* Fix dotnet brain damage

* Add IBotsComparer

* Add code documentation

* Add IBotTradeOffer

* Add IBotTradeOffer example

* Add IBotTradeOfferResults

* Final bulletproofing

* Final renaming
This commit is contained in:
Łukasz Domeradzki
2019-01-10 22:33:07 +01:00
committed by GitHub
parent 62a770479e
commit 0f2a816b92
49 changed files with 3025 additions and 1653 deletions

View File

@@ -23,9 +23,10 @@ using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
namespace ArchiSteamFarm.Collections {
internal sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ISet<T> {
public sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ISet<T> {
public int Count => BackingCollection.Count;
public bool IsReadOnly => false;
@@ -114,12 +115,15 @@ namespace ArchiSteamFarm.Collections {
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
// We use Count() and not Any() because we must ensure full loop pass
internal bool AddRange(IEnumerable<T> items) => items.Count(Add) > 0;
[PublicAPI]
public bool AddRange(IEnumerable<T> items) => items.Count(Add) > 0;
// We use Count() and not Any() because we must ensure full loop pass
internal bool RemoveRange(IEnumerable<T> items) => items.Count(Remove) > 0;
[PublicAPI]
public bool RemoveRange(IEnumerable<T> items) => items.Count(Remove) > 0;
internal bool ReplaceIfNeededWith(IReadOnlyCollection<T> other) {
[PublicAPI]
public bool ReplaceIfNeededWith(IReadOnlyCollection<T> other) {
if (SetEquals(other)) {
return false;
}
@@ -129,7 +133,8 @@ namespace ArchiSteamFarm.Collections {
return true;
}
internal void ReplaceWith(IEnumerable<T> other) {
[PublicAPI]
public void ReplaceWith(IEnumerable<T> other) {
BackingCollection.Clear();
foreach (T item in other) {