Exemple #1
0
        protected virtual List <IBundleModifier> CreateBundleModifierChain()
        {
            List <IBundleModifier> bundleModifierChain = new List <IBundleModifier>();

            bundleModifierChain.Add(new PublishBundleModifier(bundleInfo => true));

            if (this.Encryption)
            {
                Func <BundleInfo, bool> filter = null;
                switch (this.FilterType)
                {
                case EncryptionFilterType.All:
                    filter = bundle =>
                    {
                        return(true);
                    };
                    break;

                case EncryptionFilterType.RegularExpression:
                    filter = bundle =>
                    {
                        return(Regex.IsMatch(bundle.FullName, this.filterExpression));
                    };
                    break;

                case EncryptionFilterType.BundleNameList:
                    string[] bundles = Regex.Split(this.bundleNames, @"(\s)", RegexOptions.IgnorePatternWhitespace);
                    filter = bundle =>
                    {
                        return(Array.IndexOf(bundles, bundle.FullName) >= 0);
                    };
                    break;
                }

                IStreamEncryptor encryptor = this.GetEncryptor();
                bundleModifierChain.Add(new CryptographBundleModifier(encryptor, filter));
            }

            if (this.useHashFilename)
            {
                bundleModifierChain.Add(new HashFilenameBundleModifier());
            }

            return(bundleModifierChain);
        }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="encryptor"></param>
 /// <param name="filter"></param>
 public CryptographBundleModifier(IStreamEncryptor encryptor, Func <BundleInfo, bool> filter)
 {
     this.filter    = filter;
     this.encryptor = encryptor;
 }
Exemple #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="encryptor"></param>
 public CryptographBundleModifier(IStreamEncryptor encryptor) : this(encryptor, null)
 {
 }