private async Task<byte[]> GetData() { switch (DecodeContentType) { case DecodeContentTypeEnum.Hexa: Hexadecimal = Compact(Hexadecimal).Replace("-", "").Trim(); int len = Hexadecimal.Length / 2; var tmp = new byte[len]; for (int i = 0; i < len; i++) { tmp[i] = Convert.ToByte(Hexadecimal.Substring(i * 2, 2), 16); } return tmp; case DecodeContentTypeEnum.Base64: return Convert.FromBase64String(Compact(Base64)); case DecodeContentTypeEnum.File: var ms = new System.IO.MemoryStream(); await File.Data.CopyToAsync(ms); return ms.ToArray(); default: throw new ArgumentOutOfRangeException($"Decode content type not implemented {DecodeContentType}"); } }