forked from microsoft/winget-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstaller.cs
More file actions
42 lines (33 loc) · 1.3 KB
/
Copy pathInstaller.cs
File metadata and controls
42 lines (33 loc) · 1.3 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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace WinGetSourceCreator.Model
{
public abstract class Installer
{
public InstallerType Type { get; set; }
// The name of the installer when it copied or created.
public string Name { get; set; } = string.Empty;
// The identifying token of the installer in the manifests.
public string? HashToken { get; set; }
// An optional token relevant to the installer.
// If the installer is an msix, this is the token used for the appx signature hash.
public string? SignatureToken { get; set; }
public Signature? Signature { get; set; }
public bool SkipSignature { get; set; }
protected void Validate()
{
if (string.IsNullOrEmpty(this.Name))
{
throw new ArgumentNullException(nameof(this.Name));
}
if (this.Signature != null)
{
this.Signature.Validate();
}
if (this.Type != InstallerType.Msix && !string.IsNullOrEmpty(this.SignatureToken))
{
throw new Exception($"{nameof(this.SignatureToken)} can only be used for MSIX");
}
}
}
}