From 69b15d96cebdbb7201b1849b4f62786633d70b8d Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 1 Nov 2017 10:56:09 -0700 Subject: Introduce WiX Intermediate Representation --- src/WixToolset.Data/Tuples/WixFileTuple.cs | 170 +++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 src/WixToolset.Data/Tuples/WixFileTuple.cs (limited to 'src/WixToolset.Data/Tuples/WixFileTuple.cs') diff --git a/src/WixToolset.Data/Tuples/WixFileTuple.cs b/src/WixToolset.Data/Tuples/WixFileTuple.cs new file mode 100644 index 00000000..5ffc5d7f --- /dev/null +++ b/src/WixToolset.Data/Tuples/WixFileTuple.cs @@ -0,0 +1,170 @@ +// 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.Data +{ + using WixToolset.Data.Tuples; + + public static partial class TupleDefinitions + { + public static readonly IntermediateTupleDefinition WixFile = new IntermediateTupleDefinition( + TupleDefinitionType.WixFile, + new[] + { + new IntermediateFieldDefinition(nameof(WixFileTupleFields.File_), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixFileTupleFields.AssemblyType), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixFileTupleFields.File_AssemblyManifest), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixFileTupleFields.File_AssemblyApplication), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixFileTupleFields.Directory_), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixFileTupleFields.DiskId), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixFileTupleFields.Source), IntermediateFieldType.Path), + new IntermediateFieldDefinition(nameof(WixFileTupleFields.ProcessorArchitecture), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixFileTupleFields.PatchGroup), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixFileTupleFields.Attributes), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixFileTupleFields.PatchAttributes), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixFileTupleFields.DeltaPatchHeaderSource), IntermediateFieldType.String), + }, + typeof(WixFileTuple)); + } +} + +namespace WixToolset.Data.Tuples +{ + using System; + + public enum WixFileTupleFields + { + File_, + AssemblyType, + File_AssemblyManifest, + File_AssemblyApplication, + Directory_, + DiskId, + Source, + ProcessorArchitecture, + PatchGroup, + Attributes, + PatchAttributes, + DeltaPatchHeaderSource, + } + + /// + /// Every file row has an assembly type. + /// + public enum FileAssemblyType + { + /// File is not an assembly. + NotAnAssembly, + + /// File is a Common Language Runtime Assembly. + DotNetAssembly, + + /// File is Win32 SxS assembly. + Win32Assembly, + } + + /// + /// PatchAttribute values + /// + [Flags] + public enum PatchAttributeType + { + None = 0, + + /// Prevents the updating of the file that is in fact changed in the upgraded image relative to the target images. + Ignore = 1, + + /// Set if the entire file should be installed rather than creating a binary patch. + IncludeWholeFile = 2, + + /// Set to indicate that the patch is non-vital. + AllowIgnoreOnError = 4, + + /// Allowed bits. + Defined = Ignore | IncludeWholeFile | AllowIgnoreOnError + } + + public class WixFileTuple : IntermediateTuple + { + public WixFileTuple() : base(TupleDefinitions.WixFile, null, null) + { + } + + public WixFileTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(TupleDefinitions.WixFile, sourceLineNumber, id) + { + } + + public IntermediateField this[WixFileTupleFields index] => this.Fields[(int)index]; + + public string File_ + { + get => (string)this.Fields[(int)WixFileTupleFields.File_]?.Value; + set => this.Set((int)WixFileTupleFields.File_, value); + } + + public FileAssemblyType AssemblyType + { + get => (FileAssemblyType)(int)this.Fields[(int)WixFileTupleFields.AssemblyType]?.Value; + set => this.Set((int)WixFileTupleFields.AssemblyType, (int)value); + } + + public string File_AssemblyManifest + { + get => (string)this.Fields[(int)WixFileTupleFields.File_AssemblyManifest]?.Value; + set => this.Set((int)WixFileTupleFields.File_AssemblyManifest, value); + } + + public string File_AssemblyApplication + { + get => (string)this.Fields[(int)WixFileTupleFields.File_AssemblyApplication]?.Value; + set => this.Set((int)WixFileTupleFields.File_AssemblyApplication, value); + } + + public string Directory_ + { + get => (string)this.Fields[(int)WixFileTupleFields.Directory_]?.Value; + set => this.Set((int)WixFileTupleFields.Directory_, value); + } + + public int DiskId + { + get => (int)this.Fields[(int)WixFileTupleFields.DiskId]?.Value; + set => this.Set((int)WixFileTupleFields.DiskId, value); + } + + public string Source + { + get => (string)this.Fields[(int)WixFileTupleFields.Source]?.Value; + set => this.Set((int)WixFileTupleFields.Source, value); + } + + public string ProcessorArchitecture + { + get => (string)this.Fields[(int)WixFileTupleFields.ProcessorArchitecture]?.Value; + set => this.Set((int)WixFileTupleFields.ProcessorArchitecture, value); + } + + public int PatchGroup + { + get => (int)this.Fields[(int)WixFileTupleFields.PatchGroup]?.Value; + set => this.Set((int)WixFileTupleFields.PatchGroup, value); + } + + public int Attributes + { + get => (int)this.Fields[(int)WixFileTupleFields.Attributes]?.Value; + set => this.Set((int)WixFileTupleFields.Attributes, value); + } + + public PatchAttributeType PatchAttributes + { + get => (PatchAttributeType)(int)this.Fields[(int)WixFileTupleFields.PatchAttributes]?.Value; + set => this.Set((int)WixFileTupleFields.PatchAttributes, (int)value); + } + + public string DeltaPatchHeaderSource + { + get => (string)this.Fields[(int)WixFileTupleFields.DeltaPatchHeaderSource]?.Value; + set => this.Set((int)WixFileTupleFields.DeltaPatchHeaderSource, value); + } + } +} \ No newline at end of file -- cgit v1.2.3-55-g6feb