示例#1
0
        /// <summary>
        /// Gets the ZIP path for an export profile.
        /// </summary>
        /// <param name="profile">Export profile.</param>
        /// <returns>ZIP file path.</returns>
        public static string GetExportZipPath(this ExportProfile profile)
        {
            Guard.NotNull(profile, nameof(profile));

            var name = new DirectoryInfo(profile.FolderName).Name.NullEmpty() ?? "ExportData";

            return(Path.Combine(profile.GetExportDirectory(), name.ToValidFileName() + ".zip"));
        }
示例#2
0
        /// <summary>
        /// Gets existing export files for an export profile.
        /// </summary>
        /// <param name="profile">Export profile.</param>
        /// <param name="provider">Export provider.</param>
        /// <returns>List of file names.</returns>
        public static IEnumerable <string> GetExportFiles(this ExportProfile profile, Provider <IExportProvider> provider)
        {
            var exportFolder = profile.GetExportDirectory(true);

            if (Directory.Exists(exportFolder) && provider.Value.FileExtension.HasValue())
            {
                var filter = "*.{0}".FormatInvariant(provider.Value.FileExtension.ToLower());

                return(Directory.EnumerateFiles(exportFolder, filter, SearchOption.AllDirectories).OrderBy(x => x));
            }

            return(Enumerable.Empty <string>());
        }
示例#3
0
 /// <summary>
 /// Gets the log file path for an export profile.
 /// </summary>
 /// <param name="profile">Export profile.</param>
 /// <returns>Log file path.</returns>
 public static string GetExportLogPath(this ExportProfile profile)
 {
     return(Path.Combine(profile.GetExportDirectory(), "log.txt"));
 }