/// <summary> /// replace any token elements in a command line and return a full command ready to be executed /// </summary> /// <param name="tokenisedCommand">tokenised command</param> /// <param name="rootFolder">the root folder for all downloads</param> /// <param name="destinationPathname">the full pathname for the download</param> /// <param name="podcast">the podcast, used as a source of tokens</param> /// <returns>a full command line, NULL if there is no command to execute</returns> public IExternalCommand ReplaceTokensInCommand(ITokenisedCommand tokenisedCommand, string rootFolder, string destinationPathname, IPodcastInfo podcast) { if (tokenisedCommand == null) { return(null); } var command = new ExternalCommand(); command.Command = ReplaceTokensInString(tokenisedCommand.Command.Value, rootFolder, destinationPathname, podcast); command.Arguments = ReplaceTokensInString(tokenisedCommand.Arguments.Value, rootFolder, destinationPathname, podcast); command.WorkingDirectory = ReplaceTokensInString(tokenisedCommand.WorkingDirectory.Value, rootFolder, destinationPathname, podcast); return(command); }
protected virtual void SetupData() { _command = new TokenisedCommand(_controlFile); _command.Command.Value = "COMMAND"; _command.Arguments.Value = "ARGS"; _command.WorkingDirectory.Value = "CWD"; _rootFolder = @"c:\root"; _destinationPathname = @"c:\root\TestFolder\destination.xyz"; _podcastInfo = new PodcastInfo(_controlFile); _feedAddress = "http://test"; _feedInfo = new FeedInfo(_controlFile); _feedInfo.Format.Value = PodcastFeedFormat.RSS; _feedInfo.NamingStyle.Value = PodcastEpisodeNamingStyle.UrlFileName; _feedInfo.Address = new Uri(_feedAddress); _feedInfo.MaximumDaysOld.Value = int.MaxValue; _feedInfo.DownloadStrategy.Value = PodcastEpisodeDownloadStrategy.All; _podcastInfo = new PodcastInfo(_controlFile); _podcastInfo.Folder = "TestFolder"; _podcastInfo.Feed = _feedInfo; }
/// <summary> /// remove a post download command from the podcast /// </summary> public void RemovePostDownloadCommand() { PostDownloadCommand = null; }
/// <summary> /// create a post download command in the podcast /// </summary> public void CreatePostDownloadCommand() { PostDownloadCommand = new TokenisedCommand(_controlFileGlobalDefaults); }