roadie/RoadieLibrary/Data/ImagePartial.cs

29 lines
776 B
C#
Raw Normal View History

2018-11-04 15:16:52 +00:00
using Roadie.Library.Imaging;
using System;
2018-11-03 21:21:36 +00:00
using System.Linq;
namespace Roadie.Library.Data
{
public partial class Image
{
public string Etag
{
get
{
using (var md5 = System.Security.Cryptography.MD5.Create())
{
2018-11-04 15:16:52 +00:00
return String.Concat(md5.ComputeHash(System.Text.Encoding.Default.GetBytes(string.Format("{0}{1}", this.RoadieId, this.LastUpdated))).Select(x => x.ToString("D2")));
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-04 20:33:37 +00:00
}