use file-scoped namespaces to reduce nesting

some formatting might be fucked
This commit is contained in:
13xforever
2022-06-30 00:59:46 +05:00
parent a5d780f03d
commit 92751ba6e9
223 changed files with 23740 additions and 23975 deletions

View File

@@ -12,8 +12,8 @@ using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection;
using StrawberryShake;
namespace CirrusCiClient
{
namespace CirrusCiClient;
public static class CirrusCi
{
private static readonly MemoryCache BuildInfoCache = new(new MemoryCacheOptions { ExpirationScanFrequency = TimeSpan.FromHours(1) });
@@ -149,4 +149,3 @@ namespace CirrusCiClient
private static string? ToTimestamp(this DateTime? dateTime) => dateTime.HasValue ? (dateTime.Value.ToUniversalTime() - DateTime.UnixEpoch).TotalMilliseconds.ToString("0") : null;
private static DateTime FromTimestamp(long timestamp) => DateTime.UnixEpoch.AddMilliseconds(timestamp);
}
}

View File

@@ -1,8 +1,8 @@
using System;
using CirrusCiClient.Generated;
namespace CirrusCiClient.POCOs
{
namespace CirrusCiClient.POCOs;
public record BuildOSInfo
{
public string? Filename { get; init; }
@@ -18,4 +18,3 @@ namespace CirrusCiClient.POCOs
public BuildOSInfo? LinuxBuild { get; init; }
public BuildOSInfo? MacBuild { get; init; }
}
}

View File

@@ -1,7 +1,7 @@
using System;
namespace CirrusCiClient.POCOs
{
namespace CirrusCiClient.POCOs;
public record ProjectBuildStats
{
public TimeSpan Percentile95 { get; init; }
@@ -22,4 +22,3 @@ namespace CirrusCiClient.POCOs
StdDev = TimeSpan.FromSeconds(420),
};
}
}

View File

@@ -5,8 +5,8 @@ using System.Net.Http.Headers;
using Microsoft.IO;
using NLog;
namespace CompatApiClient
{
namespace CompatApiClient;
using ReturnCodeType = Dictionary<int, (bool displayResults, bool overrideAll, bool displayFooter, string info)>;
public static class ApiConfig
@@ -95,4 +95,3 @@ namespace CompatApiClient
}
}
}
}

View File

@@ -11,8 +11,8 @@ using CompatApiClient.POCOs;
using CompatApiClient.Utils;
using Microsoft.Extensions.Caching.Memory;
namespace CompatApiClient
{
namespace CompatApiClient;
public class Client: IDisposable
{
private readonly HttpClient client;
@@ -138,4 +138,3 @@ namespace CompatApiClient
client.Dispose();
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace CompatApiClient.Compression
{
namespace CompatApiClient.Compression;
public class CompressedContent : HttpContent
{
private readonly HttpContent content;
@@ -39,4 +39,3 @@ namespace CompatApiClient.Compression
Headers.ContentLength = null;
}
}
}

View File

@@ -5,8 +5,8 @@ using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace CompatApiClient.Compression
{
namespace CompatApiClient.Compression;
public class CompressionMessageHandler : DelegatingHandler
{
public ICollection<ICompressor> Compressors { get; }
@@ -65,4 +65,3 @@ namespace CompatApiClient.Compression
return response;
}
}
}

View File

@@ -1,8 +1,8 @@
using System.IO;
using System.Threading.Tasks;
namespace CompatApiClient.Compression
{
namespace CompatApiClient.Compression;
public abstract class Compressor : ICompressor
{
public abstract string EncodingType { get; }
@@ -29,4 +29,3 @@ namespace CompatApiClient.Compression
return memStream.Length;
}
}
}

View File

@@ -4,8 +4,8 @@ using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace CompatApiClient.Compression
{
namespace CompatApiClient.Compression;
public class DecompressedContent : HttpContent
{
private readonly HttpContent content;
@@ -39,4 +39,3 @@ namespace CompatApiClient.Compression
Headers.ContentLength = null;
}
}
}

View File

@@ -1,8 +1,8 @@
using System.IO;
using System.IO.Compression;
namespace CompatApiClient.Compression
{
namespace CompatApiClient.Compression;
public class DeflateCompressor : Compressor
{
public override string EncodingType => "deflate";
@@ -13,4 +13,3 @@ namespace CompatApiClient.Compression
protected override Stream CreateDecompressionStream(Stream input)
=> new DeflateStream(input, CompressionMode.Decompress, true);
}
}

View File

@@ -1,8 +1,8 @@
using System.IO;
using System.IO.Compression;
namespace CompatApiClient.Compression
{
namespace CompatApiClient.Compression;
public class GZipCompressor : Compressor
{
public override string EncodingType => "gzip";
@@ -13,4 +13,3 @@ namespace CompatApiClient.Compression
protected override Stream CreateDecompressionStream(Stream input)
=> new GZipStream(input, CompressionMode.Decompress, true);
}
}

View File

@@ -1,12 +1,11 @@
using System.IO;
using System.Threading.Tasks;
namespace CompatApiClient.Compression
{
namespace CompatApiClient.Compression;
public interface ICompressor
{
string EncodingType { get; }
Task<long> CompressAsync(Stream source, Stream destination);
Task<long> DecompressAsync(Stream source, Stream destination);
}
}

View File

@@ -2,8 +2,8 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace CompatApiClient
{
namespace CompatApiClient;
public sealed class CompatApiCommitHashConverter : JsonConverter<string>
{
public override string? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
@@ -23,4 +23,3 @@ namespace CompatApiClient
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
=> writer.WriteStringValue(value);
}
}

View File

@@ -1,9 +1,8 @@
using System.Text.Json;
namespace CompatApiClient
{
namespace CompatApiClient;
public sealed class DashedNamingPolicy: JsonNamingPolicy
{
public override string ConvertName(string name) => NamingStyles.Dashed(name);
}
}

View File

@@ -1,8 +1,8 @@
using System;
using System.Text;
namespace CompatApiClient
{
namespace CompatApiClient;
public static class NamingStyles
{
public static string CamelCase(string value)
@@ -55,4 +55,3 @@ namespace CompatApiClient
return builder.ToString();
}
}
}

View File

@@ -1,9 +1,8 @@
using System.Text.Json;
namespace CompatApiClient
{
namespace CompatApiClient;
public sealed class SnakeCaseNamingPolicy: JsonNamingPolicy
{
public override string ConvertName(string name) => NamingStyles.Underscore(name);
}
}

View File

@@ -1,8 +1,7 @@
namespace CompatApiClient.Formatters
{
namespace CompatApiClient.Formatters;
public static class SpecialJsonNamingPolicy
{
public static SnakeCaseNamingPolicy SnakeCase { get; } = new();
public static DashedNamingPolicy Dashed { get; } = new();
}
}

View File

@@ -2,8 +2,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace CompatApiClient.POCOs
{
namespace CompatApiClient.POCOs;
#nullable disable
public class CompatResult
@@ -40,4 +39,3 @@ namespace CompatApiClient.POCOs
}
#nullable restore
}

View File

@@ -1,5 +1,4 @@
namespace CompatApiClient.POCOs
{
namespace CompatApiClient.POCOs;
#nullable disable
public class UpdateInfo
@@ -24,4 +23,3 @@
}
#nullable restore
}

View File

@@ -2,8 +2,8 @@
using System.Collections.Generic;
using CompatApiClient.Utils;
namespace CompatApiClient
{
namespace CompatApiClient;
public class RequestBuilder
{
public string? Search { get; private set; } = "";
@@ -31,4 +31,3 @@ namespace CompatApiClient
return ApiConfig.BaseUrl.SetQueryParameters(parameters);
}
}
}

View File

@@ -1,8 +1,8 @@
using System;
using System.Net.Http;
namespace CompatApiClient.Utils
{
namespace CompatApiClient.Utils;
public static class ConsoleLogger
{
public static void PrintError(Exception e, HttpResponseMessage? response, bool isError = true)
@@ -23,4 +23,3 @@ namespace CompatApiClient.Utils
catch { }
}
}
}

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
namespace CompatApiClient.Utils
{
namespace CompatApiClient.Utils;
public static class Statistics
{
public static long Mean(this IEnumerable<long> data)
@@ -37,4 +37,3 @@ namespace CompatApiClient.Utils
return Math.Sqrt((double)((n * σx2) - σ2) / ((n - 1) * n));
}
}
}

View File

@@ -5,8 +5,8 @@ using System.Net;
using System.Net.Http;
using System.Text;
namespace CompatApiClient.Utils
{
namespace CompatApiClient.Utils;
public static class UriExtensions
{
private static readonly Uri FakeHost = new("sc://q"); // s:// will be parsed as file:///s:// for some reason
@@ -118,4 +118,3 @@ namespace CompatApiClient.Utils
}
}
}
}

View File

@@ -1,7 +1,7 @@
using System;
namespace CompatApiClient.Utils
{
namespace CompatApiClient.Utils;
public static class Utils
{
private const long UnderKB = 1000;
@@ -57,4 +57,3 @@ namespace CompatApiClient.Utils
return $"{bytes / 1024.0 / 1024 / 1024:0.##} GB";
}
}
}

View File

@@ -5,8 +5,8 @@ using System.Threading.Tasks;
using CompatApiClient;
using Microsoft.Extensions.Caching.Memory;
namespace GithubClient
{
namespace GithubClient;
public class Client
{
private readonly Octokit.GitHubClient client;
@@ -149,5 +149,3 @@ namespace GithubClient
}
}
}

View File

@@ -16,8 +16,8 @@ using HtmlAgilityPack;
using IrdLibraryClient.IrdFormat;
using IrdLibraryClient.POCOs;
namespace IrdLibraryClient
{
namespace IrdLibraryClient;
public class IrdClient
{
public static readonly string BaseUrl = "https://ps3.aldostools.org";
@@ -215,4 +215,3 @@ namespace IrdLibraryClient
return result;
}
}
}

View File

@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Text;
namespace IrdLibraryClient.IrdFormat
{
namespace IrdLibraryClient.IrdFormat;
public sealed class Ird
{
internal Ird(){}
@@ -41,4 +41,3 @@ namespace IrdLibraryClient.IrdFormat
public long Offset;
public byte[] Md5Checksum = null!;
}
}

View File

@@ -6,8 +6,8 @@ using System.Text;
using CompatApiClient;
using Force.Crc32;
namespace IrdLibraryClient.IrdFormat
{
namespace IrdLibraryClient.IrdFormat;
public static class IrdParser
{
public static Ird Parse(byte[] content)
@@ -76,4 +76,3 @@ namespace IrdLibraryClient.IrdFormat
return result;
}
}
}

View File

@@ -5,8 +5,8 @@ using System.Linq;
using CompatApiClient;
using DiscUtils.Iso9660;
namespace IrdLibraryClient.IrdFormat
{
namespace IrdLibraryClient.IrdFormat;
public static class IsoHeaderParser
{
public static List<string> GetFilenames(this Ird ird)
@@ -29,4 +29,3 @@ namespace IrdLibraryClient.IrdFormat
).ToList();
}
}
}

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace IrdLibraryClient.POCOs
{
namespace IrdLibraryClient.POCOs;
public sealed class SearchResult
{
public List<SearchResultItem>? Data;
@@ -22,4 +22,3 @@ namespace IrdLibraryClient.POCOs
public string? Filename;
}
}

View File

@@ -15,8 +15,8 @@ using System.Text.RegularExpressions;
using CompatApiClient.Formatters;
using MediafireClient.POCOs;
namespace MediafireClient
{
namespace MediafireClient;
public sealed class Client
{
private readonly HttpClient client;
@@ -97,4 +97,3 @@ namespace MediafireClient
return null;
}
}
}

View File

@@ -1,5 +1,4 @@
namespace MediafireClient.POCOs
{
namespace MediafireClient.POCOs;
#nullable disable
public sealed class LinksResult
@@ -23,4 +22,3 @@
}
#nullable restore
}

View File

@@ -10,8 +10,8 @@ using System.Text.Json;
using System.Text.Json.Serialization;
using OneDriveClient.POCOs;
namespace OneDriveClient
{
namespace OneDriveClient;
public class Client
{
private readonly HttpClient client;
@@ -105,4 +105,3 @@ namespace OneDriveClient
return null;
}
}
}

View File

@@ -1,7 +1,7 @@
using System.Text.Json.Serialization;
namespace OneDriveClient.POCOs
{
namespace OneDriveClient.POCOs;
public sealed class DriveItemMeta
{
public string? Id;
@@ -12,4 +12,3 @@ namespace OneDriveClient.POCOs
[JsonPropertyName("@content.downloadUrl")]
public string? ContentDownloadUrl;
}
}

View File

@@ -7,8 +7,8 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using CompatApiClient;
namespace PsnClient
{
namespace PsnClient;
public class CustomTlsCertificatesHandler: HttpClientHandler
{
private readonly Func<HttpRequestMessage, X509Certificate2?, X509Chain?, SslPolicyErrors, bool>? defaultCertHandler;
@@ -107,4 +107,3 @@ namespace PsnClient
return defaultCertHandler?.Invoke(requestMessage, certificate, chain, policyErrors) ?? true;
}
}
}

View File

@@ -1,5 +1,4 @@
namespace PsnClient.POCOs
{
namespace PsnClient.POCOs;
// https://transact.playstation.com/assets/app.json
// returns an array of different objects
// api endpoints, oauth, oauth authorize, telemetry, localization options, billing template, locales, country names, topup settings, paypal sandbox settings, gct, apm, sofort, ...
@@ -22,4 +21,3 @@
public string? Language; // "ar"
public string? Country; // "AE|BH|KW|LB|OM|QA|SA"
}
}

View File

@@ -1,7 +1,6 @@
using System;
namespace PsnClient.POCOs
{
namespace PsnClient.POCOs;
#nullable disable
public sealed class Container
{
@@ -201,4 +200,3 @@ namespace PsnClient.POCOs
public string Locale;
}
#nullable restore
}

View File

@@ -1,5 +1,4 @@
namespace PsnClient.POCOs
{
namespace PsnClient.POCOs;
#nullable disable
public class Relationships
{
@@ -23,4 +22,3 @@
public RelationshipsChildrenItem[] Data;
}
#nullable restore
}

View File

@@ -1,5 +1,4 @@
namespace PsnClient.POCOs
{
namespace PsnClient.POCOs;
#nullable disable
public class StoreNavigation
{
@@ -47,4 +46,3 @@
public bool IsSeparator;
}
#nullable restore
}

View File

@@ -1,7 +1,6 @@
using System.Text.Json.Serialization;
namespace PsnClient.POCOs
{
namespace PsnClient.POCOs;
#nullable disable
// https://store.playstation.com/kamaji/api/valkyrie_storefront/00_09_000/user/stores
// requires session
@@ -29,4 +28,3 @@ namespace PsnClient.POCOs
public string TumblerUrl;
}
#nullable restore
}

View File

@@ -1,7 +1,6 @@
using System.Xml.Serialization;
namespace PsnClient.POCOs
{
namespace PsnClient.POCOs;
#nullable disable
[XmlRoot("title-info")]
@@ -36,4 +35,3 @@ namespace PsnClient.POCOs
}
#nullable restore
}

View File

@@ -1,8 +1,7 @@
using System;
using System.Xml.Serialization;
namespace PsnClient.POCOs
{
namespace PsnClient.POCOs;
#nullable disable
[XmlRoot("titlepatch")]
@@ -50,4 +49,3 @@ namespace PsnClient.POCOs
}
#nullable restore
}

View File

@@ -18,8 +18,8 @@ using Microsoft.Extensions.Caching.Memory;
using PsnClient.POCOs;
using PsnClient.Utils;
namespace PsnClient
{
namespace PsnClient;
public class Client
{
private readonly HttpClient client;
@@ -445,4 +445,3 @@ namespace PsnClient
}
}
}
}

View File

@@ -1,5 +1,5 @@
namespace PsnClient.Utils
{
namespace PsnClient.Utils;
public static class LocaleUtils
{
public static (string language, string country) AsLocaleData(this string locale)
@@ -15,4 +15,3 @@
return (localeParts[0], localeParts[1]);
}
}
}

View File

@@ -3,8 +3,8 @@ using System.Globalization;
using System.Security.Cryptography;
using System.Text;
namespace PsnClient.Utils
{
namespace PsnClient.Utils;
public static class TmdbHasher
{
private static readonly byte[] HmacKey = "F5DE66D2680E255B2DF79E74F890EBF349262F618BCAE2A9ACCDEE5156CE8DF2CDF2D48C71173CDC2594465B87405D197CF1AED3B7E9671EEB56CA6753C2E6B0".FromHexString();
@@ -40,4 +40,3 @@ namespace PsnClient.Utils
return result.ToString();
}
}
}

View File

@@ -11,8 +11,8 @@ using System.Text.Json.Serialization;
using CompatApiClient.Formatters;
using YandexDiskClient.POCOs;
namespace YandexDiskClient
{
namespace YandexDiskClient;
public sealed class Client
{
private readonly HttpClient client;
@@ -61,4 +61,3 @@ namespace YandexDiskClient
}
}
}

View File

@@ -1,5 +1,4 @@
namespace YandexDiskClient.POCOs
{
namespace YandexDiskClient.POCOs;
#nullable disable
public sealed class ResourceInfo
@@ -17,4 +16,3 @@
}
#nullable restore
}

View File

@@ -4,8 +4,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
namespace CompatBot.Commands.Attributes
{
namespace CompatBot.Commands.Attributes;
internal abstract class CheckBaseAttributeWithReactions: CheckBaseAttribute
{
protected abstract Task<bool> IsAllowed(CommandContext ctx, bool help);
@@ -36,4 +36,3 @@ namespace CompatBot.Commands.Attributes
return result;
}
}
}

View File

@@ -3,8 +3,8 @@ using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
namespace CompatBot.Commands.Attributes
{
namespace CompatBot.Commands.Attributes;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
internal class LimitedToHelpChannel: CheckBaseAttribute
{
@@ -20,4 +20,3 @@ namespace CompatBot.Commands.Attributes
return false;
}
}
}

View File

@@ -7,8 +7,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
namespace CompatBot.Commands.Attributes
{
namespace CompatBot.Commands.Attributes;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
internal class LimitedToOfftopicChannel: CheckBaseAttribute
{
@@ -43,4 +43,3 @@ namespace CompatBot.Commands.Attributes
|| channel.Name.Contains("offtopic", StringComparison.InvariantCultureIgnoreCase);
}
}
}

View File

@@ -7,8 +7,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
namespace CompatBot.Commands.Attributes
{
namespace CompatBot.Commands.Attributes;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
internal class LimitedToSpamChannel: CheckBaseAttribute
{
@@ -43,4 +43,3 @@ namespace CompatBot.Commands.Attributes
return channel.IsPrivate || channel.Name.Contains("spam", StringComparison.InvariantCultureIgnoreCase);
}
}
}

View File

@@ -3,8 +3,8 @@ using System.Threading.Tasks;
using CompatBot.Database.Providers;
using DSharpPlus.CommandsNext;
namespace CompatBot.Commands.Attributes
{
namespace CompatBot.Commands.Attributes;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
internal class RequiresBotModRole: CheckBaseAttributeWithReactions
{
@@ -15,4 +15,3 @@ namespace CompatBot.Commands.Attributes
return Task.FromResult(ModProvider.IsMod(ctx.User.Id));
}
}
}

View File

@@ -3,8 +3,8 @@ using System.Threading.Tasks;
using CompatBot.Utils;
using DSharpPlus.CommandsNext;
namespace CompatBot.Commands.Attributes
{
namespace CompatBot.Commands.Attributes;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
internal class RequiresBotSudoerRole: CheckBaseAttributeWithReactions
{
@@ -13,4 +13,3 @@ namespace CompatBot.Commands.Attributes
protected override Task<bool> IsAllowed(CommandContext ctx, bool help)
=> Task.FromResult(ctx.User.IsModerator(ctx.Client, ctx.Guild));
}
}

View File

@@ -6,8 +6,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
namespace CompatBot.Commands.Attributes
{
namespace CompatBot.Commands.Attributes;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
internal class RequiresDm: CheckBaseAttribute
{
@@ -28,4 +28,3 @@ namespace CompatBot.Commands.Attributes
return false;
}
}
}

View File

@@ -3,8 +3,8 @@ using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
namespace CompatBot.Commands.Attributes
{
namespace CompatBot.Commands.Attributes;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
internal class RequiresNotMedia: CheckBaseAttribute
{
@@ -13,4 +13,3 @@ namespace CompatBot.Commands.Attributes
return Task.FromResult(ctx.Channel.Name != "media");
}
}
}

View File

@@ -3,8 +3,8 @@ using System.Threading.Tasks;
using CompatBot.Utils;
using DSharpPlus.CommandsNext;
namespace CompatBot.Commands.Attributes
{
namespace CompatBot.Commands.Attributes;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
internal class RequiresSupporterRole: CheckBaseAttributeWithReactions
{
@@ -15,4 +15,3 @@ namespace CompatBot.Commands.Attributes
return Task.FromResult(ctx.User.IsWhitelisted(ctx.Client, ctx.Guild) || ctx.User.IsSupporter(ctx.Client, ctx.Guild));
}
}
}

View File

@@ -3,8 +3,8 @@ using System.Threading.Tasks;
using CompatBot.Utils;
using DSharpPlus.CommandsNext;
namespace CompatBot.Commands.Attributes
{
namespace CompatBot.Commands.Attributes;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
internal class RequiresWhitelistedRole: CheckBaseAttributeWithReactions
{
@@ -15,4 +15,3 @@ namespace CompatBot.Commands.Attributes
return Task.FromResult(ctx.User.IsWhitelisted(ctx.Client, ctx.Guild));
}
}
}

View File

@@ -1,8 +1,8 @@
using System;
using DSharpPlus.CommandsNext;
namespace CompatBot.Commands.Attributes
{
namespace CompatBot.Commands.Attributes;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
internal class TriggersTyping: Attribute
{
@@ -13,4 +13,3 @@ namespace CompatBot.Commands.Attributes
return !InDmOnly || ctx.Channel.IsPrivate;
}
}
}

View File

@@ -11,8 +11,8 @@ using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using Microsoft.Extensions.Caching.Memory;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal class BaseCommandModuleCustom : BaseCommandModule
{
private DateTimeOffset executionStart;
@@ -77,4 +77,3 @@ namespace CompatBot.Commands
private static bool TriggersTyping(CommandContext ctx)
=> ctx.Command?.CustomAttributes.OfType<TriggersTyping>().FirstOrDefault() is TriggersTyping a && a.ExecuteCheck(ctx);
}
}

View File

@@ -6,8 +6,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using org.mariuszgromada.math.mxparser;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("math")]
[Description("Math, here you go Juhn. Use `math help` for syntax help")]
internal sealed class BotMath : BaseCommandModuleCustom
@@ -47,4 +47,3 @@ namespace CompatBot.Commands
public Task Help(CommandContext ctx)
=> ctx.Channel.SendMessageAsync("Help for all the features and built-in constants and functions could be found at <https://mathparser.org/mxparser-math-collection/>");
}
}

View File

@@ -17,8 +17,8 @@ using DSharpPlus.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("stats")]
internal sealed class BotStats: BaseCommandModuleCustom
{
@@ -277,4 +277,3 @@ namespace CompatBot.Commands
internal static readonly string[] GoodKot = {"😸", "😺", "😻", "😽",};
private static readonly string[] MeanKot = {"🙀", "😿", "😾",};
}
}

View File

@@ -9,8 +9,8 @@ using CompatBot.Utils;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("commands"), Aliases("command"), RequiresBotModRole]
[Description("Used to enable and disable bot commands at runtime")]
public sealed class CommandsManagement : BaseCommandModule
@@ -194,4 +194,3 @@ namespace CompatBot.Commands
EnableSubcommands(ctx, subCmd);
}
}
}

View File

@@ -30,8 +30,8 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.TeamFoundation.Build.WebApi;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal sealed class CompatList : BaseCommandModuleCustom
{
private static readonly Client Client = new();
@@ -721,4 +721,3 @@ namespace CompatBot.Commands
}
}
}
}

View File

@@ -25,8 +25,8 @@ using DSharpPlus.Interactivity.Extensions;
using Microsoft.EntityFrameworkCore;
using Exception = System.Exception;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("filters"), Aliases("piracy", "filter"), RequiresBotSudoerRole, RequiresDm]
[Description("Used to manage content filters. **Works only in DM**")]
internal sealed class ContentFilters: BaseCommandModuleCustom
@@ -929,4 +929,3 @@ namespace CompatBot.Commands
return result;
}
}
}

View File

@@ -8,8 +8,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Converters;
using DSharpPlus.Entities;
namespace CompatBot.Commands.Converters
{
namespace CompatBot.Commands.Converters;
internal sealed class TextOnlyDiscordChannelConverter : IArgumentConverter<DiscordChannel>
{
private static Regex ChannelRegex { get; } = new(@"^<#(\d+)>$", RegexOptions.ECMAScript | RegexOptions.Compiled);
@@ -60,4 +60,3 @@ namespace CompatBot.Commands.Converters
return chn.Value == null ? Optional.FromNoValue<DiscordChannel>() : Optional.FromValue(chn.Value);
}
}
}

View File

@@ -7,8 +7,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal sealed class DevOnly : BaseCommandModuleCustom
{
[Command("whitespacetest"), Aliases("wst", "wstest")]
@@ -67,4 +67,3 @@ namespace CompatBot.Commands
await ctx.RespondAsync(builder).ConfigureAwait(false);
}
}
}

View File

@@ -3,8 +3,8 @@ using CompatBot.Commands.Attributes;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("e3")]
[Description("Provides information about the E3 event")]
internal sealed class E3: EventsBaseCommand
@@ -44,4 +44,3 @@ namespace CompatBot.Commands
public Task Countdown(CommandContext ctx)
=> E3Countdown(ctx);
}
}

View File

@@ -3,8 +3,8 @@ using CompatBot.Commands.Attributes;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("event"), Aliases("events", "e")]
[Description("Provides information about the various events in the game industry")]
internal sealed class Events: EventsBaseCommand
@@ -59,4 +59,3 @@ namespace CompatBot.Commands
public Task Countdown(CommandContext ctx, string? eventName = null)
=> NearestEvent(ctx, eventName);
}
}

View File

@@ -17,8 +17,8 @@ using DSharpPlus.EventArgs;
using DSharpPlus.Interactivity.Extensions;
using Microsoft.EntityFrameworkCore;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal class EventsBaseCommand: BaseCommandModuleCustom
{
private static readonly TimeSpan InteractTimeout = TimeSpan.FromMinutes(5);
@@ -616,4 +616,3 @@ namespace CompatBot.Commands
return result;
}
}
}

View File

@@ -19,8 +19,8 @@ using DSharpPlus.Interactivity.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("explain"), Aliases("botsplain", "define")]
[Cooldown(1, 3, CooldownBucketType.Channel)]
[Description("Used to manage and show explanations")]
@@ -444,4 +444,3 @@ namespace CompatBot.Commands
}
}
}
}

View File

@@ -13,8 +13,8 @@ using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using Microsoft.EntityFrameworkCore;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("rename")]
[Description("Manage users who has forced nickname.")]
internal sealed class ForcedNicknames : BaseCommandModuleCustom
@@ -252,4 +252,3 @@ namespace CompatBot.Commands
await ctx.SendAutosplitMessageAsync(table.ToString()).ConfigureAwait(false);
}
}
}

View File

@@ -15,8 +15,8 @@ using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using Microsoft.EntityFrameworkCore;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("fortune"), Aliases("fortunes")]
[Description("Gives you a fortune once a day")]
internal sealed class Fortune : BaseCommandModuleCustom
@@ -258,4 +258,3 @@ namespace CompatBot.Commands
await ctx.ReactWithAsync(Config.Reactions.Success, $"Removed {count} fortune{(count == 1 ? "" : "s")}", true).ConfigureAwait(false);
}
}
}

View File

@@ -13,8 +13,8 @@ using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using Microsoft.EntityFrameworkCore;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("invite"), Aliases("invites"), RequiresBotModRole]
[Description("Used to manage Discord invites whitelist")]
internal sealed class Invites: BaseCommandModuleCustom
@@ -175,4 +175,3 @@ namespace CompatBot.Commands
await List(ctx).ConfigureAwait(false);
}
}
}

View File

@@ -6,8 +6,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using IrdLibraryClient;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal sealed class Ird: BaseCommandModuleCustom
{
private static readonly IrdClient Client = new();
@@ -27,4 +27,3 @@ namespace CompatBot.Commands
await ctx.Channel.SendMessageAsync(embed: embed).ConfigureAwait(false);
}
}
}

View File

@@ -6,8 +6,8 @@ using CompatBot.Commands.Attributes;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("minesweeper"), Aliases("msgen")]
[LimitedToOfftopicChannel, Cooldown(1, 30, CooldownBucketType.Channel)]
[Description("Generates a minesweeper field with specified parameters")]
@@ -135,4 +135,3 @@ namespace CompatBot.Commands
return result;
}
}
}

View File

@@ -14,8 +14,8 @@ using DSharpPlus.Entities;
using HomoglyphConverter;
using Microsoft.EntityFrameworkCore;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal sealed class Misc: BaseCommandModuleCustom
{
private static readonly Random rng = new();
@@ -553,4 +553,3 @@ namespace CompatBot.Commands
await ctx.ReactWithAsync(Config.Reactions.Failure, "Invalid product code").ConfigureAwait(false);
}
}
}

View File

@@ -15,8 +15,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal sealed partial class Moderation
{
[Group("audit"), RequiresBotModRole]
@@ -321,4 +321,3 @@ namespace CompatBot.Commands
}
}
}
}

View File

@@ -8,8 +8,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal sealed partial class Moderation: BaseCommandModuleCustom
{
[Command("report"), RequiresWhitelistedRole]
@@ -170,4 +170,3 @@ namespace CompatBot.Commands
await ctx.ReactWithAsync(Config.Reactions.Success, "Message reported").ConfigureAwait(false);
}
}
}

View File

@@ -14,8 +14,8 @@ using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using TaskStatus = CirrusCiClient.Generated.TaskStatus;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("pr"), TriggersTyping]
[Description("Commands to list opened pull requests information")]
internal sealed class Pr: BaseCommandModuleCustom
@@ -302,4 +302,3 @@ namespace CompatBot.Commands
await message.Channel.SendMessageAsync(embed: issueInfo.AsEmbed()).ConfigureAwait(false);
}
}
}

View File

@@ -19,8 +19,8 @@ using DSharpPlus.Entities;
using DSharpPlus.Interactivity.Extensions;
using PsnClient.POCOs;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal sealed partial class Psn
{
[Group("check")]
@@ -223,4 +223,3 @@ namespace CompatBot.Commands
}
}
}
}

View File

@@ -9,8 +9,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using PsnClient;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("psn")]
[Description("Commands related to PSN metadata")]
internal sealed partial class Psn: BaseCommandModuleCustom
@@ -75,4 +75,3 @@ namespace CompatBot.Commands
await ctx.ReactWithAsync(Config.Reactions.Failure, $"Product code {contentId} already exists", true).ConfigureAwait(false);
}
}
}

View File

@@ -4,8 +4,8 @@ using DSharpPlus.Entities;
using DSharpPlus.SlashCommands;
using System.Threading.Tasks;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal sealed class SlashTest: ApplicationCommandModule
{
[SlashCommand("credits", "Author Credit")]
@@ -34,4 +34,3 @@ namespace CompatBot.Commands
}
}
}

View File

@@ -9,8 +9,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using Microsoft.EntityFrameworkCore;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal partial class Sudo
{
public sealed partial class Bot
@@ -81,4 +81,3 @@ namespace CompatBot.Commands
}
}
}
}

View File

@@ -13,8 +13,8 @@ using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using Microsoft.EntityFrameworkCore;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal partial class Sudo
{
private static readonly SemaphoreSlim LockObj = new(1, 1);
@@ -240,4 +240,3 @@ namespace CompatBot.Commands
}
}
}
}

View File

@@ -9,8 +9,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal partial class Sudo
{
[Group("dotnet")]
@@ -105,4 +105,3 @@ namespace CompatBot.Commands
}
}
}

View File

@@ -9,8 +9,8 @@ using CompatBot.Utils;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal sealed partial class Sudo
{
// '2018-06-09 08:20:44.968000 - '
@@ -173,4 +173,3 @@ namespace CompatBot.Commands
}
}
}
}

View File

@@ -6,8 +6,8 @@ using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal partial class Sudo
{
[Group("mod")]
@@ -95,4 +95,3 @@ namespace CompatBot.Commands
}
}
}
}

View File

@@ -19,8 +19,8 @@ using SharpCompress.Compressors.Deflate;
using SharpCompress.Writers;
using SharpCompress.Writers.Zip;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("sudo"), RequiresBotSudoerRole]
[Description("Used to manage bot moderators and sudoers")]
internal sealed partial class Sudo : BaseCommandModuleCustom
@@ -208,4 +208,3 @@ namespace CompatBot.Commands
return new Bot.Configuration().Set(ctx, nameof(Config.CryptoSalt), Convert.ToBase64String(salt));
}
}
}

View File

@@ -13,8 +13,8 @@ using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using Microsoft.EntityFrameworkCore;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("syscall"), Aliases("syscalls", "cell", "sce", "scecall", "scecalls"), LimitedToSpamChannel]
[Description("Provides information about syscalls used by games")]
internal sealed class Syscall: BaseCommandModuleCustom
@@ -175,4 +175,3 @@ namespace CompatBot.Commands
await ctx.Channel.SendMessageAsync($"No information available for `{title}`").ConfigureAwait(false);
}
}
}

View File

@@ -32,8 +32,8 @@ using RectangleF = SixLabors.ImageSharp.RectangleF;
using Size = SixLabors.ImageSharp.Size;
using SystemFonts = SixLabors.Fonts.SystemFonts;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Cooldown(1, 5, CooldownBucketType.Channel)]
internal sealed class Vision: BaseCommandModuleCustom
{
@@ -471,4 +471,3 @@ namespace CompatBot.Commands
return imageUrl;
}
}
}

View File

@@ -12,8 +12,8 @@ using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.CommandsNext.Converters;
using DSharpPlus.Entities;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
internal sealed partial class Warnings
{
[Group("list"), Aliases("show")]
@@ -217,4 +217,3 @@ namespace CompatBot.Commands
}
}
}
}

View File

@@ -13,8 +13,8 @@ using DSharpPlus.Entities;
using DSharpPlus.Interactivity.Extensions;
using Microsoft.EntityFrameworkCore;
namespace CompatBot.Commands
{
namespace CompatBot.Commands;
[Group("warn")]
[Description("Command used to manage warnings")]
internal sealed partial class Warnings: BaseCommandModuleCustom
@@ -341,4 +341,3 @@ namespace CompatBot.Commands
}
}
}
}

View File

@@ -26,8 +26,8 @@ using NLog.Targets.Wrappers;
using ILogger = NLog.ILogger;
using LogLevel = NLog.LogLevel;
namespace CompatBot
{
namespace CompatBot;
internal static class Config
{
private static IConfigurationRoot config = null!;
@@ -319,4 +319,3 @@ namespace CompatBot
}
}
}
}

View File

@@ -4,8 +4,8 @@ using System.ComponentModel.DataAnnotations.Schema;
using CompatApiClient;
using Microsoft.EntityFrameworkCore;
namespace CompatBot.Database
{
namespace CompatBot.Database;
internal class BotDb: DbContext
{
public DbSet<BotState> BotState { get; set; } = null!;
@@ -195,4 +195,3 @@ namespace CompatBot.Database
[Required]
public string Nickname { get; set; } = null!;
}
}

View File

@@ -11,8 +11,8 @@ using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Migrations.Internal;
namespace CompatBot.Database
{
namespace CompatBot.Database;
public static class DbImporter
{
public static async Task<bool> UpgradeAsync(CancellationToken cancellationToken)
@@ -266,4 +266,3 @@ namespace CompatBot.Database
}
}
}
}

View File

@@ -1,8 +1,8 @@
using System;
using Microsoft.EntityFrameworkCore;
namespace CompatBot.Database
{
namespace CompatBot.Database;
internal static class NamingConventionConverter
{
public static void ConfigureMapping(this ModelBuilder modelBuilder, Func<string, string> nameResolver)
@@ -28,4 +28,3 @@ namespace CompatBot.Database
}
}
}
}

View File

@@ -2,8 +2,8 @@
using System.Linq;
using Microsoft.EntityFrameworkCore;
namespace CompatBot.Database
{
namespace CompatBot.Database;
internal static class PrimaryKeyConvention
{
public static void ConfigureDefaultPkConvention(this ModelBuilder modelBuilder, string keyProperty = "Id")
@@ -28,4 +28,3 @@ namespace CompatBot.Database
}
}
}
}

View File

@@ -7,8 +7,8 @@ using System.Threading.Tasks;
using System.Xml.Linq;
using CompatApiClient.Compression;
namespace CompatBot.Database.Providers
{
namespace CompatBot.Database.Providers;
internal static class AmdDriverVersionProvider
{
private static readonly Dictionary<string, List<string>> VulkanToDriver = new();
@@ -167,4 +167,3 @@ namespace CompatBot.Database.Providers
return vulkanVersion;
}
}
}

View File

@@ -13,8 +13,8 @@ using Microsoft.EntityFrameworkCore;
using NReco.Text;
using Microsoft.Extensions.Caching.Memory;
namespace CompatBot.Database.Providers
{
namespace CompatBot.Database.Providers;
internal static class ContentFilter
{
private static Dictionary<FilterContext, AhoCorasickDoubleArrayTrie<Piracystring>?> filters = new();
@@ -267,4 +267,3 @@ namespace CompatBot.Database.Providers
? m.Groups[0].Value.Trim(256)
: null;
}
}

View File

@@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.Linq;
namespace CompatBot.Database.Providers
{
namespace CompatBot.Database.Providers;
internal static class DisabledCommandsProvider
{
private static readonly HashSet<string> DisabledCommands = new(StringComparer.InvariantCultureIgnoreCase);
@@ -57,4 +57,3 @@ namespace CompatBot.Database.Providers
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More