From 766f105dab25371d1139046895fb66fba75c7926 Mon Sep 17 00:00:00 2001 From: Pythonic-Rainbow Date: Sat, 6 Jan 2024 12:13:52 +0000 Subject: [PATCH] Downgrade to .NET 6 --- .github/workflows/compile-bot.yml | 2 +- Bot/Bot.csproj | 2 +- Bot/Coc.cs | 32 ++++++++++++++++++++++--------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/compile-bot.yml b/.github/workflows/compile-bot.yml index 8f3e051..a3b6db6 100644 --- a/.github/workflows/compile-bot.yml +++ b/.github/workflows/compile-bot.yml @@ -22,7 +22,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 8.0.x + dotnet-version: 6.0.x - name: Build run: dotnet publish -c Release -r linux-arm64 --no-self-contained - name: Upload program diff --git a/Bot/Bot.csproj b/Bot/Bot.csproj index a52506a..eab7c3a 100644 --- a/Bot/Bot.csproj +++ b/Bot/Bot.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net6.0 enable enable Hyperstellar diff --git a/Bot/Coc.cs b/Bot/Coc.cs index 3477b98..f17b7b8 100644 --- a/Bot/Coc.cs +++ b/Bot/Coc.cs @@ -6,29 +6,43 @@ namespace Hyperstellar; internal class Coc { - internal readonly struct DonationTuple(int donated, int received) + internal readonly struct DonationTuple { - internal readonly int Donated = donated; - internal readonly int Received = received; + internal readonly int Donated; + internal readonly int Received; + + public DonationTuple(int donated, int received) + { + Donated = donated; + Received = received; + } } - internal readonly struct ClanMemberInfo(string name, DonationTuple donation) + internal readonly struct ClanMemberInfo { - internal readonly string Name = name; - internal readonly DonationTuple Donation = donation; + internal readonly string Name; + internal readonly DonationTuple Donation; + + public ClanMemberInfo(string name, DonationTuple donation) + { + Name = name; + Donation = donation; + } + internal readonly int Donated => Donation.Donated; internal readonly int Received => Donation.Received; } private readonly struct ClanInfo { - internal readonly Dictionary Members = []; + internal readonly Dictionary Members = new(); public ClanInfo(Clan clan) { foreach (var member in clan.MemberList!) { - Members[member.Tag] = new(member.Name, new(member.Donations, member.DonationsReceived)); + DonationTuple donation = new(member.Donations, member.DonationsReceived); + Members[member.Tag] = new(member.Name, donation); } } } @@ -50,7 +64,7 @@ private static async Task PollAsync() private static async Task CheckDonations(ClanInfo clan, Clan c) { - Dictionary donationsDelta = []; + Dictionary donationsDelta = new(); foreach (var memberTag in clan.Members.Keys) { bool existsInPrevClan = _prevClan.Members.TryGetValue(memberTag, out ClanMemberInfo previous);