Kotz's editorconfig styles slightly modified. Target typed new usage. Brackets in expressions used for clarity.

This commit is contained in:
Kwoth
2021-12-26 02:52:09 +01:00
parent 68741ec484
commit d18f9429c6
172 changed files with 921 additions and 494 deletions

View File

@@ -24,11 +24,11 @@ public sealed class BotCredsProvider : IBotCredsProvider
private string OldCredsJsonBackupPath => Path.Combine(Directory.GetCurrentDirectory(), "credentials.json.bak");
private Creds _creds = new Creds();
private IConfigurationRoot _config;
private readonly Creds _creds = new();
private readonly IConfigurationRoot _config;
private readonly object reloadLock = new object();
private readonly object reloadLock = new();
public void Reload()
{
lock (reloadLock)

View File

@@ -21,7 +21,7 @@ public class CurrencyService : ICurrencyService, INService
}
private CurrencyTransaction GetCurrencyTransaction(ulong userId, string reason, long amount) =>
new CurrencyTransaction
new()
{
Amount = amount,
UserId = userId,

View File

@@ -13,9 +13,9 @@ public class GoogleApiService : IGoogleApiService, INService
{
private const string SearchEngineId = "018084019232060951019:hs5piey28-e";
private YouTubeService yt;
private UrlshortenerService sh;
private CustomsearchService cs;
private readonly YouTubeService yt;
private readonly UrlshortenerService sh;
private readonly CustomsearchService cs;
public GoogleApiService(IBotCredentials creds, IHttpClientFactory factory)
{
@@ -32,7 +32,7 @@ public class GoogleApiService : IGoogleApiService, INService
sh = new(bcs);
cs = new(bcs);
}
private static readonly Regex plRegex = new Regex("(?:youtu\\.be\\/|list=)(?<id>[\\da-zA-Z\\-_]*)", RegexOptions.Compiled);
private static readonly Regex plRegex = new("(?:youtu\\.be\\/|list=)(?<id>[\\da-zA-Z\\-_]*)", RegexOptions.Compiled);
public async Task<IEnumerable<string>> GetPlaylistIdsByKeywordsAsync(string keywords, int count = 1)
{
await Task.Yield();

View File

@@ -67,7 +67,7 @@ public class RedisCache : IDataCache
return _db.StringSetAsync("novel_" + key, data, expiry: TimeSpan.FromHours(3));
}
private readonly object timelyLock = new object();
private readonly object timelyLock = new();
public TimeSpan? AddTimelyClaim(ulong id, int period)
{
if (period == 0)

View File

@@ -55,7 +55,7 @@ public class SoundCloudVideo
{
public string Kind { get; set; } = string.Empty;
public long Id { get; set; } = 0;
public SoundCloudUser User { get; set; } = new SoundCloudUser();
public SoundCloudUser User { get; set; } = new();
public string Title { get; set; } = string.Empty;
public string FullName => User.Name + " - " + Title;
public bool? Streamable { get; set; } = false;