blob: ec4e97252e55f0dd73eb812a880ec34d6c62fc8b (
plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
namespace WixToolset.Core.Bind
{
using System;
using System.Collections.Generic;
using WixToolset.Data;
using WixToolset.Data.Symbols;
using WixToolset.Data.WindowsInstaller;
using WixToolset.Data.WindowsInstaller.Rows;
#pragma warning disable 1591 // TODO: this shouldn't be public, need interface in Extensibility
public class FileFacade
{
public FileFacade(FileSymbol file, AssemblySymbol assembly)
{
this.FileSymbol = file;
this.AssemblySymbol = assembly;
this.Identifier = file.Id;
this.ComponentRef = file.ComponentRef;
}
public FileFacade(bool fromModule, FileSymbol file)
{
this.FromModule = fromModule;
this.FileSymbol = file;
this.Identifier = file.Id;
this.ComponentRef = file.ComponentRef;
}
public FileFacade(FileRow row)
{
this.FromTransform = true;
this.FileRow = row;
this.Identifier = new Identifier(AccessModifier.Private, row.File);
this.ComponentRef = row.Component;
}
public bool FromModule { get; }
public bool FromTransform { get; }
private FileRow FileRow { get; }
private FileSymbol FileSymbol { get; }
private AssemblySymbol AssemblySymbol { get; }
public string Id => this.Identifier.Id;
public Identifier Identifier { get; }
public string ComponentRef { get; }
public int DiskId
{
get => this.FileRow == null ? this.FileSymbol.DiskId ?? 1 : this.FileRow.DiskId;
set
{
if (this.FileRow == null)
{
this.FileSymbol.DiskId = value;
}
else
{
this.FileRow.DiskId = value;
}
}
}
public string FileName => this.FileRow == null ? this.FileSymbol.Name : this.FileRow.FileName;
public int FileSize
{
get => this.FileRow == null ? this.FileSymbol.FileSize : this.FileRow.FileSize;
set
{
if (this.FileRow == null)
{
this.FileSymbol.FileSize = value;
}
else
{
this.FileRow.FileSize = value;
}
}
}
public string Language
{
get => this.FileRow == null ? this.FileSymbol.Language : this.FileRow.Language;
set
{
if (this.FileRow == null)
{
this.FileSymbol.Language = value;
}
else
{
this.FileRow.Language = value;
}
}
}
public int? PatchGroup => this.FileRow == null ? this.FileSymbol.PatchGroup : null;
public int Sequence
{
get => this.FileRow == null ? this.FileSymbol.Sequence : this.FileRow.Sequence;
set
{
if (this.FileRow == null)
{
this.FileSymbol.Sequence = value;
}
else
{
this.FileRow.Sequence = value;
}
}
}
public SourceLineNumber SourceLineNumber => this.FileRow == null ? this.FileSymbol.SourceLineNumbers : this.FileRow.SourceLineNumbers;
public string SourcePath => this.FileRow == null ? this.FileSymbol.Source.Path : this.FileRow.Source;
public bool Compressed => this.FileRow == null ? (this.FileSymbol.Attributes & FileSymbolAttributes.Compressed) == FileSymbolAttributes.Compressed : (this.FileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesCompressed) == WindowsInstallerConstants.MsidbFileAttributesCompressed;
public bool Uncompressed => this.FileRow == null ? (this.FileSymbol.Attributes & FileSymbolAttributes.Uncompressed) == FileSymbolAttributes.Uncompressed : (this.FileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesNoncompressed) == WindowsInstallerConstants.MsidbFileAttributesNoncompressed;
public string Version
{
get => this.FileRow == null ? this.FileSymbol.Version : this.FileRow.Version;
set
{
if (this.FileRow == null)
{
this.FileSymbol.Version = value;
}
else
{
this.FileRow.Version = value;
}
}
}
public AssemblyType? AssemblyType => this.FileRow == null ? this.AssemblySymbol?.Type : null;
public string AssemblyApplicationFileRef => this.FileRow == null ? this.AssemblySymbol?.ApplicationFileRef : throw new NotImplementedException();
public string AssemblyManifestFileRef => this.FileRow == null ? this.AssemblySymbol?.ManifestFileRef : throw new NotImplementedException();
/// <summary>
/// Gets the set of MsiAssemblyName rows created for this file.
/// </summary>
/// <value>RowCollection of MsiAssemblyName table.</value>
public List<MsiAssemblyNameSymbol> AssemblyNames { get; set; }
/// <summary>
/// Gets or sets the MsiFileHash row for this file.
/// </summary>
public MsiFileHashSymbol Hash { get; set; }
/// <summary>
/// Allows direct access to the underlying FileRow as requried for patching.
/// </summary>
public FileRow GetFileRow() => this.FileRow ?? throw new NotImplementedException();
}
}
|