- More ImRaii

- Cleanup
- Spanish, French, Dutch, Chinese loc update
This commit is contained in:
Infi
2024-11-21 11:58:22 +01:00
parent 1a1995759a
commit 3cfe65d2d4
23 changed files with 283 additions and 332 deletions
+22 -20
View File
@@ -2,38 +2,46 @@ using Dalamud.Game.Text.SeStringHandling;
namespace ChatTwo.Util;
internal class PartyFinderPayload : Payload {
internal class PartyFinderPayload : Payload
{
public override PayloadType Type => (PayloadType) 0x50;
internal uint Id { get; }
internal PartyFinderPayload(uint id) {
internal PartyFinderPayload(uint id)
{
Id = id;
}
protected override byte[] EncodeImpl() {
protected override byte[] EncodeImpl()
{
throw new NotImplementedException();
}
protected override void DecodeImpl(BinaryReader reader, long endOfStream) {
protected override void DecodeImpl(BinaryReader reader, long endOfStream)
{
throw new NotImplementedException();
}
}
internal class AchievementPayload : Payload {
internal class AchievementPayload : Payload
{
public override PayloadType Type => (PayloadType) 0x51;
internal uint Id { get; }
internal AchievementPayload(uint id) {
internal AchievementPayload(uint id)
{
Id = id;
}
protected override byte[] EncodeImpl() {
protected override byte[] EncodeImpl()
{
throw new NotImplementedException();
}
protected override void DecodeImpl(BinaryReader reader, long endOfStream) {
protected override void DecodeImpl(BinaryReader reader, long endOfStream)
{
throw new NotImplementedException();
}
}
@@ -45,8 +53,8 @@ internal class UriPayload(Uri uri) : Payload
public Uri Uri { get; } = uri;
private const string DefaultScheme = "https";
private static readonly string[] ExpectedSchemes = ["http", "https"];
private static readonly string DefaultScheme = "https";
/// <summary>
/// Create a URIPayload from a raw URI string. If the URI does not have a
@@ -59,18 +67,12 @@ internal class UriPayload(Uri uri) : Payload
{
ArgumentNullException.ThrowIfNull(rawURI);
// Check for expected scheme ://, if not add https://
foreach (var scheme in ExpectedSchemes)
{
if (rawURI.StartsWith($"{scheme}://"))
{
return new UriPayload(new Uri(rawURI));
}
}
// Check for an expected scheme '://', if not add 'https://'
if (ExpectedSchemes.Any(scheme => rawURI.StartsWith($"{scheme}://")))
return new UriPayload(new Uri(rawURI));
if (rawURI.Contains("://"))
{
throw new UriFormatException($"Unsupported scheme in URL: {rawURI}");
}
return new UriPayload(new Uri($"{DefaultScheme}://{rawURI}"));
}
@@ -90,7 +92,7 @@ internal class EmotePayload : Payload
{
public override PayloadType Type => (PayloadType) 0x53;
public string Code;
public string Code = string.Empty;
public static EmotePayload ResolveEmote(string code)
{