/// <summary> /// Add the js files to the cache so that they are monitored for any changes. /// </summary> /// <param name="outputUri">The path for the crushed js file.</param> /// <param name="filesToWatch">Files that are crushed.</param> /// <param name="files">The js files to be crushed.</param> /// <param name="foldersToWatch"> </param> /// <param name="directories">The js directories to be crushed.</param> public virtual void AddGroupToCache(Uri outputUri, IEnumerable <JsFileToWatch> filesToWatch, IEnumerable <JsFile> files, IEnumerable <Talifun.FileWatcher.IEnhancedFileSystemWatcher> foldersToWatch, IEnumerable <JsDirectory> directories) { var fileNames = new List <string> { PathProvider.MapPath(outputUri) }; fileNames.AddRange(filesToWatch.Select(file => new Uri(PathProvider.MapPath(file.FilePath)).LocalPath)); var cacheItem = new JsCacheItem() { OutputUri = outputUri, FilesToWatch = filesToWatch, Files = files, FoldersToWatch = foldersToWatch, Directories = directories }; CacheManager.Insert( GetKey(outputUri), cacheItem, new CacheDependency(fileNames.ToArray(), System.DateTime.Now), Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.High, FileRemoved); foreach (var enhancedFileSystemWatcher in foldersToWatch) { enhancedFileSystemWatcher.FileActivityFinishedEvent += OnFileActivityFinishedEvent; enhancedFileSystemWatcher.UserState = outputUri; enhancedFileSystemWatcher.Start(); } }
/// <summary> /// Add the js files to the cache so that they are monitored for any changes. /// </summary> /// <param name="outputUri">The path for the crushed js file.</param> /// <param name="filesToWatch">Files that are crushed.</param> /// <param name="files">The js files to be crushed.</param> /// <param name="foldersToWatch"> </param> /// <param name="directories">The js directories to be crushed.</param> public virtual void AddGroupToCache(Uri outputUri, IEnumerable<JsFileToWatch> filesToWatch, IEnumerable<JsFile> files, IEnumerable<Talifun.FileWatcher.IEnhancedFileSystemWatcher> foldersToWatch, IEnumerable<JsDirectory> directories) { var fileNames = new List<string> { PathProvider.MapPath(outputUri) }; fileNames.AddRange(filesToWatch.Select(file => new Uri(PathProvider.MapPath(file.FilePath)).LocalPath)); var cacheItem = new JsCacheItem() { OutputUri = outputUri, FilesToWatch = filesToWatch, Files = files, FoldersToWatch = foldersToWatch, Directories = directories }; CacheManager.Insert( GetKey(outputUri), cacheItem, new CacheDependency(fileNames.ToArray(), System.DateTime.Now), Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.High, FileRemoved); foreach (var enhancedFileSystemWatcher in foldersToWatch) { enhancedFileSystemWatcher.FileActivityFinishedEvent += OnFileActivityFinishedEvent; enhancedFileSystemWatcher.UserState = outputUri; enhancedFileSystemWatcher.Start(); } }