protected internal ZlibWrapper?DetermineWrapper(ICharSequence acceptEncoding) { float starQ = -1.0f; float gzipQ = -1.0f; float deflateQ = -1.0f; ICharSequence[] parts = CharUtil.Split(acceptEncoding, ','); foreach (ICharSequence encoding in parts) { float q = 1.0f; int equalsPos = encoding.IndexOf('='); if (equalsPos != -1) { try { var ddd = encoding.ToString(equalsPos + 1); q = float.Parse(encoding.ToString(equalsPos + 1)); } catch (FormatException) { // Ignore encoding q = 0.0f; } } if (encoding.Contains('*')) { starQ = q; } else if (AsciiString.Contains(encoding, GZipString) && q > gzipQ) { gzipQ = q; } else if (AsciiString.Contains(encoding, DeflateString) && q > deflateQ) { deflateQ = q; } } if (gzipQ > 0.0f || deflateQ > 0.0f) { return(gzipQ >= deflateQ ? ZlibWrapper.Gzip : ZlibWrapper.Zlib); } if (starQ > 0.0f) { // ReSharper disable CompareOfFloatsByEqualityOperator if (gzipQ == -1.0f) { return(ZlibWrapper.Gzip); } if (deflateQ == -1.0f) { return(ZlibWrapper.Zlib); } // ReSharper restore CompareOfFloatsByEqualityOperator } return(null); }