Esempio n. 1
0
        /// <summary>
        /// Return the combined file lists, real file abstract layer has higher priority
        /// </summary>
        /// <param name="wildCardPattern"></param>
        /// <param name="subFolder"></param>
        /// <returns></returns>
        public IEnumerable <FileItem> ListFiles(string wildCardPattern, string subFolder, bool allDirectories = false)
        {
            if (wildCardPattern == null)
            {
                throw new ArgumentNullException(nameof(wildCardPattern));
            }

            var currentFiles = RealFileAbstractLayer.ListFiles(wildCardPattern, subFolder, allDirectories);

            if (FallbackFileAbstractLayer != null)
            {
                var currentFileFilePathSet = new HashSet <string>(currentFiles.Select(a => a.RelativePath));

                var fallbackFiles = FallbackFileAbstractLayer.ListFiles(wildCardPattern, subFolder, allDirectories).Where(i => !currentFileFilePathSet.Contains(i.RelativePath));

                return(currentFiles.Concat(fallbackFiles).ToList());
            }
            else
            {
                return(currentFiles);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Alwasy write to real file abstract layer
 /// </summary>
 public Stream OpenWrite(string relativePath)
 {
     return(RealFileAbstractLayer.OpenWrite(relativePath));
 }