Exemple #1
0
        /// <summary>
        /// Constructs a instance of Asset
        /// </summary>
        /// <param name="virtualPath">Virtual path to asset file</param>
        /// <param name="bundleFile">Bundle file</param>
        /// <param name="virtualFileSystemWrapper">Virtual file system wrapper</param>
        /// <param name="styleFileExtensionMappings">Style file extension mappings</param>
        /// <param name="scriptFileExtensionMappings">Script file extension mappings</param>
        public Asset(string virtualPath, BundleFile bundleFile,
                     IVirtualFileSystemWrapper virtualFileSystemWrapper,
                     FileExtensionMappingCollection styleFileExtensionMappings,
                     FileExtensionMappingCollection scriptFileExtensionMappings)
        {
            _virtualFileSystemWrapper    = virtualFileSystemWrapper;
            _styleFileExtensionMappings  = styleFileExtensionMappings;
            _scriptFileExtensionMappings = scriptFileExtensionMappings;
            if (bundleFile != null)
            {
                _includedVirtualPath = bundleFile.IncludedVirtualPath;
                _transforms          = bundleFile.Transforms;
            }
            else
            {
                _includedVirtualPath = string.Empty;
                _transforms          = new List <IItemTransform>();
            }
            _assetTypeCode = Constants.AssetTypeCode.Unknown;
            _isStylesheet  = false;
            _isScript      = false;
            _content       = null;

            VirtualPath             = virtualPath;
            VirtualPathDependencies = new List <string>();
            OriginalAssets          = new List <IAsset>();
            Combined = false;
            Minified = false;
            RelativePathsResolved = false;
        }
Exemple #2
0
        /// <summary>Gets a file extension mappings</summary>
        /// <returns></returns>
        private FileExtensionMappingCollection GetFileExtensionMappings()
        {
            FileExtensionMappingCollection mappingCollection = new FileExtensionMappingCollection();

            foreach (FileExtensionRegistration fileExtension in (ConfigurationElementCollection)this._assetConfig.FileExtensions)
            {
                mappingCollection.Add(fileExtension.FileExtension, fileExtension.AssetTypeCode);
            }
            return(mappingCollection);
        }
Exemple #3
0
 /// <summary>Constructs a instance of script context</summary>
 /// <param name="assetConfig">Configuration settings of processing assets</param>
 protected AssetContextBase(AssetSettingsBase assetConfig)
 {
     this._assetConfig                    = assetConfig;
     this._translatorsPool                = new Dictionary <string, ITranslator>();
     this._translatorsPoolSynchronizer    = new object();
     this._postProcessorsPool             = new Dictionary <string, IPostProcessor>();
     this._postProcessorsPoolSynchronizer = new object();
     this._minifiersPool                  = new Dictionary <string, IMinifier>();
     this._minifiersPoolSynchronizer      = new object();
     this._fileExtensionMappings          = this.GetFileExtensionMappings();
 }
        /// <summary>
        /// Gets a file extension mappings
        /// </summary>
        /// <returns></returns>
        private FileExtensionMappingCollection GetFileExtensionMappings()
        {
            var fileExtensionMappings = new FileExtensionMappingCollection();
            FileExtensionRegistrationCollection fileExtensionRegistrations = _assetConfig.FileExtensions;

            foreach (FileExtensionRegistration fileExtensionRegistration in fileExtensionRegistrations)
            {
                fileExtensionMappings.Add(
                    fileExtensionRegistration.FileExtension,
                    fileExtensionRegistration.AssetTypeCode);
            }

            return(fileExtensionMappings);
        }