public static Data Create(Guid id, byte[] bytes, MediaTypes mimeType) { var result = new Data { Id = id, Bytes = bytes, MimeType = mimeType.ToString() }; return result; }
public static Data FromPhysicalName(string physicalName, byte[] bytes) { var fileName = Path.GetFileNameWithoutExtension(physicalName); var mimeType = Path.GetExtension(physicalName); var id = new Guid(fileName); var result = new Data { Id = id, MimeType = mimeType, Bytes = bytes }; return result; }
public static Image FromImageComplex(ImageComplex fileComplex, Data data) { var fileImage = fileComplex.GetImage; var result = new Image { Id = fileImage.Id, Width = fileImage.Width, Height = fileImage.Height, Size = fileImage.Size, Data = data, IsCropped = fileComplex.HasCroppedImage }; return result; }
public void Add(Data fileData) { Add(new[] { fileData }); }
private string GetPhysicalName(Data data) { var result = $"{data.Id}.{data.MimeType}"; return result; }