Updated common abstractions
This commit is contained in:
parent
4fe4c4eff2
commit
b045015efb
23 changed files with 47 additions and 51 deletions
|
@ -1,4 +1,4 @@
|
|||
using OneOf;
|
||||
using OneOf;
|
||||
using OneOf.Types;
|
||||
|
||||
namespace Ellie.Common;
|
||||
|
|
|
@ -63,7 +63,7 @@ public sealed class MemoryBotCache : IBotCache
|
|||
{
|
||||
lock (_cacheLock)
|
||||
{
|
||||
var toReturn = _cache.TryGetValue(key.Key, out var old) && old is not null;
|
||||
var toReturn = _cache.TryGetValue(key.Key, out var old ) && old is not null;
|
||||
_cache.Remove(key.Key);
|
||||
return new(toReturn);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace System.Collections.Generic;
|
||||
|
||||
|
@ -46,12 +46,8 @@ public sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ICollection<T
|
|||
public void CopyTo(T[] array, int arrayIndex)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(array);
|
||||
|
||||
if (arrayIndex < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(arrayIndex));
|
||||
|
||||
if (arrayIndex >= array.Length)
|
||||
throw new ArgumentOutOfRangeException(nameof(arrayIndex));
|
||||
ArgumentOutOfRangeException.ThrowIfNegative(arrayIndex);
|
||||
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(arrayIndex, array.Length);
|
||||
|
||||
CopyToInternal(array, arrayIndex);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections;
|
||||
using System.Collections;
|
||||
|
||||
namespace Ellie.Common;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Ellie.Common;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Ellie.Common;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ellie.Common;
|
||||
namespace Ellie.Common;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using EllieBot.Common.Yml;
|
||||
using EllieBot.Common.Yml;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
@ -82,14 +82,14 @@ public static class StringExtensions
|
|||
// Step 3
|
||||
for (var i = 1; i <= n; i++)
|
||||
//Step 4
|
||||
for (var j = 1; j <= m; j++)
|
||||
{
|
||||
// Step 5
|
||||
var cost = t[j - 1] == s[i - 1] ? 0 : 1;
|
||||
for (var j = 1; j <= m; j++)
|
||||
{
|
||||
// Step 5
|
||||
var cost = t[j - 1] == s[i - 1] ? 0 : 1;
|
||||
|
||||
// Step 6
|
||||
d[i, j] = Math.Min(Math.Min(d[i - 1, j] + 1, d[i, j - 1] + 1), d[i - 1, j - 1] + cost);
|
||||
}
|
||||
// Step 6
|
||||
d[i, j] = Math.Min(Math.Min(d[i - 1, j] + 1, d[i, j - 1] + 1), d[i - 1, j - 1] + cost);
|
||||
}
|
||||
|
||||
// Step 7
|
||||
return d[n, m];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ellie.Common;
|
||||
namespace Ellie.Common;
|
||||
|
||||
public static class StandardConversions
|
||||
{
|
||||
|
|
|
@ -50,9 +50,9 @@ public class EventPubSub : IPubSub
|
|||
{
|
||||
// get subscriptions for this action
|
||||
if (_actions.TryGetValue(key.Key, out var actions))
|
||||
// get subscriptions which have the same action hash code
|
||||
// note: having this as a list allows for multiple subscriptions of
|
||||
// the same insance's/static method
|
||||
// get subscriptions which have the same action hash code
|
||||
// note: having this as a list allows for multiple subscriptions of
|
||||
// the same insance's/static method
|
||||
{
|
||||
if (actions.TryGetValue(action, out var sameActions))
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ellie.Common;
|
||||
namespace Ellie.Common;
|
||||
|
||||
public interface IPubSub
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ellie.Common;
|
||||
namespace Ellie.Common;
|
||||
|
||||
public interface ISeria
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ellie.Common;
|
||||
namespace Ellie.Common;
|
||||
|
||||
public readonly struct TypedKey<TData>
|
||||
{
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot;
|
||||
|
||||
public interface IBotCredentials
|
||||
{
|
||||
string Token { get; }
|
||||
string GoogleApiKey { get; }
|
||||
string EllieAiToken { get; }
|
||||
ICollection<ulong> OwnerIds { get; set; }
|
||||
string GoogleApiKey { get; }
|
||||
bool UsePrivilegedIntents { get; }
|
||||
string RapidApiKey { get; }
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
using System.Globalization;
|
||||
|
||||
namespace EllieBot.Common;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#nullable disable
|
||||
#nullable disable
|
||||
namespace EllieBot.Services;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#nullable disable
|
||||
|
||||
namespace EllieBot.Services;
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in a new issue