public static SyndicationCompressionFilter GetFilterForScheme(string schemes, Stream contextFilter)
        {
            SyndicationCompressionFilter filter = null;
            bool foundDeflate = false;
            bool foundGZip    = false;

            schemes = schemes.ToLower(CultureInfo.InvariantCulture);
            SyndicationCompressionSettings settings = SyndicationCompressionSettings.GetSettings();

            if (schemes.IndexOf("deflate") >= 0)
            {
                foundDeflate = true;
            }
            if (schemes.IndexOf("gzip") >= 0)
            {
                foundGZip = true;
            }

            if (settings.CompressionType == Algorithms.Deflate && foundDeflate)
            {
                filter = new SyndicationCompressionFilter(new DeflateFilter(contextFilter, settings.CompressionLevel),
                                                          "deflate");
            }
            else if (settings.CompressionType == Algorithms.GZip && foundGZip)
            {
                filter = new SyndicationCompressionFilter(new GZipFilter(contextFilter), "gzip");
            }
            else if (foundDeflate) //-- If Use Accepts Other Than Configured
            {
                filter = new SyndicationCompressionFilter(new DeflateFilter(contextFilter, settings.CompressionLevel),
                                                          "deflate");
            }
            else if (foundGZip) //-- If Use Accepts Other Than Configured
            {
                filter = new SyndicationCompressionFilter(new GZipFilter(contextFilter), "gzip");
            }

            return(filter);
        }
        public static SyndicationCompressionFilter GetFilterForScheme(string schemes, Stream contextFilter)
        {
            SyndicationCompressionFilter filter = null;
            bool foundDeflate = false;
            bool foundGZip = false;

            schemes = schemes.ToLower(CultureInfo.InvariantCulture);
            SyndicationCompressionSettings settings = SyndicationCompressionSettings.GetSettings();

            if (schemes.IndexOf("deflate") >= 0)
            {
                foundDeflate = true;
            }
            if (schemes.IndexOf("gzip") >= 0)
            {
                foundGZip = true;
            }

            if (settings.CompressionType == Algorithms.Deflate && foundDeflate)
            {
                filter = new SyndicationCompressionFilter(new DeflateFilter(contextFilter, settings.CompressionLevel),
                                                          "deflate");
            }
            else if (settings.CompressionType == Algorithms.GZip && foundGZip)
            {
                filter = new SyndicationCompressionFilter(new GZipFilter(contextFilter), "gzip");
            }
            else if (foundDeflate) //-- If Use Accepts Other Than Configured
            {
                filter = new SyndicationCompressionFilter(new DeflateFilter(contextFilter, settings.CompressionLevel),
                                                          "deflate");
            }
            else if (foundGZip) //-- If Use Accepts Other Than Configured
            {
                filter = new SyndicationCompressionFilter(new GZipFilter(contextFilter), "gzip");
            }

            return filter;
        }