From 77dc8cd1acd5332aa0cb077c7e87d0678756969b Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 7 Dec 2017 20:54:45 -0800 Subject: Store WixMediaTemplate/@CompressionLevel as string --- src/WixToolset.Data/Tuples/WixMediaTemplateTuple.cs | 13 +++++++++---- src/WixToolset.Data/Tuples/WixMediaTuple.cs | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/WixToolset.Data/Tuples/WixMediaTemplateTuple.cs b/src/WixToolset.Data/Tuples/WixMediaTemplateTuple.cs index bc8d2515..f7ac8bc4 100644 --- a/src/WixToolset.Data/Tuples/WixMediaTemplateTuple.cs +++ b/src/WixToolset.Data/Tuples/WixMediaTemplateTuple.cs @@ -11,7 +11,7 @@ namespace WixToolset.Data new[] { new IntermediateFieldDefinition(nameof(WixMediaTemplateTupleFields.CabinetTemplate), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixMediaTemplateTupleFields.CompressionLevel), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixMediaTemplateTupleFields.CompressionLevel), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixMediaTemplateTupleFields.DiskPrompt), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixMediaTemplateTupleFields.VolumeLabel), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixMediaTemplateTupleFields.MaximumUncompressedMediaSize), IntermediateFieldType.Number), @@ -53,10 +53,15 @@ namespace WixToolset.Data.Tuples set => this.Set((int)WixMediaTemplateTupleFields.CabinetTemplate, value); } - public CompressionLevel CompressionLevel + public CompressionLevel? CompressionLevel { - get => (CompressionLevel)Enum.Parse(typeof(CompressionLevel), (string)this.Fields[(int)WixMediaTupleFields.CompressionLevel]?.Value, true); - set => this.Set((int)WixMediaTupleFields.CompressionLevel, value.ToString()); + get + { + var value = (string)this.Fields[(int)WixMediaTupleFields.CompressionLevel]?.Value; + return String.IsNullOrEmpty(value) ? null : (CompressionLevel?)Enum.Parse(typeof(CompressionLevel), value, true); + } + + set => this.Set((int)WixMediaTupleFields.CompressionLevel, value?.ToString()); } public string DiskPrompt diff --git a/src/WixToolset.Data/Tuples/WixMediaTuple.cs b/src/WixToolset.Data/Tuples/WixMediaTuple.cs index 4da11de1..ec887df6 100644 --- a/src/WixToolset.Data/Tuples/WixMediaTuple.cs +++ b/src/WixToolset.Data/Tuples/WixMediaTuple.cs @@ -11,7 +11,7 @@ namespace WixToolset.Data new[] { new IntermediateFieldDefinition(nameof(WixMediaTupleFields.DiskId_), IntermediateFieldType.Number), - new IntermediateFieldDefinition(nameof(WixMediaTupleFields.CompressionLevel), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixMediaTupleFields.CompressionLevel), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixMediaTupleFields.Layout), IntermediateFieldType.String), }, typeof(WixMediaTuple)); -- cgit v1.2.3-55-g6feb