示例#1
0
 public TransmitEntityStrategyForFile(IRetryableFileOpener retryableFileOpener, IEntity entity, FileInfo file, int bufferSize)
 {
     this.RetryableFileOpener = retryableFileOpener;
     Entity          = entity;
     this.File       = file;
     this.BufferSize = bufferSize;
 }
示例#2
0
 public CssCrusher(IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter, ICssPathRewriter cssPathRewriter, IPathProvider pathProvider)
 {
     RetryableFileOpener = retryableFileOpener;
     RetryableFileWriter = retryableFileWriter;
     CssPathRewriter = cssPathRewriter;
     PathProvider = pathProvider;
 }
        public RetryableFileWriter(int bufferSize, Encoding encoding, IRetryableFileOpener retryableFileOpener, IHasher hasher)
        {
            BufferSize = bufferSize;
			Encoding = encoding;
            RetryableFileOpener = retryableFileOpener;
            Hasher = hasher;
        }
示例#4
0
 public CssSpriteCreator(ICacheManager cacheManager, IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, IRetryableFileWriter retryableFileWriter)
 {
     CacheManager        = cacheManager;
     RetryableFileOpener = retryableFileOpener;
     PathProvider        = pathProvider;
     RetryableFileWriter = retryableFileWriter;
 }
示例#5
0
 public RetryableFileWriter(int bufferSize, Encoding encoding, IRetryableFileOpener retryableFileOpener, IHasher hasher)
 {
     BufferSize          = bufferSize;
     Encoding            = encoding;
     RetryableFileOpener = retryableFileOpener;
     Hasher = hasher;
 }
 public TransmitEntityStrategyForFile(IRetryableFileOpener retryableFileOpener, IEntity entity, FileInfo file, int bufferSize)
 {
     this.RetryableFileOpener = retryableFileOpener;
     Entity = entity;
     this.File = file;
     this.BufferSize = bufferSize;
 }
 public RetryableFileWriter(int bufferSize, IRetryableFileOpener retryableFileOpener, IHasher hasher)
 {
     BufferSize = bufferSize;
     RetryableFileOpener = retryableFileOpener;
     Hasher = hasher;
     _encoding = Encoding.UTF8;
 }
示例#8
0
 public CssControl()
 {
     QuerystringKeyName = CurrentCrusherConfiguration.Current.QuerystringKeyName;
     CssGroups = CurrentCrusherConfiguration.Current.CssGroups;
     RetryableFileOpener = new RetryableFileOpener();
     Hasher = new Hasher(RetryableFileOpener);
 }
示例#9
0
 public CssSpriteCreator(ICacheManager cacheManager, IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, IRetryableFileWriter retryableFileWriter)
 {
     CacheManager = cacheManager;
     RetryableFileOpener = retryableFileOpener;
     PathProvider = pathProvider;
     RetryableFileWriter = retryableFileWriter;
 }
示例#10
0
 public RetryableFileWriter(int bufferSize, IRetryableFileOpener retryableFileOpener, IHasher hasher)
 {
     BufferSize          = bufferSize;
     RetryableFileOpener = retryableFileOpener;
     Hasher    = hasher;
     _encoding = Encoding.UTF8;
 }
示例#11
0
 public CssSpriteCreator(ICacheManager cacheManager, IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, IRetryableFileWriter retryableFileWriter, IMetaData fileMetaData)
 {
     CacheManager        = cacheManager;
     RetryableFileOpener = retryableFileOpener;
     PathProvider        = pathProvider;
     RetryableFileWriter = retryableFileWriter;
     FileMetaData        = fileMetaData;
 }
示例#12
0
 public JsFileProcessor(IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, JsFile jsFile)
 {
     RetryableFileOpener = retryableFileOpener;
     PathProvider = pathProvider;
     CompressionType = jsFile.CompressionType;
     var filePath = PathProvider.MapPath(jsFile.FilePath);
     FileInfo = new FileInfo(filePath);
 }
示例#13
0
 public CssSpriteCreator(ICacheManager cacheManager, IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, IRetryableFileWriter retryableFileWriter, IMetaData fileMetaData)
 {
     CacheManager = cacheManager;
     RetryableFileOpener = retryableFileOpener;
     PathProvider = pathProvider;
     RetryableFileWriter = retryableFileWriter;
     FileMetaData = fileMetaData;
 }
 private StaticFileManager()
 {
     _retryableFileOpener = new RetryableFileOpener();
     _mimeTyper = new MimeTyper();
     _hasher = new Hasher(_retryableFileOpener);
     _httpRequestHeaderHelper = new HttpRequestHeaderHelper();
     _fileEntitySettingProvider = new FileEntitySettingProvider();
 }
示例#15
0
 public JsFileProcessor(IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, string filePath, JsCompressionType compressionType)
 {
     _retryableFileOpener = retryableFileOpener;
     _pathProvider        = pathProvider;
     CompressionType      = compressionType;
     _fileInfo            = new FileInfo(new Uri(_pathProvider.MapPath(filePath)).LocalPath);
     _modules             = new List <IJsModule>();
 }
示例#16
0
 public JsFileProcessor(IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, string filePath, JsCompressionType compressionType)
 {
     _retryableFileOpener = retryableFileOpener;
     _pathProvider = pathProvider;
     CompressionType = compressionType;
     _fileInfo = new FileInfo(new Uri(_pathProvider.MapPath(filePath)).LocalPath);
     _modules = new List<IJsModule>();
 }
示例#17
0
 private CrusherHelper()
 {
     CacheManager = new HttpCacheManager();
     QuerystringKeyName = CurrentCrusherConfiguration.Current.QuerystringKeyName;
     CssGroups = CurrentCrusherConfiguration.Current.CssGroups;
     JsGroups = CurrentCrusherConfiguration.Current.JsGroups;
     RetryableFileOpener = new RetryableFileOpener();
     Hasher = new Hasher(RetryableFileOpener);
 }
示例#18
0
 private StaticFileManager()
 {
     _cacheManager        = new HttpCacheManager();
     _retryableFileOpener = new RetryableFileOpener();
     _mimeTyper           = new MimeTyper(_cacheManager);
     _hasher = new Hasher(_retryableFileOpener);
     _httpRequestHeaderHelper = new HttpRequestHeaderHelper();
     _mimeSettingProvider     = new MimeSettingProvider();
 }
示例#19
0
 public JsCrusher(ICacheManager cacheManager, IPathProvider pathProvider, IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter)
 {
     CacheManager        = cacheManager;
     PathProvider        = pathProvider;
     RetryableFileOpener = retryableFileOpener;
     RetryableFileWriter = retryableFileWriter;
     YahooYuiJavaScriptCompressorPool         = new Pool <JavaScriptCompressor>(64, pool => new JavaScriptCompressor(), LoadingMode.LazyExpanding, AccessMode.Circular);
     MicrosoftAjaxMinJavaScriptCompressorPool = new Pool <Minifier>(64, pool => new Minifier(), LoadingMode.LazyExpanding, AccessMode.Circular);
 }
示例#20
0
 public JsCrusher(ICacheManager cacheManager, IPathProvider pathProvider, IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter)
 {
     CacheManager = cacheManager;
     PathProvider = pathProvider;
     RetryableFileOpener = retryableFileOpener;
     RetryableFileWriter = retryableFileWriter;
     YahooYuiJavaScriptCompressor = new Lazy<Yahoo.Yui.Compressor.JavaScriptCompressor>();
     MicrosoftAjaxMinJavaScriptCompressor = new Lazy<Microsoft.Ajax.Utilities.Minifier>();
 }
示例#21
0
 private CrusherHelper()
 {
     CacheManager        = new HttpCacheManager();
     QuerystringKeyName  = CurrentCrusherConfiguration.Current.QuerystringKeyName;
     CssGroups           = CurrentCrusherConfiguration.Current.CssGroups;
     JsGroups            = CurrentCrusherConfiguration.Current.JsGroups;
     RetryableFileOpener = new RetryableFileOpener();
     Hasher = new Hasher(RetryableFileOpener);
 }
示例#22
0
 public JsCrusher(ICacheManager cacheManager, IPathProvider pathProvider, IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter)
 {
     CacheManager                         = cacheManager;
     PathProvider                         = pathProvider;
     RetryableFileOpener                  = retryableFileOpener;
     RetryableFileWriter                  = retryableFileWriter;
     YahooYuiJavaScriptCompressor         = new Lazy <Yahoo.Yui.Compressor.JavaScriptCompressor>();
     MicrosoftAjaxMinJavaScriptCompressor = new Lazy <Microsoft.Ajax.Utilities.Minifier>();
 }
示例#23
0
        public JsFileProcessor(IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, JsFile jsFile)
        {
            RetryableFileOpener = retryableFileOpener;
            PathProvider        = pathProvider;
            CompressionType     = jsFile.CompressionType;
            var filePath = PathProvider.MapPath(jsFile.FilePath);

            FileInfo = new FileInfo(filePath);
        }
示例#24
0
 private StaticFileManager()
 {
     _cacheManager = new HttpCacheManager();
     _retryableFileOpener = new RetryableFileOpener();
     _mimeTyper = new MimeTyper(_cacheManager);
     _hasher = new Md5Hasher(_retryableFileOpener);
     _embeddedResourceLoader = new EmbeddedResourceLoader();
     _httpRequestHeaderHelper = new HttpRequestHeaderHelper();
     _mimeSettingProvider = new MimeSettingProvider();
 }
示例#25
0
 public FileEntity(IRetryableFileOpener retryableFileOpener, IMimeTyper mimeTyper, IHasher hasher, long maxFileSizeToServe, int bufferSize, FileInfo fileInfo, FileEntitySetting fileEntitySetting)
 {
     RetryableFileOpener = retryableFileOpener;
     MimeTyper = mimeTyper;
     Hasher = hasher;
     BufferSize = bufferSize;
     MaxFileSizeToServe = maxFileSizeToServe;
     FileInfo = fileInfo;
     FileEntitySetting = fileEntitySetting;
 }
示例#26
0
 public CssCrusher(ICacheManager cacheManager, IPathProvider pathProvider, IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter, ICssPathRewriter cssPathRewriter)
 {
     CacheManager = cacheManager;
     PathProvider = pathProvider;
     RetryableFileOpener = retryableFileOpener;
     RetryableFileWriter = retryableFileWriter;
     CssPathRewriter = cssPathRewriter;
     YahooYuiCssCompressor = new Lazy<Yahoo.Yui.Compressor.CssCompressor>();
     MicrosoftAjaxMinCssCompressor = new Lazy<Microsoft.Ajax.Utilities.Minifier>();
 }
示例#27
0
 public CssCrusher(ICacheManager cacheManager, IPathProvider pathProvider, IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter, ICssPathRewriter cssPathRewriter)
 {
     CacheManager                  = cacheManager;
     PathProvider                  = pathProvider;
     RetryableFileOpener           = retryableFileOpener;
     RetryableFileWriter           = retryableFileWriter;
     CssPathRewriter               = cssPathRewriter;
     YahooYuiCssCompressor         = new Lazy <Yahoo.Yui.Compressor.CssCompressor>();
     MicrosoftAjaxMinCssCompressor = new Lazy <Microsoft.Ajax.Utilities.Minifier>();
 }
示例#28
0
 public CssCrusher(ICacheManager cacheManager, IPathProvider pathProvider, IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter, ICssPathRewriter cssPathRewriter)
 {
     CacheManager                      = cacheManager;
     PathProvider                      = pathProvider;
     RetryableFileOpener               = retryableFileOpener;
     RetryableFileWriter               = retryableFileWriter;
     CssPathRewriter                   = cssPathRewriter;
     YahooYuiCssCompressorPool         = new Pool <Yahoo.Yui.Compressor.CssCompressor>(64, pool => new Yahoo.Yui.Compressor.CssCompressor(), LoadingMode.LazyExpanding, AccessMode.Circular);
     MicrosoftAjaxMinCssCompressorPool = new Pool <Microsoft.Ajax.Utilities.Minifier>(64, pool => new Microsoft.Ajax.Utilities.Minifier(), LoadingMode.LazyExpanding, AccessMode.Circular);
 }
示例#29
0
 public JsCrusher(ICacheManager cacheManager, IPathProvider pathProvider, IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter, IMetaData fileMetaData)
 {
     CacheManager = cacheManager;
     PathProvider = pathProvider;
     RetryableFileOpener = retryableFileOpener;
     RetryableFileWriter = retryableFileWriter;
     FileMetaData = fileMetaData;
     YahooYuiJavaScriptCompressorPool = new Pool<JavaScriptCompressor>(64, pool => new JavaScriptCompressor(), LoadingMode.LazyExpanding, AccessMode.Circular);
     MicrosoftAjaxMinJavaScriptCompressorPool = new Pool<Minifier>(64, pool => new Minifier(), LoadingMode.LazyExpanding, AccessMode.Circular);
 }
示例#30
0
 public FileEntity(ICacheManager cacheManager, IRetryableFileOpener retryableFileOpener, IMimeTyper mimeTyper, IHasher hasher, long maxFileSizeToServe, int bufferSize, FileInfo fileInfo, FileEntitySetting fileEntitySetting)
 {
     CacheManager        = cacheManager;
     RetryableFileOpener = retryableFileOpener;
     MimeTyper           = mimeTyper;
     Hasher             = hasher;
     BufferSize         = bufferSize;
     MaxFileSizeToServe = maxFileSizeToServe;
     FileInfo           = fileInfo;
     FileEntitySetting  = fileEntitySetting;
 }
 public FileEntityResponder(ICacheManager cacheManager, IRetryableFileOpener retryableFileOpener, IMimeTyper mimeTyper, IHasher hasher, long maxFileSizeToServe, int bufferSize, MimeSettingProvider mimeSettingProvider, FileInfo fileInfo)
 {
     CacheManager = cacheManager;
     RetryableFileOpener = retryableFileOpener;
     MimeTyper = mimeTyper;
     Hasher = hasher;
     BufferSize = bufferSize;
     MaxFileSizeToServe = maxFileSizeToServe;
     FileInfo = fileInfo;
     MimeSetting = mimeSettingProvider.GetSetting(fileInfo);
 }
示例#32
0
 public FileEntityResponder(ICacheManager cacheManager, IRetryableFileOpener retryableFileOpener, IMimeTyper mimeTyper, IHasher hasher, long maxFileSizeToServe, int bufferSize, MimeSettingProvider mimeSettingProvider, FileInfo fileInfo)
 {
     CacheManager        = cacheManager;
     RetryableFileOpener = retryableFileOpener;
     MimeTyper           = mimeTyper;
     Hasher             = hasher;
     BufferSize         = bufferSize;
     MaxFileSizeToServe = maxFileSizeToServe;
     FileInfo           = fileInfo;
     MimeSetting        = mimeSettingProvider.GetSetting(fileInfo);
 }
示例#33
0
 /// <summary>
 /// Transmit stream to browser.
 /// </summary>
 /// <param name="retryableFileOpener"></param>
 /// <param name="response">The <see cref="HttpResponse" /> of the current HTTP request.</param>
 /// <param name="file"></param>
 /// <param name="bufferSize">The buffer size to use when transmitting file to browser.</param>
 public virtual void TransmitFile(IRetryableFileOpener retryableFileOpener, HttpResponseBase response, FileInfo file, int bufferSize)
 {
     using (var stream = retryableFileOpener.OpenFileStream(file, 5, FileMode.Open, FileAccess.Read, FileShare.Read))
     {
         var buffer    = new byte[bufferSize];
         var readCount = 0;
         while ((readCount = stream.Read(buffer, 0, bufferSize)) > 0)
         {
             response.OutputStream.Write(buffer, 0, readCount);
         }
     }
 }
 /// <summary>
 /// Transmit stream to browser.
 /// </summary>
 /// <param name="retryableFileOpener"></param>
 /// <param name="response">The <see cref="HttpResponse" /> of the current HTTP request.</param>
 /// <param name="file"></param>
 /// <param name="bufferSize">The buffer size to use when transmitting file to browser.</param>
 public virtual void TransmitFile(IRetryableFileOpener retryableFileOpener, HttpResponseBase response, FileInfo file, int bufferSize)
 {
     using (var stream = retryableFileOpener.OpenFileStream(file, 5, FileMode.Open, FileAccess.Read, FileShare.Read))
     {
         var buffer = new byte[bufferSize];
         var readCount = 0;
         while ((readCount = stream.Read(buffer, 0, bufferSize)) > 0)
         {
             response.OutputStream.Write(buffer, 0, readCount);
         }
     }
 }
示例#35
0
 public CssCrusher(ICacheManager cacheManager, IPathProvider pathProvider, IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter, ICssPathRewriter cssPathRewriter, IMetaData fileMetaData, bool watchAssets)
 {
     CacheManager = cacheManager;
     PathProvider = pathProvider;
     RetryableFileOpener = retryableFileOpener;
     RetryableFileWriter = retryableFileWriter;
     CssPathRewriter = cssPathRewriter;
     FileMetaData = fileMetaData;
     WatchAssets = watchAssets;
     YahooYuiCssCompressorPool = new Pool<Yahoo.Yui.Compressor.CssCompressor>(64, pool => new Yahoo.Yui.Compressor.CssCompressor(), LoadingMode.LazyExpanding, AccessMode.Circular);
     MicrosoftAjaxMinCssCompressorPool = new Pool<Microsoft.Ajax.Utilities.Minifier>(64, pool => new Microsoft.Ajax.Utilities.Minifier(), LoadingMode.LazyExpanding, AccessMode.Circular);
 }
示例#36
0
        public CrusherMsBuildCommand(string applicationPath, string binDirectoryPath, string configPath, Action <string> logMessage, Action <string> logError)
        {
            if (string.IsNullOrEmpty(applicationPath))
            {
                throw new ArgumentNullException("applicationPath");
            }

            if (string.IsNullOrEmpty(binDirectoryPath))
            {
                throw new ArgumentNullException("binDirectoryPath");
            }

            if (string.IsNullOrEmpty(configPath))
            {
                throw new ArgumentNullException("configPath");
            }

            if (logMessage == null)
            {
                throw new ArgumentNullException("logMessage");
            }

            if (logError == null)
            {
                throw new ArgumentNullException("logError");
            }

            _applicationPath  = applicationPath;
            _binDirectoryPath = binDirectoryPath;
            _configPath       = configPath;
            _logMessage       = logMessage;
            _logError         = logError;

            _retryableFileOpener = new RetryableFileOpener();
            _hasher = new Hasher(_retryableFileOpener);
            _retryableFileWriter = new RetryableFileWriter(BufferSize, Encoding, _retryableFileOpener, _hasher);
            _fileMetaData        = new MultiFileMetaData(_retryableFileOpener, _retryableFileWriter);

            _cssSpriteConfiguration = GetCssSpriteSection(_configPath, CssSpriteSectionName);
            _crusherConfiguration   = GetCrusherSection(_configPath, CrusherSectionName);

            var configUri = new Uri(_configPath, UriKind.RelativeOrAbsolute);

            if (!configUri.IsAbsoluteUri)
            {
                configUri = new Uri(Path.Combine(Environment.CurrentDirectory, configUri.ToString()));
            }

            var physicalApplicationPath = new FileInfo(configUri.LocalPath).DirectoryName;

            _pathProvider = new PathProvider(_applicationPath, physicalApplicationPath);
            _cacheManager = new HttpCacheManager();
        }
        public CrusherMsBuildCommand(string applicationPath, string binDirectoryPath, string configPath, Action<string> logMessage, Action<string> logError)
        {
            if (string.IsNullOrEmpty(applicationPath))
            {
                throw new ArgumentNullException("applicationPath");
            }

            if (string.IsNullOrEmpty(binDirectoryPath))
            {
                throw new ArgumentNullException("binDirectoryPath");
            }

            if (string.IsNullOrEmpty(configPath))
            {
                throw new ArgumentNullException("configPath");
            }

            if (logMessage == null)
            {
                throw new ArgumentNullException("logMessage");
            }

            if (logError == null)
            {
                throw new ArgumentNullException("logError");
            }

            _applicationPath = applicationPath;
            _binDirectoryPath = binDirectoryPath;
            _configPath = configPath;
            _logMessage = logMessage;
            _logError = logError;

            _retryableFileOpener = new RetryableFileOpener();
            _hasher = new Hasher(_retryableFileOpener);
            _retryableFileWriter = new RetryableFileWriter(BufferSize, Encoding, _retryableFileOpener, _hasher);
            _fileMetaData = new MultiFileMetaData(_retryableFileOpener, _retryableFileWriter);

            _cssSpriteConfiguration = GetCssSpriteSection(_configPath, CssSpriteSectionName);
            _crusherConfiguration = GetCrusherSection(_configPath, CrusherSectionName);

            var configUri = new Uri(_configPath, UriKind.RelativeOrAbsolute);
            if (!configUri.IsAbsoluteUri)
            {
                configUri = new Uri(Path.Combine(Environment.CurrentDirectory, configUri.ToString()));
            }

            var physicalApplicationPath = new FileInfo(configUri.LocalPath).DirectoryName;
            _pathProvider = new PathProvider(_applicationPath, physicalApplicationPath);
            _cacheManager = new HttpCacheManager();
        }
示例#38
0
 public JsCrusher(ICacheManager cacheManager, IPathProvider pathProvider, IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter, IMetaData fileMetaData)
 {
     CacheManager        = cacheManager;
     PathProvider        = pathProvider;
     RetryableFileOpener = retryableFileOpener;
     RetryableFileWriter = retryableFileWriter;
     FileMetaData        = fileMetaData;
     YahooYuiJavaScriptCompressorPool         = new Pool <Yahoo.Yui.Compressor.JavaScriptCompressor>(4, pool => new Yahoo.Yui.Compressor.JavaScriptCompressor(), LoadingMode.LazyExpanding, AccessMode.Circular);
     MicrosoftAjaxMinJavaScriptCompressorPool = new Pool <Microsoft.Ajax.Utilities.Minifier>(44, pool => new Microsoft.Ajax.Utilities.Minifier(), LoadingMode.LazyExpanding, AccessMode.Circular);
     CoffeeCompilerPool     = new Pool <Coffee.CoffeeCompiler>(4, pool => new Coffee.CoffeeCompiler(new EmbeddedResourceLoader()), LoadingMode.LazyExpanding, AccessMode.Circular);
     IcedCoffeeCompilerPool = new Pool <IcedCoffee.IcedCoffeeCompiler>(4, pool => new IcedCoffee.IcedCoffeeCompiler(new EmbeddedResourceLoader()), LoadingMode.LazyExpanding, AccessMode.Circular);
     LiveScriptCompilerPool = new Pool <LiveScript.LiveScriptCompiler>(4, pool => new LiveScript.LiveScriptCompiler(new EmbeddedResourceLoader()), LoadingMode.LazyExpanding, AccessMode.Circular);
     HoganCompilerPool      = new Pool <Hogan.HoganCompiler>(4, pool => new Hogan.HoganCompiler(new EmbeddedResourceLoader()), LoadingMode.LazyExpanding, AccessMode.Circular);
 }
示例#39
0
        public CssFileProcessor(IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, ICssPathRewriter cssPathRewriter, CssFile cssFile, Uri cssRootUri, bool appendHashToAssets)
        {
            RetryableFileOpener = retryableFileOpener;
            PathProvider = pathProvider;
            CssPathRewriter = cssPathRewriter;
            CompressionType = cssFile.CompressionType;

            var filePath = PathProvider.MapPath(cssFile.FilePath);
            FileInfo = new FileInfo(filePath);
            CssRootUri = cssRootUri;
            RelativeRootUri = GetRelativeRootUri(cssFile.FilePath);

            AppendHashToAssets = appendHashToAssets;
        }
示例#40
0
        private CrusherManager()
        {
            _crusherConfiguration = CurrentCrusherConfiguration.Current;

            _retryableFileOpener = new RetryableFileOpener();
            _hasher = new Md5Hasher(_retryableFileOpener);
			_retryableFileWriter = new RetryableFileWriter(BufferSize, _encoding, _retryableFileOpener, _hasher);
            _pathProvider = new PathProvider();

            _cacheManager = new HttpCacheManager();
            _fileMetaData = new MultiFileMetaData(_retryableFileOpener, _retryableFileWriter);
 
            InitManager();
        }
示例#41
0
        private CrusherManager()
        {
            _crusherConfiguration = CurrentCrusherConfiguration.Current;

            _retryableFileOpener = new RetryableFileOpener();
            _hasher = new Md5Hasher(_retryableFileOpener);
            _retryableFileWriter = new RetryableFileWriter(BufferSize, _encoding, _retryableFileOpener, _hasher);
            _pathProvider        = new PathProvider();

            _cacheManager = new HttpCacheManager();
            _fileMetaData = new MultiFileMetaData(_retryableFileOpener, _retryableFileWriter);

            InitManager();
        }
示例#42
0
 public JsCrusher(ICacheManager cacheManager, IPathProvider pathProvider, IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter, IMetaData fileMetaData)
 {
     CacheManager = cacheManager;
     PathProvider = pathProvider;
     RetryableFileOpener = retryableFileOpener;
     RetryableFileWriter = retryableFileWriter;
     FileMetaData = fileMetaData;
     YahooYuiJavaScriptCompressorPool = new Pool<Yahoo.Yui.Compressor.JavaScriptCompressor>(4, pool => new Yahoo.Yui.Compressor.JavaScriptCompressor(), LoadingMode.LazyExpanding, AccessMode.Circular);
     MicrosoftAjaxMinJavaScriptCompressorPool = new Pool<Microsoft.Ajax.Utilities.Minifier>(44, pool => new Microsoft.Ajax.Utilities.Minifier(), LoadingMode.LazyExpanding, AccessMode.Circular);
     CoffeeCompilerPool = new Pool<Coffee.CoffeeCompiler>(4, pool => new Coffee.CoffeeCompiler(new EmbeddedResourceLoader()), LoadingMode.LazyExpanding, AccessMode.Circular);
     IcedCoffeeCompilerPool = new Pool<IcedCoffee.IcedCoffeeCompiler>(4, pool => new IcedCoffee.IcedCoffeeCompiler(new EmbeddedResourceLoader()), LoadingMode.LazyExpanding, AccessMode.Circular);
     LiveScriptCompilerPool = new Pool<LiveScript.LiveScriptCompiler>(4, pool => new LiveScript.LiveScriptCompiler(new EmbeddedResourceLoader()), LoadingMode.LazyExpanding, AccessMode.Circular);
     HoganCompilerPool = new Pool<Hogan.HoganCompiler>(4, pool => new Hogan.HoganCompiler(new EmbeddedResourceLoader()), LoadingMode.LazyExpanding, AccessMode.Circular);
 }
示例#43
0
        public CssFileProcessor(IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, ICssPathRewriter cssPathRewriter, CssFile cssFile, Uri cssRootUri, bool appendHashToAssets)
        {
            RetryableFileOpener = retryableFileOpener;
            PathProvider        = pathProvider;
            CssPathRewriter     = cssPathRewriter;
            CompressionType     = cssFile.CompressionType;

            var filePath = PathProvider.MapPath(cssFile.FilePath);

            FileInfo        = new FileInfo(filePath);
            CssRootUri      = cssRootUri;
            RelativeRootUri = GetRelativeRootUri(cssFile.FilePath);

            AppendHashToAssets = appendHashToAssets;
        }
示例#44
0
 public JsFileProcessor(Pool<Coffee.CoffeeCompiler> coffeeCompilerPool, Pool<IcedCoffee.IcedCoffeeCompiler> icedCoffeeCompilerPool, Pool<LiveScript.LiveScriptCompiler> liveScriptCompilerPool, Pool<Hogan.HoganCompiler> hoganCompilerPool, IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, string filePath, JsCompressionType compressionType, Uri jsRootUri)
 {
     _retryableFileOpener = retryableFileOpener;
     _pathProvider = pathProvider;
     _jsRootUri = jsRootUri;
     CompressionType = compressionType;
     _fileInfo = new FileInfo(new Uri(_pathProvider.MapPath(filePath)).LocalPath);
     _modules = new List<IJsModule>()
     {
         new CoffeeModule(coffeeCompilerPool),
         new IcedCoffeeModule(icedCoffeeCompilerPool),
         new LiveScriptModule(liveScriptCompilerPool),
         new HoganModule(pathProvider, hoganCompilerPool),
         new AnonymousAmdModule(new AmdModule(_retryableFileOpener))
     };
 }
示例#45
0
 public JsFileProcessor(Pool <Coffee.CoffeeCompiler> coffeeCompilerPool, Pool <IcedCoffee.IcedCoffeeCompiler> icedCoffeeCompilerPool, Pool <LiveScript.LiveScriptCompiler> liveScriptCompilerPool, Pool <Hogan.HoganCompiler> hoganCompilerPool, IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, string filePath, JsCompressionType compressionType, Uri jsRootUri)
 {
     _retryableFileOpener = retryableFileOpener;
     _pathProvider        = pathProvider;
     _jsRootUri           = jsRootUri;
     CompressionType      = compressionType;
     _fileInfo            = new FileInfo(new Uri(_pathProvider.MapPath(filePath)).LocalPath);
     _modules             = new List <IJsModule>()
     {
         new CoffeeModule(coffeeCompilerPool),
         new IcedCoffeeModule(icedCoffeeCompilerPool),
         new LiveScriptModule(liveScriptCompilerPool),
         new HoganModule(pathProvider, hoganCompilerPool),
         new AnonymousAmdModule(new AmdModule(_retryableFileOpener))
     };
 }
示例#46
0
        public CssFileProcessor(IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, ICssPathRewriter cssPathRewriter, string filePath, CssCompressionType compressionType, Uri cssRootUri, bool appendHashToAssets)
        {
            _retryableFileOpener = retryableFileOpener;
            _pathProvider        = pathProvider;
            _cssPathRewriter     = cssPathRewriter;
            CompressionType      = compressionType;

            _fileInfo   = new FileInfo(new Uri(_pathProvider.MapPath(filePath)).LocalPath);
            _cssRootUri = cssRootUri;
            var absoluteUriDirectory = _pathProvider.GetAbsoluteUriDirectory(filePath);

            _modules = new List <ICssModule>()
            {
                new DotLessModule(),
                new RelativePathModule(absoluteUriDirectory, cssPathRewriter),
                new CssAssetsHashModule(appendHashToAssets, cssPathRewriter, pathProvider)
            };
        }
示例#47
0
        public CssFileProcessor(IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, ICssPathRewriter cssPathRewriter, string filePath, CssCompressionType compressionType, Uri cssRootUri, bool appendHashToAssets)
        {
            _retryableFileOpener = retryableFileOpener;
            _pathProvider = pathProvider;
            _cssPathRewriter = cssPathRewriter;
            CompressionType = compressionType;

            _fileInfo = new FileInfo(new Uri(_pathProvider.MapPath(filePath)).LocalPath);
            _cssRootUri = cssRootUri;
            var absoluteUriDirectory = _pathProvider.GetAbsoluteUriDirectory(filePath);

            _modules = new List<ICssModule>()
            {
                new DotLessModule(),
                new RelativePathModule(absoluteUriDirectory, cssPathRewriter),
                new CssAssetsHashModule(appendHashToAssets, cssPathRewriter, pathProvider)
            };
        }
        /// <summary>
        /// Transmit stream range to browser.
        /// </summary>
        /// <param name="retryableFileOpener"></param>
        /// <param name="response">The <see cref="HttpResponse" /> of the current HTTP request.</param>
        /// <param name="file"></param>
        /// <param name="bufferSize">The buffer size to use when transmitting file to browser.</param>
        /// <param name="offset">Start range</param>
        /// <param name="length">End range</param>
        public virtual void TransmitFile(IRetryableFileOpener retryableFileOpener, HttpResponseBase response, FileInfo file, long bufferSize, long offset, long length)
        {
            using (var stream = retryableFileOpener.OpenFileStream(file, 5, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                stream.Seek(offset, SeekOrigin.Begin);

                var buffer = new byte[bufferSize];
                while (length > 0)
                {
                    var lengthOfReadChunk = stream.Read(buffer, 0, (int)Math.Min(bufferSize, length));

                    // Write the data to the current output stream.
                    response.OutputStream.Write(buffer, 0, lengthOfReadChunk);

                    // Reduce BytesToRead
                    length -= lengthOfReadChunk;
                }
            }
        }
示例#49
0
        /// <summary>
        /// Transmit stream range to browser.
        /// </summary>
        /// <param name="retryableFileOpener"></param>
        /// <param name="response">The <see cref="HttpResponse" /> of the current HTTP request.</param>
        /// <param name="file"></param>
        /// <param name="bufferSize">The buffer size to use when transmitting file to browser.</param>
        /// <param name="offset">Start range</param>
        /// <param name="length">End range</param>
        public virtual void TransmitFile(IRetryableFileOpener retryableFileOpener, HttpResponseBase response, FileInfo file, long bufferSize, long offset, long length)
        {
            using (var stream = retryableFileOpener.OpenFileStream(file, 5, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                stream.Seek(offset, SeekOrigin.Begin);

                var buffer = new byte[bufferSize];
                while (length > 0)
                {
                    var lengthOfReadChunk = stream.Read(buffer, 0, (int)Math.Min(bufferSize, length));

                    // Write the data to the current output stream.
                    response.OutputStream.Write(buffer, 0, lengthOfReadChunk);

                    // Reduce BytesToRead
                    length -= lengthOfReadChunk;
                }
            }
        }
示例#50
0
        public SingleFileMetaData(FileInfo metaDataFile, IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter)
        {
            _timer           = new System.Timers.Timer();
            _timer.Elapsed  += OnTimerElapsed;
            _timer.Interval  = PollTime;
            _timer.Enabled   = false;
            _timer.AutoReset = false;

            _metaDataFile        = metaDataFile;
            _retryableFileWriter = retryableFileWriter;

            if (metaDataFile.Exists)
            {
                _metaDataForFiles = retryableFileOpener.ReadAllText(_metaDataFile)
                                    .Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
                                    .ToDictionary(k => k.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries)[0], v => v.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries)[1]);
            }
            else
            {
                _metaDataForFiles = new Dictionary <string, string>();
            }
        }
示例#51
0
        public SingleFileMetaData(FileInfo metaDataFile, IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter)
        {
            _timer = new System.Timers.Timer();
            _timer.Elapsed += OnTimerElapsed;
            _timer.Interval = PollTime;
            _timer.Enabled = false;
            _timer.AutoReset = false;

            _metaDataFile = metaDataFile;
            _retryableFileWriter = retryableFileWriter;

            if (metaDataFile.Exists)
            {

                _metaDataForFiles = retryableFileOpener.ReadAllText(_metaDataFile)
                    .Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
                    .ToDictionary(k => k.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries)[0], v => v.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries)[1]);
            }
            else
            {
                _metaDataForFiles = new Dictionary<string, string>();
            }
        }
示例#52
0
 public Hasher(IRetryableFileOpener retryableFileOpener)
 {
     RetryableFileOpener = retryableFileOpener;
 }
示例#53
0
 public Md5Hasher(IRetryableFileOpener retryableFileOpener)
 {
     this.RetryableFileOpener = retryableFileOpener;
 }
示例#54
0
 public FileReader(IRetryableFileOpener retryableFileOpener, int numberOfRetries, string file)
 {
     streamReader = retryableFileOpener.OpenTextStreamReader(file, numberOfRetries);
 }
示例#55
0
 public Configuration RetryableFileOpener(IRetryableFileOpener retryableFileOpener)
 {
     _defaultRetryableFileOpener = retryableFileOpener;
     return(this);
 }
示例#56
0
 public Hasher(IRetryableFileOpener retryableFileOpener)
 {
     this.RetryableFileOpener = retryableFileOpener;
 }
示例#57
0
 public FileReaderFactory(IRetryableFileOpener retryableFileOpener, int numberOfRetries)
 {
     RetryableFileOpener = retryableFileOpener;
     NumberOfRetries     = numberOfRetries;
 }
示例#58
0
 public JsCrusher(IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter, IPathProvider pathProvider)
 {
     RetryableFileOpener = retryableFileOpener;
     RetryableFileWriter = retryableFileWriter;
     PathProvider = pathProvider;
 }
示例#59
0
 public FileWriter(IRetryableFileOpener retryableFileOpener, int numberOfRetries, string file)
 {
     streamWriter = retryableFileOpener.OpenTextStreamWriter(file, numberOfRetries, false);
 }
示例#60
0
 public MultiFileMetaData(IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter)
 {
     _retryableFileOpener = retryableFileOpener;
     _retryableFileWriter = retryableFileWriter;
 }