diff options
Diffstat (limited to 'src/WixToolset.Core/Bind/FileFacade.cs')
-rw-r--r-- | src/WixToolset.Core/Bind/FileFacade.cs | 128 |
1 files changed, 121 insertions, 7 deletions
diff --git a/src/WixToolset.Core/Bind/FileFacade.cs b/src/WixToolset.Core/Bind/FileFacade.cs index d631a3b5..7bfdb9bb 100644 --- a/src/WixToolset.Core/Bind/FileFacade.cs +++ b/src/WixToolset.Core/Bind/FileFacade.cs | |||
@@ -2,32 +2,146 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Core.Bind | 3 | namespace WixToolset.Core.Bind |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using WixToolset.Data; | ||
6 | using WixToolset.Data.Tuples; | 8 | using WixToolset.Data.Tuples; |
9 | using WixToolset.Data.WindowsInstaller; | ||
10 | using WixToolset.Data.WindowsInstaller.Rows; | ||
7 | 11 | ||
8 | public class FileFacade | 12 | public class FileFacade |
9 | { | 13 | { |
10 | public FileFacade(FileTuple file, AssemblyTuple assembly) | 14 | public FileFacade(FileTuple file, AssemblyTuple assembly) |
11 | { | 15 | { |
12 | this.File = file; | 16 | this.FileTuple = file; |
13 | this.Assembly = assembly; | 17 | this.AssemblyTuple = assembly; |
14 | } | 18 | } |
15 | 19 | ||
16 | public FileFacade(bool fromModule, FileTuple file) | 20 | public FileFacade(bool fromModule, FileTuple file) |
17 | { | 21 | { |
18 | this.FromModule = fromModule; | 22 | this.FromModule = fromModule; |
19 | this.File = file; | 23 | this.FileTuple = file; |
24 | } | ||
25 | |||
26 | internal FileFacade(FileRow row) | ||
27 | { | ||
28 | this.FromTransform = true; | ||
29 | this.FileRow = row; | ||
20 | } | 30 | } |
21 | 31 | ||
22 | public bool FromModule { get; } | 32 | public bool FromModule { get; } |
23 | 33 | ||
24 | public FileTuple File { get; } | 34 | public bool FromTransform { get; } |
35 | |||
36 | private FileRow FileRow { get; } | ||
37 | |||
38 | private FileTuple FileTuple { get; } | ||
39 | |||
40 | private AssemblyTuple AssemblyTuple { get; } | ||
41 | |||
42 | public string Id => this.FileRow == null ? this.FileTuple.Id.Id : this.FileRow.File; | ||
43 | |||
44 | public Identifier Identifier => this.FileRow == null ? this.FileTuple.Id : throw new NotImplementedException(); | ||
45 | |||
46 | public string ComponentRef => this.FileRow == null ? this.FileTuple.ComponentRef : this.FileRow.Component; | ||
47 | |||
48 | public int DiskId | ||
49 | { | ||
50 | get => this.FileRow == null ? this.FileTuple.DiskId ?? 0 : this.FileRow.DiskId; | ||
51 | set | ||
52 | { | ||
53 | if (this.FileRow == null) | ||
54 | { | ||
55 | this.FileTuple.DiskId = value; | ||
56 | } | ||
57 | else | ||
58 | { | ||
59 | this.FileRow.DiskId = value; | ||
60 | } | ||
61 | } | ||
62 | } | ||
63 | |||
64 | public string FileName => this.FileRow == null ? this.FileTuple.Name : this.FileRow.FileName; | ||
65 | |||
66 | public int FileSize | ||
67 | { | ||
68 | get => this.FileRow == null ? this.FileTuple.FileSize : this.FileRow.FileSize; | ||
69 | set | ||
70 | { | ||
71 | if (this.FileRow == null) | ||
72 | { | ||
73 | this.FileTuple.FileSize = value; | ||
74 | } | ||
75 | else | ||
76 | { | ||
77 | this.FileRow.FileSize = value; | ||
78 | } | ||
79 | } | ||
80 | } | ||
81 | |||
82 | public string Language | ||
83 | { | ||
84 | get => this.FileRow == null ? this.FileTuple.Language : this.FileRow.Language; | ||
85 | set | ||
86 | { | ||
87 | if (this.FileRow == null) | ||
88 | { | ||
89 | this.FileTuple.Language = value; | ||
90 | } | ||
91 | else | ||
92 | { | ||
93 | this.FileRow.Language = value; | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | |||
98 | public int? PatchGroup => this.FileRow == null ? this.FileTuple.PatchGroup : null; | ||
99 | |||
100 | public int Sequence | ||
101 | { | ||
102 | get => this.FileRow == null ? this.FileTuple.Sequence : this.FileRow.Sequence; | ||
103 | set | ||
104 | { | ||
105 | if (this.FileRow == null) | ||
106 | { | ||
107 | this.FileTuple.Sequence = value; | ||
108 | } | ||
109 | else | ||
110 | { | ||
111 | this.FileRow.Sequence = value; | ||
112 | } | ||
113 | } | ||
114 | } | ||
115 | |||
116 | public SourceLineNumber SourceLineNumber => this.FileRow == null ? this.FileTuple.SourceLineNumbers : this.FileRow.SourceLineNumbers; | ||
117 | |||
118 | public string SourcePath => this.FileRow == null ? this.FileTuple.Source.Path : this.FileRow.Source; | ||
119 | |||
120 | public bool Compressed => this.FileRow == null ? (this.FileTuple.Attributes & FileTupleAttributes.Compressed) == FileTupleAttributes.Compressed : (this.FileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesCompressed) == WindowsInstallerConstants.MsidbFileAttributesCompressed; | ||
121 | |||
122 | public bool Uncompressed => this.FileRow == null ? (this.FileTuple.Attributes & FileTupleAttributes.Uncompressed) == FileTupleAttributes.Uncompressed : (this.FileRow.Attributes & WindowsInstallerConstants.MsidbFileAttributesNoncompressed) == WindowsInstallerConstants.MsidbFileAttributesNoncompressed; | ||
123 | |||
124 | public string Version | ||
125 | { | ||
126 | get => this.FileRow == null ? this.FileTuple.Version : this.FileRow.Version; | ||
127 | set | ||
128 | { | ||
129 | if (this.FileRow == null) | ||
130 | { | ||
131 | this.FileTuple.Version = value; | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | this.FileRow.Version = value; | ||
136 | } | ||
137 | } | ||
138 | } | ||
25 | 139 | ||
26 | public AssemblyTuple Assembly { get; } | 140 | public AssemblyType? AssemblyType => this.FileRow == null ? this.AssemblyTuple?.Type : throw new NotImplementedException(); |
27 | 141 | ||
28 | public int DiskId => this.File.DiskId ?? 0; | 142 | public string AssemblyApplicationFileRef => this.FileRow == null ? this.AssemblyTuple?.ApplicationFileRef : throw new NotImplementedException(); |
29 | 143 | ||
30 | public bool Uncompressed => (this.File.Attributes & FileTupleAttributes.Uncompressed) == FileTupleAttributes.Uncompressed; | 144 | public string AssemblyManifestFileRef => this.FileRow == null ? this.AssemblyTuple?.ManifestFileRef : throw new NotImplementedException(); |
31 | 145 | ||
32 | /// <summary> | 146 | /// <summary> |
33 | /// Gets the set of MsiAssemblyName rows created for this file. | 147 | /// Gets the set of MsiAssemblyName rows created for this file. |