2018-11-11 01:11:58 +00:00
|
|
|
|
using Microsoft.Net.Http.Headers;
|
|
|
|
|
using Roadie.Library.Imaging;
|
|
|
|
|
using Roadie.Library.Utility;
|
2018-11-04 15:16:52 +00:00
|
|
|
|
using System;
|
2018-11-03 21:21:36 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Roadie.Library.Data
|
|
|
|
|
{
|
|
|
|
|
public partial class Image
|
|
|
|
|
{
|
2018-11-11 16:20:33 +00:00
|
|
|
|
public static string CacheRegionUrn(Guid Id)
|
2018-11-11 01:11:58 +00:00
|
|
|
|
{
|
|
|
|
|
return string.Format("urn:image:{0}", Id);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-11 16:20:33 +00:00
|
|
|
|
public static string CacheUrn(Guid Id)
|
|
|
|
|
{
|
|
|
|
|
return $"urn:image_by_id:{ Id }";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string CacheKey
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Artist.CacheUrn(this.RoadieId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-11 01:11:58 +00:00
|
|
|
|
public string CacheRegion
|
2018-11-03 21:21:36 +00:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2018-11-11 16:20:33 +00:00
|
|
|
|
return Image.CacheRegionUrn(this.RoadieId);
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GenerateSignature()
|
|
|
|
|
{
|
|
|
|
|
if (this.Bytes == null || !this.Bytes.Any())
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2018-11-04 15:16:52 +00:00
|
|
|
|
return ImageHasher.AverageHash(this.Bytes).ToString();
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
2018-11-11 01:11:58 +00:00
|
|
|
|
|
|
|
|
|
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
2018-11-04 20:33:37 +00:00
|
|
|
|
}
|