From 4bae223d958cbc1123d545902b48186c3958da69 Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 22 May 2023 00:33:58 +0200 Subject: [PATCH] Custom UniqueIdentifier. --- Tranga/Publication.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tranga/Publication.cs b/Tranga/Publication.cs index 9abfae9..b378f60 100644 --- a/Tranga/Publication.cs +++ b/Tranga/Publication.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text; +using Newtonsoft.Json; namespace Tranga; @@ -35,7 +36,8 @@ public readonly struct Publication this.status = status; this.downloadUrl = downloadUrl; this.folderName = string.Concat(sortName.Split(Path.GetInvalidPathChars().Concat(Path.GetInvalidFileNameChars()).ToArray())); - this.internalId = Guid.NewGuid().ToString(); + string onlyLowerAscii = this.sortName.ToLower().Where(Char.IsAscii).ToString()!; + this.internalId = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{onlyLowerAscii}{this.year}")); } /// Serialized JSON String for series.json