Ejemplo n.º 1
0
        public DecompressionOptions(byte[] dict, IReadOnlyDictionary <ZSTD_dParameter, int> advancedParams)
            : this(dict)
        {
            if (advancedParams == null)
            {
                return;
            }

            foreach (var param in advancedParams)
            {
                var bounds = ExternMethods.ZSTD_dParam_getBounds(param.Key);
                bounds.error.EnsureZstdSuccess();

                if (param.Value < bounds.lowerBound || param.Value > bounds.upperBound)
                {
                    throw new ArgumentOutOfRangeException(nameof(advancedParams), $"Advanced parameter '{param.Key}' is out of range [{bounds.lowerBound}, {bounds.upperBound}]");
                }
            }

            this.AdvancedParams = advancedParams;
        }