ArchiSteamFarm/ArchiSteamFarm.Tests
Łukasz Domeradzki 2aab56b775
Rewrite SendMessage() functions to account for new rate-limits (#2335)
* Rewrite SendMessage() functions to account for new rate-limits

* Refactor new message splitting logic into SteamChatMessage.cs

This makes it ready for unit tests

* Change the concept into UTF8-oriented logic

* Misc

* Add fix for another unit test

* Update

* Fix failing test

I SPENT HOURS ON THIS

* Misc

* Misc

* Add additional unit tests ensuring this works as designed

* Misc

* Misc

* Add one more unit test

* Rework the logic to account for new findings

* Misc

* Add unit test verifying exception on too long prefix

* Address first @Abrynos concern

Because we can

* Throw also on too long prefix in regards to newlines

* Correct wrong bytesRead calculation

This worked previously only because we actually never had enough of room for escaped chars anyway and skipped over (2 + 2 missing bytes was smaller than 5 required to make a line)

* Add unit test verifying if calculation was done properly

* Address @Ryzhehvost concern

* Handle empty newlines in the message properly

* Misc

No reason to even calculate utf8 bytes for empty lines

* Misc

* Add unit test verifying the reserved escape message bytes count

* Correct calculation of lines by taking into account \r

* Update ArchiSteamFarm/Steam/Bot.cs

Co-authored-by: Sebastian Göls <6608231+Abrynos@users.noreply.github.com>

* @Abrynos next time check if it compiles without warnings

* Update SteamChatMessage.cs

* Apply @Abrynos idea in a different way

* Rewrite bot part to remove unnecessary delegate

* Add @Ryzhehvost test

* Add debug output

* Extend @Ryzhehvost test for prefix

* Misc

* Misc refactor

* Misc

* Misc

* Add logic for limited accounts, correct for unlimited

Thanks @Ryzhehvost

* Misc

Co-authored-by: Sebastian Göls <6608231+Abrynos@users.noreply.github.com>
2021-06-18 19:50:14 +02:00
..
ArchiSteamFarm.Tests.csproj Manage package versions centrally (#2317) 2021-05-02 14:51:08 +02:00
AssemblyInfo.cs More code inspections! 2021-05-06 17:14:03 +02:00
Bot.cs Misc 2021-06-14 00:32:23 +02:00
SteamChatMessage.cs Rewrite SendMessage() functions to account for new rate-limits (#2335) 2021-06-18 19:50:14 +02:00
Trading.cs Refactor EVERYTHING 2021-05-08 01:37:22 +02:00