Пример #1
0
        public bool IsDirty()
        {
            if (isDirtyOverride)
            {
                return(true);
            }

            var schemaFiles = InputFiles
                              .Select(file => detailsStore.FileTree.GetFullPathForRelativeSchema(file))
                              .Select(path => fileSystem.GetFileInfo(path))
                              .ToList();

            var existingFiles = OutputFiles
                                .Select(entry => fileSystem.GetFileInfo(Path.Combine(OutputDirectory, entry)))
                                .ToList();

            if (schemaFiles.Count == 0 || existingFiles.Count == 0)
            {
                return(true);
            }

            //Ensure that all expected output files exist
            foreach (var file in existingFiles)
            {
                if (!file.Exists())
                {
                    return(true);
                }
            }

            var sortedSchemaFileInfo = schemaFiles.OrderByDescending(item => item.LastWriteTime).ToList();
            var sortedExistingFiles  = existingFiles.OrderByDescending(item => item.LastWriteTime).ToList();

            return(sortedSchemaFileInfo.First().LastWriteTime > sortedExistingFiles.First().LastWriteTime);
        }