DownloadFlow.h (3767B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 #pragma once 4 #include "ExecutionContext.h" 5 6 namespace AppInstaller::CLI::Workflow 7 { 8 // Composite flow that chooses what to do based on the installer type. 9 // Required Args: None 10 // Inputs: Manifest, Installer 11 // Outputs: None 12 void DownloadInstaller(Execution::Context& context); 13 14 // Check if the desired installer has already been downloaded. 15 // Required Args: None 16 // Inputs: Manifest, Installer 17 // Outputs: HashPair, InstallerPath (only if found) 18 void CheckForExistingInstaller(Execution::Context& context); 19 20 // Computes the download path for the installer file. Does nothing if already determined 21 // Required Args: None 22 // Inputs: Installer, Manifest 23 // Outputs: InstallerPath 24 void GetInstallerDownloadPath(Execution::Context& context); 25 26 // Downloads the file referenced by the Installer. 27 // This workflow task is also used by MSStoreDownload task. 28 // Required Args: None 29 // Inputs: Installer, Manifest 30 // Outputs: HashPair, InstallerPath 31 void DownloadInstallerFile(Execution::Context& context); 32 33 // Computes the hash of the MSIX signature file. 34 // Required Args: None 35 // Inputs: Installer 36 // Outputs: HashPair 37 void GetMsixSignatureHash(Execution::Context& context); 38 39 // Re-verify the installer hash. This is used in Com install commands where download and install are in separate phases. 40 // Required Args: None 41 // Inputs: InstallerPath, Installer 42 // Outputs: HashPair 43 void ReverifyInstallerHash(Execution::Context& context); 44 45 // Verifies that the downloaded installer hash matches the hash in the manifest. 46 // Required Args: None 47 // Inputs: HashPair 48 // Outputs: None 49 void VerifyInstallerHash(Execution::Context& context); 50 51 // Update Motw of the downloaded installer if applicable 52 // Required Args: None 53 // Inputs: HashPair, InstallerPath?, SourceId? 54 // Outputs: None 55 void UpdateInstallerFileMotwIfApplicable(Execution::Context& context); 56 57 // This method appends appropriate extension to the downloaded installer. 58 // ShellExecute uses file extension to launch the installer appropriately. 59 // Required Args: None 60 // Inputs: Installer, InstallerPath 61 // Modifies: InstallerPath 62 // Outputs: None 63 void RenameDownloadedInstaller(Execution::Context& context); 64 65 // Deletes the installer file. 66 // Required Args: None 67 // Inputs: InstallerPath 68 // Outputs: None 69 void RemoveInstaller(Execution::Context& context); 70 71 // Sets the target download directory location if applicable. 72 // Required Args: None 73 // Inputs: Manifest 74 // Outputs: None 75 void SetDownloadDirectory(Execution::Context& context); 76 77 // Exports the manifest yaml file for the downloaded package installer. Only applies to the 'winget download' command. 78 // Required Args: None 79 // Inputs: Manifest, Installer, DownloadDirectory 80 // Outputs: None 81 void ExportManifest(Execution::Context& context); 82 83 // This method ensures requirements of download for later offline installation. 84 // Required Args: None 85 // Inputs: Installer 86 // Outputs: None 87 void EnsureSupportForDownload(Execution::Context& context); 88 89 // This method initializes an empty InstallerDownloadAuthenticators map. 90 // InstallerDownloadAuthenticators map is for reusing authenticators when downloading multiple installers. 91 // Required Args: None 92 // Inputs: None 93 // Outputs: New empty InstallerDownloadAuthenticators 94 void InitializeInstallerDownloadAuthenticatorsMap(Execution::Context& context); 95 }