byte[] IClassifyFormat <node> .GetRawData(node element) { if (element.DataType == DataType.List) { // Support a list of integers as this was how Classify encoded byte arrays before GetRawData was introduced return(((listNode)element).List.Select(nd => ExactConvert.ToByte(((valueNode)nd).Value)).ToArray()); } if (element.DataType == DataType.RawData) { return((byte[])((valueNode)element).Value); } return(null); }
byte[] IClassifyFormat <XElement> .GetRawData(XElement element) => element.HasElements // Support a list of integers as this was how Classify encoded byte arrays before GetRawData was introduced ? element.Elements().Select(el => ExactConvert.ToByte(el.Value)).ToArray() : Convert.FromBase64String(element.Value);