main
cs 82 lines 3.11 KB
Raw
1 // 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.
2
3 namespace WixToolset.Core.WindowsInstaller.ExtensibilityServices
4 {
5 using System.Collections.Generic;
6 using WixToolset.Data;
7 using WixToolset.Data.Symbols;
8 using WixToolset.Data.WindowsInstaller;
9 using WixToolset.Data.WindowsInstaller.Rows;
10 using WixToolset.Extensibility.Data;
11
12 internal class FileFacade : IFileFacade
13 {
14 public FileFacade(FileSymbol file)
15 {
16 this.Identifier = file.Id;
17 this.ComponentRef = file.ComponentRef;
18 this.DiskId = file.DiskId ?? 1;
19 this.FileName = file.Name;
20 this.FileSize = file.FileSize;
21 this.Language = file.Language;
22 this.PatchGroup = file.PatchGroup;
23 this.Sequence = file.Sequence;
24 this.SourceLineNumber = file.SourceLineNumbers;
25 this.SourcePath = file.Source?.Path;
26 this.Compressed = (file.Attributes & FileSymbolAttributes.Compressed) == FileSymbolAttributes.Compressed;
27 this.Uncompressed = (file.Attributes & FileSymbolAttributes.Uncompressed) == FileSymbolAttributes.Uncompressed;
28 this.Version = file.Version;
29 this.AssemblyNameSymbols = new List<MsiAssemblyNameSymbol>();
30 }
31
32 public FileFacade(FileRow row)
33 {
34 this.Identifier = new Identifier(AccessModifier.Section, row.File);
35 this.ComponentRef = row.Component;
36 this.DiskId = row.DiskId;
37 this.FileName = row.FileName;
38 this.FileSize = row.FileSize;
39 this.Language = row.Language;
40 this.PatchGroup = null;
41 this.Sequence = row.Sequence;
42 this.SourceLineNumber = row.SourceLineNumbers;
43 this.SourcePath = row.Source;
44 this.Compressed = (row.Attributes & WindowsInstallerConstants.MsidbFileAttributesCompressed) == WindowsInstallerConstants.MsidbFileAttributesCompressed;
45 this.Uncompressed = (row.Attributes & WindowsInstallerConstants.MsidbFileAttributesNoncompressed) == WindowsInstallerConstants.MsidbFileAttributesNoncompressed;
46 this.Version = row.Version;
47 this.AssemblyNameSymbols = new List<MsiAssemblyNameSymbol>();
48 }
49
50 public string Id => this.Identifier.Id;
51
52 public Identifier Identifier { get; }
53
54 public string ComponentRef { get; }
55
56 public int DiskId { get; set; }
57
58 public string FileName { get; }
59
60 public int FileSize { get; set; }
61
62 public string Language { get; set; }
63
64 public int? PatchGroup { get; }
65
66 public int Sequence { get; set; }
67
68 public SourceLineNumber SourceLineNumber { get; }
69
70 public string SourcePath { get; }
71
72 public bool Compressed { get; }
73
74 public bool Uncompressed { get; }
75
76 public string Version { get; set; }
77
78 public MsiFileHashSymbol MsiFileHashSymbol { get; set; }
79
80 public ICollection<MsiAssemblyNameSymbol> AssemblyNameSymbols { get; }
81 }
82 }