Esempio n. 1
0
        /// <nodoc />
        public ExtractorArgs(string[] args) : base(args)
        {
            foreach (Option opt in Options)
            {
                if (opt.Name.Equals("file", StringComparison.OrdinalIgnoreCase))
                {
                    PathToFileToExtract = opt.Value;
                }
                else if (opt.Name.Equals("extractTo", StringComparison.OrdinalIgnoreCase))
                {
                    ExtractDirectory = opt.Value;
                }
                else if (opt.Name.Equals("archiveType", StringComparison.OrdinalIgnoreCase))
                {
                    ArchiveType = Enum.Parse <DownloadArchiveType>(opt.Value, ignoreCase: true);
                }
                else
                {
                    throw Error($"Unsupported option: {opt.Name}.");
                }
            }

            if (string.IsNullOrEmpty(ExtractDirectory))
            {
                throw Error($"Missing mandatory argument 'extractTo'");
            }

            if (string.IsNullOrEmpty(PathToFileToExtract))
            {
                throw Error($"Missing mandatory argument 'file'");
            }
        }
Esempio n. 2
0
 protected IDownloadFileSettings GetSampleData(string url, DownloadArchiveType archiveType, ContentHash?contentHash = null)
 {
     return(new DownloadFileSettings
     {
         ModuleName = "TestDownload",
         ArchiveType = archiveType,
         Url = url,
         Hash = contentHash?.ToString()
     });
 }
Esempio n. 3
0
        private DownloadData GetSampleData(string url, DownloadArchiveType archiveType, ContentHash?contentHash = null)
        {
            var uri = new Uri(url);

            return(new DownloadData(
                       FrontEndContext,
                       new DownloadFileSettings
            {
                ModuleName = "TestDownload",
                ArchiveType = archiveType,
                Url = url,
            },
                       uri,
                       AbsolutePath.Create(FrontEndContext.PathTable, Path.Combine(TemporaryDirectory, m_uniqueTestFolder, "DownloadCache")),
                       contentHash));
        }