roadie/Roadie.Api.Library/Data/ImagePartial.cs
2018-12-26 13:39:13 -06:00

48 lines
No EOL
1,005 B
C#

using Microsoft.Net.Http.Headers;
using Roadie.Library.Imaging;
using Roadie.Library.Utility;
using System;
using System.Linq;
namespace Roadie.Library.Data
{
public partial class Image
{
public static string CacheRegionUrn(Guid Id)
{
return string.Format("urn:image:{0}", Id);
}
public static string CacheUrn(Guid Id)
{
return $"urn:image_by_id:{ Id }";
}
public string CacheKey
{
get
{
return Artist.CacheUrn(this.RoadieId);
}
}
public string CacheRegion
{
get
{
return Image.CacheRegionUrn(this.RoadieId);
}
}
public string GenerateSignature()
{
if (this.Bytes == null || !this.Bytes.Any())
{
return null;
}
return ImageHasher.AverageHash(this.Bytes).ToString();
}
}
}