feat: replace LiteDB with Sqlite

- Replace LiteDB database engine with Sqlite
  Note: old databases will not be deleted
- Message duplication detection improvements
- Tolerate parse errors in release builds, log them
This commit is contained in:
Dean Sheather
2024-04-19 16:57:19 +10:00
parent d7573f7bf6
commit bb6c6b0034
36 changed files with 1421 additions and 906 deletions
+1 -1
View File
@@ -108,7 +108,7 @@ internal static class ChunkUtil {
} else if (rawPayload.Data.Length > 5 && rawPayload.Data[1] == 0x27 && rawPayload.Data[3] == 0x07) {
// uri payload
var uri = new Uri(Encoding.UTF8.GetString(rawPayload.Data[4..]));
link = new URIPayload(uri);
link = new UriPayload(uri);
} else if (Equals(rawPayload, RawPayload.LinkTerminator)) {
link = null;
}
+5 -5
View File
@@ -39,11 +39,11 @@ internal class AchievementPayload : Payload {
}
internal class URIPayload(Uri uri) : Payload
internal class UriPayload(Uri uri) : Payload
{
public override PayloadType Type => (PayloadType) 0x52;
public Uri Uri { get; init; } = uri;
public Uri Uri { get; } = uri;
private static readonly string[] ExpectedSchemes = ["http", "https"];
private static readonly string DefaultScheme = "https";
@@ -55,7 +55,7 @@ internal class URIPayload(Uri uri) : Payload
/// <exception cref="UriFormatException">
/// If the URI is invalid, or if the scheme is not supported.
/// </exception>
public static URIPayload ResolveURI(string rawURI)
public static UriPayload ResolveURI(string rawURI)
{
ArgumentNullException.ThrowIfNull(rawURI);
@@ -64,7 +64,7 @@ internal class URIPayload(Uri uri) : Payload
{
if (rawURI.StartsWith($"{scheme}://"))
{
return new URIPayload(new Uri(rawURI));
return new UriPayload(new Uri(rawURI));
}
}
if (rawURI.Contains("://"))
@@ -72,7 +72,7 @@ internal class URIPayload(Uri uri) : Payload
throw new UriFormatException($"Unsupported scheme in URL: {rawURI}");
}
return new URIPayload(new Uri($"{DefaultScheme}://{rawURI}"));
return new UriPayload(new Uri($"{DefaultScheme}://{rawURI}"));
}
protected override void DecodeImpl(BinaryReader reader, long endOfStream)