-
Notifications
You must be signed in to change notification settings - Fork 748
Expand file tree
/
Copy pathPackageDownloadContext.cs
More file actions
63 lines (54 loc) · 2.25 KB
/
PackageDownloadContext.cs
File metadata and controls
63 lines (54 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using NuGet.Configuration;
using NuGet.Packaging.Signing;
namespace NuGet.Protocol.Core.Types
{
public class PackageDownloadContext
{
public PackageDownloadContext(SourceCacheContext sourceCacheContext) : this(
sourceCacheContext,
directDownloadDirectory: null,
directDownload: false,
packageSourceMappingConfiguration: null)
{
}
public PackageDownloadContext(
SourceCacheContext sourceCacheContext,
string? directDownloadDirectory,
bool directDownload)
{
if (sourceCacheContext == null)
{
throw new ArgumentNullException(nameof(sourceCacheContext));
}
if (directDownloadDirectory == null && (directDownload || sourceCacheContext.NoCache))
{
// If NoCache is specified on the source cache context, it's possible that we will perform a direct
// download (even if the PackageDownloadContext.DirectDownload property is false).
throw new ArgumentNullException(nameof(directDownloadDirectory));
}
SourceCacheContext = sourceCacheContext;
DirectDownload = directDownload;
DirectDownloadDirectory = directDownloadDirectory;
}
public PackageDownloadContext(
SourceCacheContext sourceCacheContext,
string? directDownloadDirectory,
bool directDownload,
PackageSourceMapping? packageSourceMappingConfiguration) : this(
sourceCacheContext,
directDownloadDirectory,
directDownload)
{
PackageSourceMapping = packageSourceMappingConfiguration;
}
public SourceCacheContext SourceCacheContext { get; }
public bool DirectDownload { get; }
public string? DirectDownloadDirectory { get; }
public Guid ParentId { get; set; }
public ClientPolicyContext? ClientPolicyContext { get; set; }
public PackageSourceMapping? PackageSourceMapping { get; }
}
}