Beispiel #1
0
        private Include CreateInclude(string content, string extension)
        {
            _fileCount++;

            var lessFile = new FileInfo(Path.Combine(_temporaryDirectory, Guid.NewGuid().ToString() + extension));
            File.WriteAllText(lessFile.FullName, content);

            // move the creation and last write back in time to simulate real world
            lessFile.CreationTimeUtc = DateTime.UtcNow.AddDays(-1 * _fileCount);
            lessFile.LastWriteTimeUtc = lessFile.CreationTimeUtc;

            var include = new Include();
            include.File = lessFile.FullName;
            return include;
        }
Beispiel #2
0
 private IncludeState CreateIncludeState(string bundleFileDirectory, Include include)
 {
     var includeFileFullPath = new FileInfo(EnsureFileRooted(bundleFileDirectory, include.File));
     var outputFile = new FileInfo(EnsureFileRooted(bundleFileDirectory, include.GetOutputFile()));
     return new IncludeState()
     {
         File = includeFileFullPath,
         Include = include,
         Imports = Include.GetImportFiles(includeFileFullPath.FullName)
             .Select(s => EnsureFileRooted(includeFileFullPath.Directory.FullName, s))
             .Distinct(StringComparer.InvariantCultureIgnoreCase)
             .ToList(),
         OutputFile = outputFile,
         // IF the include and output files are the same
         // THEN the output is already transformed
         Transformed = (includeFileFullPath == outputFile),
     };
 }