0
0
mirror of https://github.com/sp-tarkov/loot-dump-processor.git synced 2025-02-13 09:50:44 -05:00
BlueXTX 3cb1be1ec9
Fix static loot output (#6)
* Improved thread safety and async processing in dump processor components

* Removed unused _processedDumps field and simplified variable scope in QueuePipeline
2025-01-12 23:19:41 +00:00

30 lines
1.1 KiB
C#

using System.Security.Cryptography;
using System.Text;
using LootDumpProcessor.Model;
namespace LootDumpProcessor.Utils;
public static class ProcessorUtil
{
public static string GetSaneId(this Template x) =>
$"({x.Position.GetValueOrDefault().X}, {x.Position.GetValueOrDefault().Y}, {x.Position.GetValueOrDefault().Z}, {Math.Round(x.Rotation.GetValueOrDefault().X, 3)}," +
$" {Math.Round(x.Rotation.GetValueOrDefault().Y, 3)}, {Math.Round(x.Rotation.GetValueOrDefault().Z, 3)}," +
$" {x.UseGravity}, {x.IsGroupPosition})";
public static string GetLocationId(this Template x) =>
$"({x.Position.GetValueOrDefault().X}, {x.Position.GetValueOrDefault().Y}, {x.Position.GetValueOrDefault().Z})";
public static T? Copy<T>(T? obj) where T : ICloneable
{
if (obj == null)
return default;
return (T)obj.Clone();
}
public static List<T>? Copy<T>(List<T>? obj) where T : ICloneable
{
return obj?.Select(o => o.Clone()).Cast<T>().ToList();
}
public static string HashFile(string text) => Convert.ToBase64String(SHA256.HashData(Encoding.UTF8.GetBytes(text)));
}