예제 #1
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();
        }
예제 #2
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();
        }