Пример #1
0
        private void InitManager()
        {
            AppDomain.CurrentDomain.DomainUnload += OnDomainUnload;

            foreach (CssSpriteGroupElement group in _cssSpriteGroups)
            {
                var files           = new List <ImageFile>();
                var imageOutputPath = new FileInfo(_pathProvider.MapPath(group.ImageOutputFilePath));
                var imageUrl        = string.IsNullOrEmpty(group.ImageUrl)
                                   ? VirtualPathUtility.ToAbsolute(group.ImageOutputFilePath)
                                   : group.ImageUrl;
                var imageUri      = new Uri(imageUrl, UriKind.RelativeOrAbsolute);
                var cssOutputPath = new FileInfo(_pathProvider.MapPath(group.CssOutputFilePath));

                foreach (ImageFileElement imageFile in group.Files)
                {
                    var file = new ImageFile()
                    {
                        FilePath = imageFile.FilePath,
                        Name     = imageFile.Name
                    };
                    files.Add(file);
                }

                _cssSpriteCreator.AddFiles(imageOutputPath, imageUri, cssOutputPath, files);
            }
        }
Пример #2
0
        private void InitManager()
        {
            AppDomain.CurrentDomain.DomainUnload += OnDomainUnload;

            foreach (CssSpriteGroupElement group in _cssSpriteGroups)
            {
                var files           = new List <ImageFile>();
                var imageOutputPath = new FileInfo(new Uri(_pathProvider.MapPath(group.ImageOutputFilePath)).LocalPath);
                var imageUrl        = string.IsNullOrEmpty(group.ImageUrl)
                                   ? VirtualPathUtility.ToAbsolute(group.ImageOutputFilePath)
                                   : group.ImageUrl;
                var imageUri      = new Uri(imageUrl, UriKind.RelativeOrAbsolute);
                var cssOutputPath = new FileInfo(new Uri(_pathProvider.MapPath(group.CssOutputFilePath)).LocalPath);

                foreach (ImageFileElement imageFile in group.Files)
                {
                    var file = new ImageFile()
                    {
                        FilePath = imageFile.FilePath,
                        Name     = imageFile.Name
                    };
                    files.Add(file);
                }

                var directories = new List <ImageDirectory>();

                foreach (ImageDirectoryElement imageDirectory in group.Directories)
                {
                    var directory = new ImageDirectory()
                    {
                        DirectoryPath         = imageDirectory.DirectoryPath,
                        ExcludeFilter         = imageDirectory.ExcludeFilter,
                        IncludeFilter         = imageDirectory.IncludeFilter,
                        IncludeSubDirectories = imageDirectory.IncludeSubDirectories,
                        PollTime = imageDirectory.PollTime
                    };

                    directories.Add(directory);
                }

                _cssSpriteCreator.AddFiles(imageOutputPath, imageUri, cssOutputPath, files, directories);
            }
        }