18 lines
1,016 B
C#
18 lines
1,016 B
C#
using System.Reflection;
|
|
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Converter;
|
|
|
|
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Logic
|
|
{
|
|
public static class HashLogic
|
|
{
|
|
private static string GetNonce() => Assembly.GetExecutingAssembly().GetName().Version.ToString().Replace(".", "_");
|
|
public static string CreateSourceHash<T>(T responseCO) where T : class, new()
|
|
=> (responseCO != null) ? CustomJsonConverter.SerializeObjectToJson(responseCO)?.GetHashCode().ToString() + "__" + GetNonce() : null;
|
|
|
|
//public static string CreateResponseHash<T>(T responseCO, string requestHash) where T : class, IGetResponseCo, new()
|
|
// => (responseCO != null && !responseCO.Hash.Equals(requestHash)) ? responseCO.Hash : null;
|
|
//public static T CreateResponseData<T>(T responseCO, string requestHash) where T : class, IGetResponseCo, new()
|
|
// => (responseCO != null && !responseCO.Hash.Equals(requestHash)) ? responseCO : null;
|
|
|
|
}
|
|
}
|