Esempio n. 1
0
        /// <summary>
        /// Contains data relating to the file-transfer aspects of the report.
        /// </summary>
        /// <param name="source">The template filename. This may be an AppSettings key, a virtual path, or just the filename if it exists.</param>
        /// <param name="name">The filename to use when saving/downloading the report.</param>
        /// <param name="method">The optional save method to use: Local or Download.</param>
        public XlFileInfo(string source, string name, XlSaveMethod method = XlSaveMethod.Local)
        {
            FileName = name;

            if (method == XlSaveMethod.Download)
            {
                Output = new XlDownload();
            }
            else
            {
                Output = new XlDownload/*AndBackup*/ ();
            }

            FileSource = new XlFileSource(source);
        }
Esempio n. 2
0
        /// <summary>
        /// Used to download and backup report.
        /// </summary>
        /// <param name="source">The template filename. This may be an AppSettings key, a virtual path, or just the filename if it exists.</param>
        /// <param name="name">The filename to use when saving/downloading the report.</param>
        /// <param name="backup">The diretcory to save backup to. This may be an AppSettings key, a virtual directory, or a full path.</param>
        public XlFileInfo(string source, string name, string backup)
        {
            FileName   = name;
            Output     = new XlDownloadAndBackup();
            FileSource = new XlFileSource(source);

            BackupPath = Utils.GetDirPathIfExists(backup, out var backupExists);

            if (!backupExists)
            {
                throw new DirectoryNotFoundException(
                          $"No backup directory could be found using '{backup}' checking in AppSettings, " +
                          "Virtual Paths, and Absolute Paths. Please provide a valid key for AppSettings, " +
                          "a valid Virtual Path, or a valid Absolute Path.");
            }
        }