Esempio n. 1
0
        /// <summary>
        /// Loads the specified files
        /// </summary>
        /// <param name="directoryPath">Path to the SAFE directory</param>
        /// <param name="fileType">The desired filetype</param>
        /// <returns>All files that match the filetype</returns>
        public static IEnumerable <FileInfo> GetFiles(string directoryPath, SAFEFileTypes fileType)
        {
            if (Directory.Exists(directoryPath) == false)
            {
                throw new DirectoryNotFoundException();
            }

            return(new DirectoryInfo(directoryPath).GetFiles().ToList().Where(f => f.Name.Contains(fileType.GetFileName())));
        }
        public static string GetFileName(this SAFEFileTypes fileType)
        {
            switch (fileType)
            {
            case SAFEFileTypes.Manifest:
                return("manifest.safe");

            default:
                throw new ArgumentOutOfRangeException(nameof(fileType), fileType, null);
            }
        }