Files
api/MareSynchronosAPI/Data/FileReplacementData.cs
rootdarkarchon 9199d9c667 Mare 0.9 (#17)
* add jwt expiry

* bump api version

* start rework permissions

* ok so in theory this compiles

* update api

* update api

* update api

* update api once more

* oh apiii I hate submodules

* blabla

* we only live to suffer

* stop reading my commit messages

* nothing to see here move along

* update nuget

* some rework

---------

Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
2023-10-17 21:36:40 +02:00

29 lines
994 B
C#

using MessagePack;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace MareSynchronos.API.Data;
[MessagePackObject(keyAsPropertyName: true)]
public class FileReplacementData
{
public FileReplacementData()
{
DataHash = new(() =>
{
var json = JsonSerializer.Serialize(this);
#pragma warning disable SYSLIB0021 // Type or member is obsolete
using SHA256CryptoServiceProvider cryptoProvider = new();
#pragma warning restore SYSLIB0021 // Type or member is obsolete
return BitConverter.ToString(cryptoProvider.ComputeHash(Encoding.UTF8.GetBytes(json))).Replace("-", "", StringComparison.Ordinal);
});
}
[JsonIgnore]
public Lazy<string> DataHash { get; }
public string FileSwapPath { get; set; } = string.Empty;
public string[] GamePaths { get; set; } = Array.Empty<string>();
public string Hash { get; set; } = string.Empty;
}