/// <summary> /// Download a web stream to a file. /// </summary> /// <param name="urlVariable">Url to access</param> /// <param name="destinationFileVariable">Destination file name.</param> /// <param name="nextCommand"></param> /// <returns></returns> public static IScriptCommand DownloadFile(string urlVariable = "{Url}", string destinationProfileVariable = "{Profile}", string destinationFileVariable = "{DestinationFile}", IScriptCommand nextCommand = null) { return(CoreScriptCommands.Download(urlVariable, "{DownloadStream}", CoreScriptCommands.DiskParseOrCreateFile(destinationProfileVariable, destinationFileVariable, "{Destination}", CoreScriptCommands.DiskOpenStream("{Destination}", "{DestinationStream}", FileExplorer.Defines.FileAccess.Write, CoreScriptCommands.CopyStream("{DownloadStream}", "{DestinationStream}", ScriptCommands.Reset(nextCommand, "{DownloadStream}", "{Destination}")))))); }