vars and target-typed new

This commit is contained in:
Kwoth
2021-12-20 00:15:39 +01:00
parent ee33313519
commit cd379fd308
75 changed files with 198 additions and 198 deletions

View File

@@ -35,8 +35,8 @@
// if (_token != default && (DateTime.UtcNow - _token.Expiry) > TimeSpan.FromHours(1))
// return;
//
// const string clientId = "";
// const string clientSecret = "";
// const string clientId = string.Empty;
// const string clientSecret = string.Empty;
//
// var client = _httpClientFactory.CreateClient();
// var res = await client.PostAsync("https://id.twitch.tv/oauth2/token" +

View File

@@ -55,7 +55,7 @@ public partial class Searches
await ctx.SendPaginatedConfirmAsync(page, curPage =>
{
var templates = "";
var templates = string.Empty;
foreach (var template in data.Skip(curPage * 15).Take(15))
{
templates += $"**{template.Name}:**\n key: `{template.Id}`\n";

View File

@@ -85,7 +85,7 @@ public partial class Searches
{
var sb = new System.Text.StringBuilder();
sb.AppendLine($"```{"#",-5}{"Character Name",-23}{"League",-10}{"Class",-13}{"Level",-3}");
for (int i = 0; i < tempList.Count; i++)
for (var i = 0; i < tempList.Count; i++)
{
var character = tempList[i];
@@ -131,7 +131,7 @@ public partial class Searches
var sb = new System.Text.StringBuilder();
sb.AppendLine($"```{"#",-5}{"League Name",-23}");
for (int i = 0; i < leagues.Count; i++)
for (var i = 0; i < leagues.Count; i++)
{
var league = leagues[i];
@@ -168,8 +168,8 @@ public partial class Searches
{
var obj = JObject.Parse(await http.GetStringAsync(res).ConfigureAwait(false));
float chaosEquivalent = 0.0F;
float conversionEquivalent = 0.0F;
var chaosEquivalent = 0.0F;
var conversionEquivalent = 0.0F;
// poe.ninja API does not include a "chaosEquivalent" property for Chaos Orbs.
if (cleanCurrency == "Chaos Orb")

View File

@@ -36,7 +36,7 @@ public partial class Searches
[NadekoCommand, Aliases]
public async Task Place(PlaceType placeType, uint width = 0, uint height = 0)
{
var url = "";
var url = string.Empty;
switch (placeType)
{
case PlaceType.Cage:

View File

@@ -75,7 +75,7 @@ public partial class Searches : NadekoModule<SearchesService>
}
else
{
Func<double, double> f = StandardConversions.CelsiusToFahrenheit;
var f = StandardConversions.CelsiusToFahrenheit;
var tz = ctx.Guild is null
? TimeZoneInfo.Utc
@@ -616,7 +616,7 @@ public partial class Searches : NadekoModule<SearchesService>
using (var img = new Image<Rgba32>(colorObjects.Length * 50, 50))
{
for (int i = 0; i < colorObjects.Length; i++)
for (var i = 0; i < colorObjects.Length; i++)
{
var x = i * 50;
img.Mutate(m => m.FillPolygon(colorObjects[i], new PointF[] {

View File

@@ -72,7 +72,7 @@ public class FeedsService : INService
.Reverse() // start from the oldest
.ToList();
if (!_lastPosts.TryGetValue(kvp.Key, out DateTime lastFeedUpdate))
if (!_lastPosts.TryGetValue(kvp.Key, out var lastFeedUpdate))
{
lastFeedUpdate = _lastPosts[kvp.Key] =
items.Any() ? items[items.Count - 1].LastUpdate : DateTime.UtcNow;

View File

@@ -77,7 +77,7 @@ public class SearchesService : INService
public async Task<Stream> GetRipPictureAsync(string text, Uri imgUrl)
{
byte[] data = await _cache.GetOrAddCachedDataAsync($"nadeko_rip_{text}_{imgUrl}",
var data = await _cache.GetOrAddCachedDataAsync($"nadeko_rip_{text}_{imgUrl}",
GetRipPictureFactory,
(text, imgUrl),
TimeSpan.FromDays(1)).ConfigureAwait(false);
@@ -388,7 +388,7 @@ public class SearchesService : INService
return new MtgData[0];
var tasks = new List<Task<MtgData>>(cards.Length);
for (int i = 0; i < cards.Length; i++)
for (var i = 0; i < cards.Length; i++)
{
var card = cards[i];

View File

@@ -83,7 +83,7 @@ public partial class Searches
return;
}
List<FollowedStream> streams = new List<FollowedStream>();
var streams = new List<FollowedStream>();
using (var uow = _db.GetDbContext())
{
var all = uow