diff options
| author | Rob Mensching <rob@firegiant.com> | 2019-05-15 16:09:26 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2019-05-15 16:12:21 -0700 |
| commit | 6f6c485118796f044a278447722eaf18ac5bf86e (patch) | |
| tree | de580265227abc257ee85a8973367f5cdce09bd9 /src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs | |
| parent | 8d3f778c61a1a0a576445e8dc7312613363b787d (diff) | |
| download | wix-6f6c485118796f044a278447722eaf18ac5bf86e.tar.gz wix-6f6c485118796f044a278447722eaf18ac5bf86e.tar.bz2 wix-6f6c485118796f044a278447722eaf18ac5bf86e.zip | |
Initial code commit
Diffstat (limited to 'src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs')
| -rw-r--r-- | src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs | 391 |
1 files changed, 391 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs b/src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs new file mode 100644 index 00000000..ae33d6b1 --- /dev/null +++ b/src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs | |||
| @@ -0,0 +1,391 @@ | |||
| 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 WixToolsetTest.Converters.Tupleizer | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.IO; | ||
| 7 | using System.Linq; | ||
| 8 | using WixBuildTools.TestSupport; | ||
| 9 | using Wix3 = Microsoft.Tools.WindowsInstallerXml; | ||
| 10 | using WixToolset.Converters.Tupleizer; | ||
| 11 | using WixToolset.Data; | ||
| 12 | using WixToolset.Data.WindowsInstaller; | ||
| 13 | using WixToolset.Data.Tuples; | ||
| 14 | using Xunit; | ||
| 15 | |||
| 16 | public class ConvertTuplesFixture | ||
| 17 | { | ||
| 18 | [Fact] | ||
| 19 | public void CanLoadWixoutAndConvertToIntermediate() | ||
| 20 | { | ||
| 21 | var rootFolder = TestData.Get(); | ||
| 22 | var dataFolder = TestData.Get(@"TestData\Integration"); | ||
| 23 | |||
| 24 | using (var fs = new DisposableFileSystem()) | ||
| 25 | { | ||
| 26 | var intermediateFolder = fs.GetFolder(); | ||
| 27 | |||
| 28 | var path = Path.Combine(dataFolder, "test.wixout"); | ||
| 29 | var output = Wix3.Output.Load(path, suppressVersionCheck: true, suppressSchema: true); | ||
| 30 | |||
| 31 | var command = new ConvertTuplesCommand(); | ||
| 32 | var intermediate = command.Execute(output); | ||
| 33 | |||
| 34 | Assert.NotNull(intermediate); | ||
| 35 | Assert.Single(intermediate.Sections); | ||
| 36 | Assert.Equal(String.Empty, intermediate.Id); | ||
| 37 | |||
| 38 | // Save and load to guarantee round-tripping support. | ||
| 39 | // | ||
| 40 | var wixiplFile = Path.Combine(intermediateFolder, "test.wixipl"); | ||
| 41 | intermediate.Save(wixiplFile); | ||
| 42 | |||
| 43 | intermediate = Intermediate.Load(wixiplFile); | ||
| 44 | |||
| 45 | // Dump to text for easy diffing, with some massaging to keep v3 and v4 diffable. | ||
| 46 | // | ||
| 47 | var tables = output.Tables.Cast<Wix3.Table>(); | ||
| 48 | var wix3Dump = tables | ||
| 49 | .SelectMany(table => table.Rows.Cast<Wix3.Row>() | ||
| 50 | .Select(row => RowToString(row))) | ||
| 51 | .ToArray(); | ||
| 52 | |||
| 53 | var tuples = intermediate.Sections.SelectMany(s => s.Tuples); | ||
| 54 | var wix4Dump = tuples.Select(tuple => TupleToString(tuple)).ToArray(); | ||
| 55 | |||
| 56 | Assert.Equal(wix3Dump, wix4Dump); | ||
| 57 | |||
| 58 | // Useful when you want to diff the outputs with another diff tool... | ||
| 59 | // | ||
| 60 | //var wix3TextDump = String.Join(Environment.NewLine, wix3Dump.OrderBy(val => val)); | ||
| 61 | //var wix4TextDump = String.Join(Environment.NewLine, wix4Dump.OrderBy(val => val)); | ||
| 62 | //Assert.Equal(wix3TextDump, wix4TextDump); | ||
| 63 | } | ||
| 64 | } | ||
| 65 | |||
| 66 | private static string RowToString(Wix3.Row row) | ||
| 67 | { | ||
| 68 | var fields = String.Join(",", row.Fields.Select(field => field.Data?.ToString())); | ||
| 69 | |||
| 70 | // Massage output to match WiX v3 rows and v4 tuples. | ||
| 71 | // | ||
| 72 | switch (row.Table.Name) | ||
| 73 | { | ||
| 74 | case "File": | ||
| 75 | var fieldValues = row.Fields.Take(7).Select(field => field.Data?.ToString()).ToArray(); | ||
| 76 | if (fieldValues[3] == null) | ||
| 77 | { | ||
| 78 | // "Somebody" sometimes writes out a null field even when the column definition says | ||
| 79 | // it's non-nullable. Not naming names or anything. (SWID tags.) | ||
| 80 | fieldValues[3] = "0"; | ||
| 81 | } | ||
| 82 | fields = String.Join(",", fieldValues); | ||
| 83 | break; | ||
| 84 | case "WixFile": | ||
| 85 | fields = String.Join(",", row.Fields.Take(8).Select(field => field.Data?.ToString())); | ||
| 86 | break; | ||
| 87 | } | ||
| 88 | |||
| 89 | return $"{row.Table.Name},{fields}"; | ||
| 90 | } | ||
| 91 | |||
| 92 | private static string TupleToString(WixToolset.Data.IntermediateTuple tuple) | ||
| 93 | { | ||
| 94 | var fields = String.Join(",", tuple.Fields.Select(field => field?.AsString())); | ||
| 95 | |||
| 96 | switch (tuple.Definition.Name) | ||
| 97 | { | ||
| 98 | // Massage output to match WiX v3 rows and v4 tuples. | ||
| 99 | // | ||
| 100 | case "Component": | ||
| 101 | { | ||
| 102 | var componentTuple = (ComponentTuple)tuple; | ||
| 103 | var attributes = ComponentLocation.Either == componentTuple.Location ? WindowsInstallerConstants.MsidbComponentAttributesOptional : 0; | ||
| 104 | attributes |= ComponentLocation.SourceOnly == componentTuple.Location ? WindowsInstallerConstants.MsidbComponentAttributesSourceOnly : 0; | ||
| 105 | attributes |= ComponentKeyPathType.Registry == componentTuple.KeyPathType ? WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath : 0; | ||
| 106 | attributes |= ComponentKeyPathType.OdbcDataSource == componentTuple.KeyPathType ? WindowsInstallerConstants.MsidbComponentAttributesODBCDataSource : 0; | ||
| 107 | attributes |= componentTuple.DisableRegistryReflection ? WindowsInstallerConstants.MsidbComponentAttributesDisableRegistryReflection : 0; | ||
| 108 | attributes |= componentTuple.NeverOverwrite ? WindowsInstallerConstants.MsidbComponentAttributesNeverOverwrite : 0; | ||
| 109 | attributes |= componentTuple.Permanent ? WindowsInstallerConstants.MsidbComponentAttributesPermanent : 0; | ||
| 110 | attributes |= componentTuple.SharedDllRefCount ? WindowsInstallerConstants.MsidbComponentAttributesSharedDllRefCount : 0; | ||
| 111 | attributes |= componentTuple.Shared ? WindowsInstallerConstants.MsidbComponentAttributesShared : 0; | ||
| 112 | attributes |= componentTuple.Transitive ? WindowsInstallerConstants.MsidbComponentAttributesTransitive : 0; | ||
| 113 | attributes |= componentTuple.UninstallWhenSuperseded ? WindowsInstallerConstants.MsidbComponentAttributes64bit : 0; | ||
| 114 | attributes |= componentTuple.Win64 ? WindowsInstallerConstants.MsidbComponentAttributes64bit : 0; | ||
| 115 | |||
| 116 | fields = String.Join(",", | ||
| 117 | componentTuple.ComponentId, | ||
| 118 | componentTuple.Directory_, | ||
| 119 | attributes.ToString(), | ||
| 120 | componentTuple.Condition, | ||
| 121 | componentTuple.KeyPath | ||
| 122 | ); | ||
| 123 | break; | ||
| 124 | } | ||
| 125 | case "CustomAction": | ||
| 126 | { | ||
| 127 | var customActionTuple = (CustomActionTuple)tuple; | ||
| 128 | var type = customActionTuple.Win64 ? WindowsInstallerConstants.MsidbCustomActionType64BitScript : 0; | ||
| 129 | type |= customActionTuple.TSAware ? WindowsInstallerConstants.MsidbCustomActionTypeTSAware : 0; | ||
| 130 | type |= customActionTuple.Impersonate ? 0 : WindowsInstallerConstants.MsidbCustomActionTypeNoImpersonate; | ||
| 131 | type |= customActionTuple.IgnoreResult ? WindowsInstallerConstants.MsidbCustomActionTypeContinue : 0; | ||
| 132 | type |= customActionTuple.Hidden ? WindowsInstallerConstants.MsidbCustomActionTypeHideTarget : 0; | ||
| 133 | type |= customActionTuple.Async ? WindowsInstallerConstants.MsidbCustomActionTypeAsync : 0; | ||
| 134 | type |= CustomActionExecutionType.FirstSequence == customActionTuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeFirstSequence : 0; | ||
| 135 | type |= CustomActionExecutionType.OncePerProcess == customActionTuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeOncePerProcess : 0; | ||
| 136 | type |= CustomActionExecutionType.ClientRepeat == customActionTuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeClientRepeat : 0; | ||
| 137 | type |= CustomActionExecutionType.Deferred == customActionTuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeInScript : 0; | ||
| 138 | type |= CustomActionExecutionType.Rollback == customActionTuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeInScript | WindowsInstallerConstants.MsidbCustomActionTypeRollback : 0; | ||
| 139 | type |= CustomActionExecutionType.Commit == customActionTuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeInScript | WindowsInstallerConstants.MsidbCustomActionTypeCommit : 0; | ||
| 140 | type |= CustomActionSourceType.File == customActionTuple.SourceType ? WindowsInstallerConstants.MsidbCustomActionTypeSourceFile : 0; | ||
| 141 | type |= CustomActionSourceType.Directory == customActionTuple.SourceType ? WindowsInstallerConstants.MsidbCustomActionTypeDirectory : 0; | ||
| 142 | type |= CustomActionSourceType.Property == customActionTuple.SourceType ? WindowsInstallerConstants.MsidbCustomActionTypeProperty : 0; | ||
| 143 | type |= CustomActionTargetType.Dll == customActionTuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeDll : 0; | ||
| 144 | type |= CustomActionTargetType.Exe == customActionTuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeExe : 0; | ||
| 145 | type |= CustomActionTargetType.TextData == customActionTuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeTextData : 0; | ||
| 146 | type |= CustomActionTargetType.JScript == customActionTuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeJScript : 0; | ||
| 147 | type |= CustomActionTargetType.VBScript == customActionTuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeVBScript : 0; | ||
| 148 | |||
| 149 | fields = String.Join(",", | ||
| 150 | type.ToString(), | ||
| 151 | customActionTuple.Source, | ||
| 152 | customActionTuple.Target, | ||
| 153 | customActionTuple.PatchUninstall ? WindowsInstallerConstants.MsidbCustomActionTypePatchUninstall.ToString() : null | ||
| 154 | ); | ||
| 155 | break; | ||
| 156 | } | ||
| 157 | case "Feature": | ||
| 158 | { | ||
| 159 | var featureTuple = (FeatureTuple)tuple; | ||
| 160 | var attributes = featureTuple.DisallowAbsent ? WindowsInstallerConstants.MsidbFeatureAttributesUIDisallowAbsent : 0; | ||
| 161 | attributes |= featureTuple.DisallowAdvertise ? WindowsInstallerConstants.MsidbFeatureAttributesDisallowAdvertise : 0; | ||
| 162 | attributes |= FeatureInstallDefault.FollowParent == featureTuple.InstallDefault ? WindowsInstallerConstants.MsidbFeatureAttributesFollowParent : 0; | ||
| 163 | attributes |= FeatureInstallDefault.Source == featureTuple.InstallDefault ? WindowsInstallerConstants.MsidbFeatureAttributesFavorSource : 0; | ||
| 164 | attributes |= FeatureTypicalDefault.Advertise == featureTuple.TypicalDefault ? WindowsInstallerConstants.MsidbFeatureAttributesFavorAdvertise : 0; | ||
| 165 | |||
| 166 | fields = String.Join(",", | ||
| 167 | featureTuple.Feature_Parent, | ||
| 168 | featureTuple.Title, | ||
| 169 | featureTuple.Description, | ||
| 170 | featureTuple.Display.ToString(), | ||
| 171 | featureTuple.Level.ToString(), | ||
| 172 | featureTuple.Directory_, | ||
| 173 | attributes.ToString()); | ||
| 174 | break; | ||
| 175 | } | ||
| 176 | case "File": | ||
| 177 | { | ||
| 178 | var fileTuple = (FileTuple)tuple; | ||
| 179 | fields = String.Join(",", | ||
| 180 | fileTuple.Component_, | ||
| 181 | fileTuple.LongFileName, | ||
| 182 | fileTuple.FileSize.ToString(), | ||
| 183 | fileTuple.Version, | ||
| 184 | fileTuple.Language, | ||
| 185 | ((fileTuple.ReadOnly ? WindowsInstallerConstants.MsidbFileAttributesReadOnly : 0) | ||
| 186 | | (fileTuple.Hidden ? WindowsInstallerConstants.MsidbFileAttributesHidden : 0) | ||
| 187 | | (fileTuple.System ? WindowsInstallerConstants.MsidbFileAttributesSystem : 0) | ||
| 188 | | (fileTuple.Vital ? WindowsInstallerConstants.MsidbFileAttributesVital : 0) | ||
| 189 | | (fileTuple.Checksum ? WindowsInstallerConstants.MsidbFileAttributesChecksum : 0) | ||
| 190 | | ((fileTuple.Compressed.HasValue && fileTuple.Compressed.Value) ? WindowsInstallerConstants.MsidbFileAttributesCompressed : 0) | ||
| 191 | | ((fileTuple.Compressed.HasValue && !fileTuple.Compressed.Value) ? WindowsInstallerConstants.MsidbFileAttributesNoncompressed : 0)) | ||
| 192 | .ToString()); | ||
| 193 | break; | ||
| 194 | } | ||
| 195 | |||
| 196 | case "Registry": | ||
| 197 | { | ||
| 198 | var registryTuple = (RegistryTuple)tuple; | ||
| 199 | var value = registryTuple.Value; | ||
| 200 | |||
| 201 | switch (registryTuple.ValueType) | ||
| 202 | { | ||
| 203 | case RegistryValueType.Binary: | ||
| 204 | value = String.Concat("#x", value); | ||
| 205 | break; | ||
| 206 | case RegistryValueType.Expandable: | ||
| 207 | value = String.Concat("#%", value); | ||
| 208 | break; | ||
| 209 | case RegistryValueType.Integer: | ||
| 210 | value = String.Concat("#", value); | ||
| 211 | break; | ||
| 212 | case RegistryValueType.MultiString: | ||
| 213 | switch (registryTuple.ValueAction) | ||
| 214 | { | ||
| 215 | case RegistryValueActionType.Append: | ||
| 216 | value = String.Concat("[~]", value); | ||
| 217 | break; | ||
| 218 | case RegistryValueActionType.Prepend: | ||
| 219 | value = String.Concat(value, "[~]"); | ||
| 220 | break; | ||
| 221 | case RegistryValueActionType.Write: | ||
| 222 | default: | ||
| 223 | if (null != value && -1 == value.IndexOf("[~]", StringComparison.Ordinal)) | ||
| 224 | { | ||
| 225 | value = String.Concat("[~]", value, "[~]"); | ||
| 226 | } | ||
| 227 | break; | ||
| 228 | } | ||
| 229 | break; | ||
| 230 | case RegistryValueType.String: | ||
| 231 | // escape the leading '#' character for string registry keys | ||
| 232 | if (null != value && value.StartsWith("#", StringComparison.Ordinal)) | ||
| 233 | { | ||
| 234 | value = String.Concat("#", value); | ||
| 235 | } | ||
| 236 | break; | ||
| 237 | } | ||
| 238 | |||
| 239 | fields = String.Join(",", | ||
| 240 | ((int)registryTuple.Root).ToString(), | ||
| 241 | registryTuple.Key, | ||
| 242 | registryTuple.Name, | ||
| 243 | value, | ||
| 244 | registryTuple.Component_ | ||
| 245 | ); | ||
| 246 | break; | ||
| 247 | } | ||
| 248 | |||
| 249 | case "RemoveRegistry": | ||
| 250 | { | ||
| 251 | var removeRegistryTuple = (RemoveRegistryTuple)tuple; | ||
| 252 | fields = String.Join(",", | ||
| 253 | ((int)removeRegistryTuple.Root).ToString(), | ||
| 254 | removeRegistryTuple.Key, | ||
| 255 | removeRegistryTuple.Name, | ||
| 256 | removeRegistryTuple.Component_ | ||
| 257 | ); | ||
| 258 | break; | ||
| 259 | } | ||
| 260 | |||
| 261 | case "ServiceControl": | ||
| 262 | { | ||
| 263 | var serviceControlTuple = (ServiceControlTuple)tuple; | ||
| 264 | |||
| 265 | var events = serviceControlTuple.InstallRemove ? WindowsInstallerConstants.MsidbServiceControlEventDelete : 0; | ||
| 266 | events |= serviceControlTuple.UninstallRemove ? WindowsInstallerConstants.MsidbServiceControlEventUninstallDelete : 0; | ||
| 267 | events |= serviceControlTuple.InstallStart ? WindowsInstallerConstants.MsidbServiceControlEventStart : 0; | ||
| 268 | events |= serviceControlTuple.UninstallStart ? WindowsInstallerConstants.MsidbServiceControlEventUninstallStart : 0; | ||
| 269 | events |= serviceControlTuple.InstallStop ? WindowsInstallerConstants.MsidbServiceControlEventStop : 0; | ||
| 270 | events |= serviceControlTuple.UninstallStop ? WindowsInstallerConstants.MsidbServiceControlEventUninstallStop : 0; | ||
| 271 | |||
| 272 | fields = String.Join(",", | ||
| 273 | serviceControlTuple.Name, | ||
| 274 | events.ToString(), | ||
| 275 | serviceControlTuple.Arguments, | ||
| 276 | serviceControlTuple.Wait == true ? "1" : "0", | ||
| 277 | serviceControlTuple.Component_ | ||
| 278 | ); | ||
| 279 | break; | ||
| 280 | } | ||
| 281 | |||
| 282 | case "ServiceInstall": | ||
| 283 | { | ||
| 284 | var serviceInstallTuple = (ServiceInstallTuple)tuple; | ||
| 285 | |||
| 286 | var errorControl = (int)serviceInstallTuple.ErrorControl; | ||
| 287 | errorControl |= serviceInstallTuple.Vital ? WindowsInstallerConstants.MsidbServiceInstallErrorControlVital : 0; | ||
| 288 | |||
| 289 | var serviceType = (int)serviceInstallTuple.ServiceType; | ||
| 290 | serviceType |= serviceInstallTuple.Interactive ? WindowsInstallerConstants.MsidbServiceInstallInteractive : 0; | ||
| 291 | |||
| 292 | fields = String.Join(",", | ||
| 293 | serviceInstallTuple.Name, | ||
| 294 | serviceInstallTuple.DisplayName, | ||
| 295 | serviceType.ToString(), | ||
| 296 | ((int)serviceInstallTuple.StartType).ToString(), | ||
| 297 | errorControl.ToString(), | ||
| 298 | serviceInstallTuple.LoadOrderGroup, | ||
| 299 | serviceInstallTuple.Dependencies, | ||
| 300 | serviceInstallTuple.StartName, | ||
| 301 | serviceInstallTuple.Password, | ||
| 302 | serviceInstallTuple.Arguments, | ||
| 303 | serviceInstallTuple.Component_, | ||
| 304 | serviceInstallTuple.Description | ||
| 305 | ); | ||
| 306 | break; | ||
| 307 | } | ||
| 308 | |||
| 309 | case "Upgrade": | ||
| 310 | { | ||
| 311 | var upgradeTuple = (UpgradeTuple)tuple; | ||
| 312 | |||
| 313 | var attributes = upgradeTuple.MigrateFeatures ? WindowsInstallerConstants.MsidbUpgradeAttributesMigrateFeatures : 0; | ||
| 314 | attributes |= upgradeTuple.OnlyDetect ? WindowsInstallerConstants.MsidbUpgradeAttributesOnlyDetect : 0; | ||
| 315 | attributes |= upgradeTuple.IgnoreRemoveFailures ? WindowsInstallerConstants.MsidbUpgradeAttributesIgnoreRemoveFailure : 0; | ||
| 316 | attributes |= upgradeTuple.VersionMinInclusive ? WindowsInstallerConstants.MsidbUpgradeAttributesVersionMinInclusive : 0; | ||
| 317 | attributes |= upgradeTuple.VersionMaxInclusive ? WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive : 0; | ||
| 318 | attributes |= upgradeTuple.ExcludeLanguages ? WindowsInstallerConstants.MsidbUpgradeAttributesLanguagesExclusive : 0; | ||
| 319 | |||
| 320 | fields = String.Join(",", | ||
| 321 | upgradeTuple.VersionMin, | ||
| 322 | upgradeTuple.VersionMax, | ||
| 323 | upgradeTuple.Language, | ||
| 324 | attributes.ToString(), | ||
| 325 | upgradeTuple.Remove, | ||
| 326 | upgradeTuple.ActionProperty | ||
| 327 | ); | ||
| 328 | break; | ||
| 329 | } | ||
| 330 | |||
| 331 | case "WixAction": | ||
| 332 | { | ||
| 333 | var wixActionTuple = (WixActionTuple)tuple; | ||
| 334 | fields = String.Join(",", | ||
| 335 | wixActionTuple.SequenceTable, | ||
| 336 | wixActionTuple.Action, | ||
| 337 | wixActionTuple.Condition, | ||
| 338 | // BUGBUGBUG: AB#2626 | ||
| 339 | wixActionTuple.Sequence == 0 ? String.Empty : wixActionTuple.Sequence.ToString(), | ||
| 340 | wixActionTuple.Before, | ||
| 341 | wixActionTuple.After, | ||
| 342 | wixActionTuple.Overridable == true ? "1" : "0" | ||
| 343 | ); | ||
| 344 | break; | ||
| 345 | } | ||
| 346 | |||
| 347 | case "WixComplexReference": | ||
| 348 | { | ||
| 349 | var wixComplexReferenceTuple = (WixComplexReferenceTuple)tuple; | ||
| 350 | fields = String.Join(",", | ||
| 351 | wixComplexReferenceTuple.Parent, | ||
| 352 | ((int)wixComplexReferenceTuple.ParentType).ToString(), | ||
| 353 | wixComplexReferenceTuple.ParentLanguage, | ||
| 354 | wixComplexReferenceTuple.Child, | ||
| 355 | ((int)wixComplexReferenceTuple.ChildType).ToString(), | ||
| 356 | wixComplexReferenceTuple.IsPrimary ? "1" : "0" | ||
| 357 | ); | ||
| 358 | break; | ||
| 359 | } | ||
| 360 | |||
| 361 | case "WixFile": | ||
| 362 | { | ||
| 363 | var wixFileTuple = (WixFileTuple)tuple; | ||
| 364 | fields = String.Concat( | ||
| 365 | wixFileTuple.AssemblyType == FileAssemblyType.DotNetAssembly ? "0" : wixFileTuple.AssemblyType == FileAssemblyType.Win32Assembly ? "1" : String.Empty, ",", | ||
| 366 | String.Join(",", tuple.Fields.Skip(2).Take(6).Select(field => (string)field).ToArray())); | ||
| 367 | break; | ||
| 368 | } | ||
| 369 | |||
| 370 | case "WixProperty": | ||
| 371 | { | ||
| 372 | var wixPropertyTuple = (WixPropertyTuple)tuple; | ||
| 373 | var attributes = 0; | ||
| 374 | attributes |= wixPropertyTuple.Admin ? 0x1 : 0; | ||
| 375 | attributes |= wixPropertyTuple.Hidden ? 0x2 : 0; | ||
| 376 | attributes |= wixPropertyTuple.Secure ? 0x4 : 0; | ||
| 377 | |||
| 378 | fields = String.Join(",", | ||
| 379 | wixPropertyTuple.Property_, | ||
| 380 | attributes.ToString() | ||
| 381 | ); | ||
| 382 | break; | ||
| 383 | } | ||
| 384 | |||
| 385 | } | ||
| 386 | |||
| 387 | var id = tuple.Id == null ? String.Empty : String.Concat(",", tuple.Id.Id); | ||
| 388 | return $"{tuple.Definition.Name}{id},{fields}"; | ||
| 389 | } | ||
| 390 | } | ||
| 391 | } | ||
