// // Content-Encoding // private static int FormattedContentEncodingLength(IHeaderField field) { ContentEncodingHf ce = (ContentEncodingHf)field; ThrowIfInvaludEncodingType(ce.EncodingType); return(Enum.GetName(typeof(EncodingType), ce.EncodingType).Length); }
private static int FormatContentEncoding(byte[] buffer, int offset, IHeaderField headerField) { ContentEncodingHf ce = (ContentEncodingHf)headerField; // this should not to be here ThrowIfInvaludEncodingType(ce.EncodingType); //get string from enum string encodingStringValue = " " + Enum.GetName(typeof(EncodingType), ce.EncodingType).ToLower(); //inset bytes for (int i = 0; i < encodingStringValue.Length; i++) { buffer[i + offset] = (byte)encodingStringValue[i]; } //return writted bytes return(encodingStringValue.Length); }