public TransmitEntityStrategyForFile(IRetryableFileOpener retryableFileOpener, IEntity entity, FileInfo file, int bufferSize) { this.RetryableFileOpener = retryableFileOpener; Entity = entity; this.File = file; this.BufferSize = bufferSize; }
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; }
public CssSpriteCreator(ICacheManager cacheManager, IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, IRetryableFileWriter retryableFileWriter) { CacheManager = cacheManager; RetryableFileOpener = retryableFileOpener; PathProvider = pathProvider; RetryableFileWriter = retryableFileWriter; }
public RetryableFileWriter(int bufferSize, IRetryableFileOpener retryableFileOpener, IHasher hasher) { BufferSize = bufferSize; RetryableFileOpener = retryableFileOpener; Hasher = hasher; _encoding = Encoding.UTF8; }
public CssControl() { QuerystringKeyName = CurrentCrusherConfiguration.Current.QuerystringKeyName; CssGroups = CurrentCrusherConfiguration.Current.CssGroups; RetryableFileOpener = new RetryableFileOpener(); Hasher = new Hasher(RetryableFileOpener); }
public CssSpriteCreator(ICacheManager cacheManager, IRetryableFileOpener retryableFileOpener, IPathProvider pathProvider, IRetryableFileWriter retryableFileWriter, IMetaData fileMetaData) { CacheManager = cacheManager; RetryableFileOpener = retryableFileOpener; PathProvider = pathProvider; RetryableFileWriter = retryableFileWriter; FileMetaData = fileMetaData; }
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); }
private StaticFileManager() { _retryableFileOpener = new RetryableFileOpener(); _mimeTyper = new MimeTyper(); _hasher = new Hasher(_retryableFileOpener); _httpRequestHeaderHelper = new HttpRequestHeaderHelper(); _fileEntitySettingProvider = new FileEntitySettingProvider(); }
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>(); }
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>(); }
private CrusherHelper() { CacheManager = new HttpCacheManager(); QuerystringKeyName = CurrentCrusherConfiguration.Current.QuerystringKeyName; CssGroups = CurrentCrusherConfiguration.Current.CssGroups; JsGroups = CurrentCrusherConfiguration.Current.JsGroups; RetryableFileOpener = new RetryableFileOpener(); Hasher = new Hasher(RetryableFileOpener); }
private StaticFileManager() { _cacheManager = new HttpCacheManager(); _retryableFileOpener = new RetryableFileOpener(); _mimeTyper = new MimeTyper(_cacheManager); _hasher = new Hasher(_retryableFileOpener); _httpRequestHeaderHelper = new HttpRequestHeaderHelper(); _mimeSettingProvider = new MimeSettingProvider(); }
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); }
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>(); }
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>(); }
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(); }
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; }
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>(); }
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>(); }
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); }
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); }
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); }
/// <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); } } }
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); }
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(); }
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); }
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; }
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(); }
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); }
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)) }; }
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)) }; }
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) }; }
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; } } }
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>(); } }
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>(); } }
public Hasher(IRetryableFileOpener retryableFileOpener) { RetryableFileOpener = retryableFileOpener; }
public Md5Hasher(IRetryableFileOpener retryableFileOpener) { this.RetryableFileOpener = retryableFileOpener; }
public FileReader(IRetryableFileOpener retryableFileOpener, int numberOfRetries, string file) { streamReader = retryableFileOpener.OpenTextStreamReader(file, numberOfRetries); }
public Configuration RetryableFileOpener(IRetryableFileOpener retryableFileOpener) { _defaultRetryableFileOpener = retryableFileOpener; return(this); }
public Hasher(IRetryableFileOpener retryableFileOpener) { this.RetryableFileOpener = retryableFileOpener; }
public FileReaderFactory(IRetryableFileOpener retryableFileOpener, int numberOfRetries) { RetryableFileOpener = retryableFileOpener; NumberOfRetries = numberOfRetries; }
public JsCrusher(IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter, IPathProvider pathProvider) { RetryableFileOpener = retryableFileOpener; RetryableFileWriter = retryableFileWriter; PathProvider = pathProvider; }
public FileWriter(IRetryableFileOpener retryableFileOpener, int numberOfRetries, string file) { streamWriter = retryableFileOpener.OpenTextStreamWriter(file, numberOfRetries, false); }
public MultiFileMetaData(IRetryableFileOpener retryableFileOpener, IRetryableFileWriter retryableFileWriter) { _retryableFileOpener = retryableFileOpener; _retryableFileWriter = retryableFileWriter; }