Skip to content

Commit

Permalink
Update packages and fix reading charmap
Browse files Browse the repository at this point in the history
  • Loading branch information
TETYYS committed Apr 21, 2024
1 parent f6e84d7 commit 6173a01
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
dotnet: [ '3.0.x', '3.1.x', '5.0.x' ]
dotnet: [ '5.0.x', '6.0.x', '8.0.x' ]

name: Build project on .NET ${{ matrix.dotnet }}
steps:
Expand Down
11 changes: 6 additions & 5 deletions MessageHeightTwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ public static void FillCharMap(string CharMapPath)
using (GZipStream decompressionStream = new GZipStream(originalFileStream, CompressionMode.Decompress)) {
while (true) {
var bX = new byte[sizeof(float)];
if (decompressionStream.Read(bX, 0, sizeof(float)) == 0) {
broken = true;
break;
}
var bCharWrapping = decompressionStream.ReadByte() == 0x01;
if (decompressionStream.ReadAtLeast(bX, sizeof(float), false) == 0) {
broken = true;
break;
}

var bCharWrapping = decompressionStream.ReadByte() == 0x01;

charProperties.Add(new CharacterProperty(BitConverter.ToSingle(bX, 0), bCharWrapping));
}
Expand Down
10 changes: 5 additions & 5 deletions MessageHeightTwitch.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand All @@ -14,9 +14,9 @@
<None Remove="Tests\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.3" />
<PackageReference Include="System.Memory" Version="4.5.4" />
<PackageReference Include="System.Text.Json" Version="4.7.0" />
<PackageReference Include="Unicode.net" Version="0.1.2" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="Unicode.net" Version="2.0.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
15 changes: 13 additions & 2 deletions Tests/UnitTest.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Abstractions;

namespace Tests
{
public class UnitTest
{
private readonly ITestOutputHelper output;

public UnitTest(ITestOutputHelper output)
{
this.output = output;
}

[Fact]
public void Test()
{
Expand All @@ -22,9 +30,9 @@ public void Test()
KeyValuePair.Create(Tuple.Create<string, string, string, int, Dictionary<string, string>>(
"FeelsGoodMan Clap Emoji spam", "TETYYS", "🍁😄😊😃☺😉😍😘😚😳😌😌😁😜😝😒😒😏😏😓😔😞😖😖😰😨😣😢😢😭😂😲😱💛👽👿👿😷😪😡😠💙💜💗💚❤💔💓💘💨👎✨💦👌🌟🎶👊✊💢💢❕🔥✌👋💩❔💤👍✋👐☝👯🙆🙆👆👇💪🙅💁🚶👉👈🏃🙇💏💏💃🙌🙌🙏💃💑💆👶👮👮👼👵💇💅👸👸💂👱👦👧👲👲💀👣👳👩👨👷👷💋🍀🌴🌵🌹🌵🌾🌻🐚🌺🍃🍃🍂🐘🐙🐙🌷🌸🐛🐑🐫🐧🐧💐🐔🐔🐎🐤🐳🐟🐦🐒🐵🐍🐠🌀🐺🐗🐮🐰⚡🌙🐹🐷🐻🐭⛄☁🐶🐨🐯☔☔☀🌊🐸🎍🎇🎁🔔🎐💝🎎🎑🎉🎈🎈🎃🎒🎓👻💿📀🎏🎏🎆🎄📷📼🔍🔓🔊💻🎥📺📢🔒🔑📣📱📠📻✂🔨📠☎➿💡📲🏈🏈🏀📩📫🚬⚽⚾⚾📮🛀🛀🎾⛳💊🚽💺💉🎱🏊🏆🎨🎤👾🏄🎯🎧🎧🎺🀄♠♥🎬🎷🎷🎸📝♣♦📖〽👟👘💼👜👡👠👠🎀💄💍🎩👢👕👑💎☕☕👒👔👗🌂🍵🍺🍜🍜🍲🍻🍻🍱🍞🍞🍳🍣🍶🍴🍙🍢🍡🍘🍔🍔🍟🍚🍦🍧🍆🍅🎂🍰🍎🍊🍉🍓🍊🌄🎢🚗🚗🚢🌃🌃🚕🚌🚌🗽🗽✈🚓🚒🎡🎡🚒🚒🚲⛲🌈🏠🏩🏧🏯🏨🏫💒🏰🏰⛺⛪🏣🏥🏬🏭🏭🗼🌇🏦🌆🗻🇫🇷🇪🇸🇮🇹🇷🇺🇩🇪🇺🇸🇨🇳💈⛽🎫🎰🇰🇷🇰🇷🇯🇵🔰🚄🚉🚧🎌🏁⚠🚃🚚🚥♨1⃣1⃣3⃣4⃣5⃣6⃣7⃣⬅🈵🈵🈵🈁🆕🔝🆙🆒🈹🉐🈳🈵🈺🈯🈯🈶🈶🈶🈚🈷🈸🈸🈂🚻🚹🚺🚼🚭♿♿✳🔞㊗㊙🚾🚇✴💟📴💹💹♈♉♊♋♋♌♎♎🔯⛎♒♒♑♒♓⛎⛎⛎♎♍♌♊♑🅰🅱🆎🆎🔲🔲🔴🔳🔳🕛🕐🕑🕒🕓🕔🕕❌🕚🕘🕗🕖©®™", 1, null), 590.0f
),
KeyValuePair.Create(Tuple.Create<string, string, string, int, Dictionary<string, string>>(
/*KeyValuePair.Create(Tuple.Create<string, string, string, int, Dictionary<string, string>>(
"??? (sub emote test)", "TETYYS", "———————————————————————— forsenDiglett ??? ????? ????? ??????????? ??????? forsenDiglett ——————————————————————— ", 1, new Dictionary<string, string>() { { "forsenDiglett", "https://static-cdn.jtvnw.net/emoticons/v1/122255/1.0" } }), 90.89f
),
),*/
KeyValuePair.Create(Tuple.Create<string, string, string, int, Dictionary<string, string>>(
"Original dick gachiBASS", "TETYYS", "_______________________ ░░░░█─────────────█──▀── ░░░░▓█───────▄▄▀▀█────── ░░░░▒░█────▄█▒░░▄░█───── ░░░░░░░▀▄─▄▀▒▀▀▀▄▄▀──DO─ ░░░░░░░░░█▒░░░░▄▀───YOU─ ▒▒▒░░░░▄▀▒░░░░▄▀───LIKE─ ▓▓▓▓▒░█▒░░░░░█▄───WHAT─ █████▀▒░░░░░█░▀▄───YOU── █████▒▒░░░▒█░░░▀▄─SEE?── ███▓▓▒▒▒▀▀▀█▄░░░░█────── ▓██▓▒▒▒▒▒▒▒▒▒█░░░░█───── ▓▓█▓▒▒▒▒▒▒▓▒▒█░░░░░█──── ░▒▒▀▀▄▄▄▄█▄▄▀░░░░░░░.", 1, null), 290.89f
),
Expand Down Expand Up @@ -171,6 +179,9 @@ public void Test()

foreach (var test in tests) {
var height = mht.CalculateMessageHeight(test.Key.Item3, test.Key.Item2, test.Key.Item2, test.Key.Item4, test.Key.Item5);
if (Math.Floor(test.Value) != height) {
output.WriteLine(test.Key.Item1);
}
Assert.Equal(Math.Floor(test.Value), height);
}
}
Expand Down

0 comments on commit 6173a01

Please sign in to comment.