@joebigelow / wix-1 / commits / 221da62c

Reintegrate MSI constructs into WxToolset.Data.WindowsInstaller namespace

Rob Mensching committed Dec 7, 2017 at 14:17 UTC 221da62c05ef2b515eb507c77655514cd0ec32a4
62 files changed +8105
src/WixToolset.Data/WindowsInstaller/ColumnCategory.cs new
+91
@@ -0,0 +1,91 @@
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.Data.WindowsInstaller
4 +{
5 + /// <summary>
6 + /// Column validation category type
7 + /// </summary>
8 + public enum ColumnCategory
9 + {
10 + /// <summary>Unknown category, default and invalid.</summary>
11 + Unknown,
12 +
13 + /// <summary>Text category.</summary>
14 + Text,
15 +
16 + /// <summary>UpperCase category.</summary>
17 + UpperCase,
18 +
19 + /// <summary>LowerCase category.</summary>
20 + LowerCase,
21 +
22 + /// <summary>Integer category.</summary>
23 + Integer,
24 +
25 + /// <summary>DoubleInteger category.</summary>
26 + DoubleInteger,
27 +
28 + /// <summary>TimeDate category.</summary>
29 + TimeDate,
30 +
31 + /// <summary>Identifier category.</summary>
32 + Identifier,
33 +
34 + /// <summary>Property category.</summary>
35 + Property,
36 +
37 + /// <summary>Filename category.</summary>
38 + Filename,
39 +
40 + /// <summary>WildCardFilename category.</summary>
41 + WildCardFilename,
42 +
43 + /// <summary>Path category.</summary>
44 + Path,
45 +
46 + /// <summary>Paths category.</summary>
47 + Paths,
48 +
49 + /// <summary>AnyPath category.</summary>
50 + AnyPath,
51 +
52 + /// <summary>DefaultDir category.</summary>
53 + DefaultDir,
54 +
55 + /// <summary>RegPath category.</summary>
56 + RegPath,
57 +
58 + /// <summary>Formatted category.</summary>
59 + Formatted,
60 +
61 + /// <summary>Template category.</summary>
62 + Template,
63 +
64 + /// <summary>Condition category.</summary>
65 + Condition,
66 +
67 + /// <summary>Guid category.</summary>
68 + Guid,
69 +
70 + /// <summary>Version category.</summary>
71 + Version,
72 +
73 + /// <summary>Language category.</summary>
74 + Language,
75 +
76 + /// <summary>Binary category.</summary>
77 + Binary,
78 +
79 + /// <summary>CustomSource category.</summary>
80 + CustomSource,
81 +
82 + /// <summary>Cabinet category.</summary>
83 + Cabinet,
84 +
85 + /// <summary>Shortcut category.</summary>
86 + Shortcut,
87 +
88 + /// <summary>Formatted SDDL category.</summary>
89 + FormattedSDDLText,
90 + }
91 +}
src/WixToolset.Data/WindowsInstaller/ColumnDefinition.cs new
+685
@@ -0,0 +1,685 @@
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.Data.WindowsInstaller
4 +{
5 + using System;
6 + using System.Globalization;
7 + using System.Xml;
8 +
9 + /// <summary>
10 + /// Definition of a table's column.
11 + /// </summary>
12 + public sealed class ColumnDefinition : IComparable<ColumnDefinition>
13 + {
14 + /// <summary>
15 + /// Creates a new column definition.
16 + /// </summary>
17 + /// <param name="name">Name of column.</param>
18 + /// <param name="type">Type of column</param>
19 + /// <param name="length">Length of column.</param>
20 + /// <param name="primaryKey">If column is primary key.</param>
21 + /// <param name="nullable">If column is nullable.</param>
22 + /// <param name="category">Validation category for column.</param>
23 + /// <param name="minValue">Optional minimum value for the column.</param>
24 + /// <param name="maxValue">Optional maximum value for the colum.</param>
25 + /// <param name="keyTable">Optional name of table for foreign key.</param>
26 + /// <param name="keyColumn">Optional name of column for foreign key.</param>
27 + /// <param name="possibilities">Set of possible values for column.</param>
28 + /// <param name="description">Description of column in vaidation table.</param>
29 + /// <param name="modularizeType">Type of modularization for column</param>
30 + /// <param name="forceLocalizable">If the column is localizable.</param>
31 + /// <param name="useCData">If whitespace should be preserved in a CDATA node.</param>
32 + public ColumnDefinition(string name, ColumnType type, int length, bool primaryKey, bool nullable, ColumnCategory category, long? minValue = null, long? maxValue = null, string keyTable = null, int? keyColumn = null, string possibilities = null, string description = null, ColumnModularizeType? modularizeType = null, bool forceLocalizable = false, bool useCData = false)
33 + {
34 + this.Name = name;
35 + this.Type = type;
36 + this.Length = length;
37 + this.PrimaryKey = primaryKey;
38 + this.Nullable = nullable;
39 + this.ModularizeType = CalculateModularizationType(modularizeType, category);
40 + this.IsLocalizable = forceLocalizable || ColumnType.Localized == type;
41 + this.MinValue = minValue;
42 + this.MaxValue = maxValue;
43 + this.KeyTable = keyTable;
44 + this.KeyColumn = keyColumn;
45 + this.Category = category;
46 + this.Possibilities = possibilities;
47 + this.Description = description;
48 + this.UseCData = useCData;
49 + }
50 +
51 + /// <summary>
52 + /// Gets whether this column was added via a transform.
53 + /// </summary>
54 + /// <value>Whether this column was added via a transform.</value>
55 + public bool Added { get; set; }
56 +
57 + /// <summary>
58 + /// Gets the name of the column.
59 + /// </summary>
60 + /// <value>Name of column.</value>
61 + public string Name { get; }
62 +
63 + /// <summary>
64 + /// Gets the type of the column.
65 + /// </summary>
66 + /// <value>Type of column.</value>
67 + public ColumnType Type { get; }
68 +
69 + /// <summary>
70 + /// Gets the length of the column.
71 + /// </summary>
72 + /// <value>Length of column.</value>
73 + public int Length { get; }
74 +
75 + /// <summary>
76 + /// Gets if the column is a primary key.
77 + /// </summary>
78 + /// <value>true if column is primary key.</value>
79 + public bool PrimaryKey { get; }
80 +
81 + /// <summary>
82 + /// Gets if the column is nullable.
83 + /// </summary>
84 + /// <value>true if column is nullable.</value>
85 + public bool Nullable { get; }
86 +
87 + /// <summary>
88 + /// Gets the type of modularization for this column.
89 + /// </summary>
90 + /// <value>Column's modularization type.</value>
91 + public ColumnModularizeType ModularizeType { get; }
92 +
93 + /// <summary>
94 + /// Gets if the column is localizable. Can be because the type is localizable, or because the column
95 + /// was explicitly set to be so.
96 + /// </summary>
97 + /// <value>true if column is localizable.</value>
98 + public bool IsLocalizable { get; }
99 +
100 + /// <summary>
101 + /// Gets the minimum value for the column.
102 + /// </summary>
103 + /// <value>Minimum value for the column.</value>
104 + public long? MinValue { get; }
105 +
106 + /// <summary>
107 + /// Gets the maximum value for the column.
108 + /// </summary>
109 + /// <value>Maximum value for the column.</value>
110 + public long? MaxValue { get; }
111 +
112 + /// <summary>
113 + /// Gets the table that has the foreign key for this column
114 + /// </summary>
115 + /// <value>Foreign key table name.</value>
116 + public string KeyTable { get; }
117 +
118 + /// <summary>
119 + /// Gets the foreign key column that this column refers to.
120 + /// </summary>
121 + /// <value>Foreign key column.</value>
122 + public int? KeyColumn { get; }
123 +
124 + /// <summary>
125 + /// Gets the validation category for this column.
126 + /// </summary>
127 + /// <value>Validation category.</value>
128 + public ColumnCategory Category { get; }
129 +
130 + /// <summary>
131 + /// Gets the set of possibilities for this column.
132 + /// </summary>
133 + /// <value>Set of possibilities for this column.</value>
134 + public string Possibilities { get; }
135 +
136 + /// <summary>
137 + /// Gets the description for this column.
138 + /// </summary>
139 + /// <value>Description of column.</value>
140 + public string Description { get; }
141 +
142 + /// <summary>
143 + /// Gets if whitespace should be preserved in a CDATA node.
144 + /// </summary>
145 + /// <value>true if whitespace should be preserved in a CDATA node.</value>
146 + public bool UseCData { get; }
147 +
148 + /// <summary>
149 + /// Parses a column definition in a table definition.
150 + /// </summary>
151 + /// <param name="reader">Reader to get data from.</param>
152 + /// <returns>The ColumnDefintion represented by the Xml.</returns>
153 + internal static ColumnDefinition Read(XmlReader reader)
154 + {
155 + if (!reader.LocalName.Equals("columnDefinition"))
156 + {
157 + throw new XmlException();
158 + }
159 +
160 + bool added = false;
161 + ColumnCategory category = ColumnCategory.Unknown;
162 + string description = null;
163 + bool empty = reader.IsEmptyElement;
164 + int? keyColumn = null;
165 + string keyTable = null;
166 + int length = -1;
167 + bool localizable = false;
168 + long? maxValue = null;
169 + long? minValue = null;
170 + var modularize = ColumnModularizeType.None;
171 + string name = null;
172 + bool nullable = false;
173 + string possibilities = null;
174 + bool primaryKey = false;
175 + var type = ColumnType.Unknown;
176 + bool useCData = false;
177 +
178 + // parse the attributes
179 + while (reader.MoveToNextAttribute())
180 + {
181 + switch (reader.LocalName)
182 + {
183 + case "added":
184 + added = reader.Value.Equals("yes");
185 + break;
186 + case "category":
187 + switch (reader.Value)
188 + {
189 + case "anyPath":
190 + category = ColumnCategory.AnyPath;
191 + break;
192 + case "binary":
193 + category = ColumnCategory.Binary;
194 + break;
195 + case "cabinet":
196 + category = ColumnCategory.Cabinet;
197 + break;
198 + case "condition":
199 + category = ColumnCategory.Condition;
200 + break;
201 + case "customSource":
202 + category = ColumnCategory.CustomSource;
203 + break;
204 + case "defaultDir":
205 + category = ColumnCategory.DefaultDir;
206 + break;
207 + case "doubleInteger":
208 + category = ColumnCategory.DoubleInteger;
209 + break;
210 + case "filename":
211 + category = ColumnCategory.Filename;
212 + break;
213 + case "formatted":
214 + category = ColumnCategory.Formatted;
215 + break;
216 + case "formattedSddl":
217 + category = ColumnCategory.FormattedSDDLText;
218 + break;
219 + case "guid":
220 + category = ColumnCategory.Guid;
221 + break;
222 + case "identifier":
223 + category = ColumnCategory.Identifier;
224 + break;
225 + case "integer":
226 + category = ColumnCategory.Integer;
227 + break;
228 + case "language":
229 + category = ColumnCategory.Language;
230 + break;
231 + case "lowerCase":
232 + category = ColumnCategory.LowerCase;
233 + break;
234 + case "path":
235 + category = ColumnCategory.Path;
236 + break;
237 + case "paths":
238 + category = ColumnCategory.Paths;
239 + break;
240 + case "property":
241 + category = ColumnCategory.Property;
242 + break;
243 + case "regPath":
244 + category = ColumnCategory.RegPath;
245 + break;
246 + case "shortcut":
247 + category = ColumnCategory.Shortcut;
248 + break;
249 + case "template":
250 + category = ColumnCategory.Template;
251 + break;
252 + case "text":
253 + category = ColumnCategory.Text;
254 + break;
255 + case "timeDate":
256 + category = ColumnCategory.TimeDate;
257 + break;
258 + case "upperCase":
259 + category = ColumnCategory.UpperCase;
260 + break;
261 + case "version":
262 + category = ColumnCategory.Version;
263 + break;
264 + case "wildCardFilename":
265 + category = ColumnCategory.WildCardFilename;
266 + break;
267 + default:
268 + throw new InvalidOperationException();
269 + }
270 + break;
271 + case "description":
272 + description = reader.Value;
273 + break;
274 + case "keyColumn":
275 + keyColumn = Convert.ToInt32(reader.Value, 10);
276 + break;
277 + case "keyTable":
278 + keyTable = reader.Value;
279 + break;
280 + case "length":
281 + length = Convert.ToInt32(reader.Value, 10);
282 + break;
283 + case "localizable":
284 + localizable = reader.Value.Equals("yes");
285 + break;
286 + case "maxValue":
287 + maxValue = Convert.ToInt32(reader.Value, 10);
288 + break;
289 + case "minValue":
290 + minValue = Convert.ToInt32(reader.Value, 10);
291 + break;
292 + case "modularize":
293 + switch (reader.Value)
294 + {
295 + case "column":
296 + modularize = ColumnModularizeType.Column;
297 + break;
298 + case "companionFile":
299 + modularize = ColumnModularizeType.CompanionFile;
300 + break;
301 + case "condition":
302 + modularize = ColumnModularizeType.Condition;
303 + break;
304 + case "controlEventArgument":
305 + modularize = ColumnModularizeType.ControlEventArgument;
306 + break;
307 + case "controlText":
308 + modularize = ColumnModularizeType.ControlText;
309 + break;
310 + case "icon":
311 + modularize = ColumnModularizeType.Icon;
312 + break;
313 + case "none":
314 + modularize = ColumnModularizeType.None;
315 + break;
316 + case "property":
317 + modularize = ColumnModularizeType.Property;
318 + break;
319 + case "semicolonDelimited":
320 + modularize = ColumnModularizeType.SemicolonDelimited;
321 + break;
322 + default:
323 + throw new XmlException();
324 + }
325 + break;
326 + case "name":
327 + switch (reader.Value)
328 + {
329 + case "CREATE":
330 + case "DELETE":
331 + case "DROP":
332 + case "INSERT":
333 + throw new XmlException();
334 + default:
335 + name = reader.Value;
336 + break;
337 + }
338 + break;
339 + case "nullable":
340 + nullable = reader.Value.Equals("yes");
341 + break;
342 + case "primaryKey":
343 + primaryKey = reader.Value.Equals("yes");
344 + break;
345 + case "set":
346 + possibilities = reader.Value;
347 + break;
348 + case "type":
349 + switch (reader.Value)
350 + {
351 + case "localized":
352 + type = ColumnType.Localized;
353 + break;
354 + case "number":
355 + type = ColumnType.Number;
356 + break;
357 + case "object":
358 + type = ColumnType.Object;
359 + break;
360 + case "string":
361 + type = ColumnType.String;
362 + break;
363 + case "preserved":
364 + type = ColumnType.Preserved;
365 + break;
366 + default:
367 + throw new XmlException();
368 + }
369 + break;
370 + case "useCData":
371 + useCData = reader.Value.Equals("yes");
372 + break;
373 + }
374 + }
375 +
376 + // parse the child elements (there should be none)
377 + if (!empty)
378 + {
379 + bool done = false;
380 +
381 + while (!done && reader.Read())
382 + {
383 + switch (reader.NodeType)
384 + {
385 + case XmlNodeType.Element:
386 + throw new XmlException();
387 + case XmlNodeType.EndElement:
388 + done = true;
389 + break;
390 + }
391 + }
392 +
393 + if (!done)
394 + {
395 + throw new XmlException();
396 + }
397 + }
398 +
399 + ColumnDefinition columnDefinition = new ColumnDefinition(name, type, length, primaryKey, nullable, category, minValue, maxValue, keyTable, keyColumn, possibilities, description, modularize, localizable, useCData);
400 + columnDefinition.Added = added;
401 +
402 + return columnDefinition;
403 + }
404 +
405 + /// <summary>
406 + /// Persists a ColumnDefinition in an XML format.
407 + /// </summary>
408 + /// <param name="writer">XmlWriter where the Output should persist itself as XML.</param>
409 + internal void Write(XmlWriter writer)
410 + {
411 + writer.WriteStartElement("columnDefinition", TableDefinitionCollection.XmlNamespaceUri);
412 +
413 + writer.WriteAttributeString("name", this.Name);
414 +
415 + switch (this.Type)
416 + {
417 + case ColumnType.Localized:
418 + writer.WriteAttributeString("type", "localized");
419 + break;
420 + case ColumnType.Number:
421 + writer.WriteAttributeString("type", "number");
422 + break;
423 + case ColumnType.Object:
424 + writer.WriteAttributeString("type", "object");
425 + break;
426 + case ColumnType.String:
427 + writer.WriteAttributeString("type", "string");
428 + break;
429 + case ColumnType.Preserved:
430 + writer.WriteAttributeString("type", "preserved");
431 + break;
432 + }
433 +
434 + writer.WriteAttributeString("length", this.Length.ToString(CultureInfo.InvariantCulture.NumberFormat));
435 +
436 + if (this.PrimaryKey)
437 + {
438 + writer.WriteAttributeString("primaryKey", "yes");
439 + }
440 +
441 + if (this.Nullable)
442 + {
443 + writer.WriteAttributeString("nullable", "yes");
444 + }
445 +
446 + if (this.IsLocalizable)
447 + {
448 + writer.WriteAttributeString("localizable", "yes");
449 + }
450 +
451 + if (this.Added)
452 + {
453 + writer.WriteAttributeString("added", "yes");
454 + }
455 +
456 + switch (this.ModularizeType)
457 + {
458 + case ColumnModularizeType.Column:
459 + writer.WriteAttributeString("modularize", "column");
460 + break;
461 + case ColumnModularizeType.CompanionFile:
462 + writer.WriteAttributeString("modularize", "companionFile");
463 + break;
464 + case ColumnModularizeType.Condition:
465 + writer.WriteAttributeString("modularize", "condition");
466 + break;
467 + case ColumnModularizeType.ControlEventArgument:
468 + writer.WriteAttributeString("modularize", "controlEventArgument");
469 + break;
470 + case ColumnModularizeType.ControlText:
471 + writer.WriteAttributeString("modularize", "controlText");
472 + break;
473 + case ColumnModularizeType.Icon:
474 + writer.WriteAttributeString("modularize", "icon");
475 + break;
476 + case ColumnModularizeType.None:
477 + // this is the default value
478 + break;
479 + case ColumnModularizeType.Property:
480 + writer.WriteAttributeString("modularize", "property");
481 + break;
482 + case ColumnModularizeType.SemicolonDelimited:
483 + writer.WriteAttributeString("modularize", "semicolonDelimited");
484 + break;
485 + }
486 +
487 + if (this.MinValue.HasValue)
488 + {
489 + writer.WriteAttributeString("minValue", this.MinValue.Value.ToString(CultureInfo.InvariantCulture.NumberFormat));
490 + }
491 +
492 + if (this.MaxValue.HasValue)
493 + {
494 + writer.WriteAttributeString("maxValue", this.MaxValue.Value.ToString(CultureInfo.InvariantCulture.NumberFormat));
495 + }
496 +
497 + if (!String.IsNullOrEmpty(this.KeyTable))
498 + {
499 + writer.WriteAttributeString("keyTable", this.KeyTable);
500 + }
501 +
502 + if (this.KeyColumn.HasValue)
503 + {
504 + writer.WriteAttributeString("keyColumn", this.KeyColumn.HasValue.ToString(CultureInfo.InvariantCulture.NumberFormat));
505 + }
506 +
507 + switch (this.Category)
508 + {
509 + case ColumnCategory.AnyPath:
510 + writer.WriteAttributeString("category", "anyPath");
511 + break;
512 + case ColumnCategory.Binary:
513 + writer.WriteAttributeString("category", "binary");
514 + break;
515 + case ColumnCategory.Cabinet:
516 + writer.WriteAttributeString("category", "cabinet");
517 + break;
518 + case ColumnCategory.Condition:
519 + writer.WriteAttributeString("category", "condition");
520 + break;
521 + case ColumnCategory.CustomSource:
522 + writer.WriteAttributeString("category", "customSource");
523 + break;
524 + case ColumnCategory.DefaultDir:
525 + writer.WriteAttributeString("category", "defaultDir");
526 + break;
527 + case ColumnCategory.DoubleInteger:
528 + writer.WriteAttributeString("category", "doubleInteger");
529 + break;
530 + case ColumnCategory.Filename:
531 + writer.WriteAttributeString("category", "filename");
532 + break;
533 + case ColumnCategory.Formatted:
534 + writer.WriteAttributeString("category", "formatted");
535 + break;
536 + case ColumnCategory.FormattedSDDLText:
537 + writer.WriteAttributeString("category", "formattedSddl");
538 + break;
539 + case ColumnCategory.Guid:
540 + writer.WriteAttributeString("category", "guid");
541 + break;
542 + case ColumnCategory.Identifier:
543 + writer.WriteAttributeString("category", "identifier");
544 + break;
545 + case ColumnCategory.Integer:
546 + writer.WriteAttributeString("category", "integer");
547 + break;
548 + case ColumnCategory.Language:
549 + writer.WriteAttributeString("category", "language");
550 + break;
551 + case ColumnCategory.LowerCase:
552 + writer.WriteAttributeString("category", "lowerCase");
553 + break;
554 + case ColumnCategory.Path:
555 + writer.WriteAttributeString("category", "path");
556 + break;
557 + case ColumnCategory.Paths:
558 + writer.WriteAttributeString("category", "paths");
559 + break;
560 + case ColumnCategory.Property:
561 + writer.WriteAttributeString("category", "property");
562 + break;
563 + case ColumnCategory.RegPath:
564 + writer.WriteAttributeString("category", "regPath");
565 + break;
566 + case ColumnCategory.Shortcut:
567 + writer.WriteAttributeString("category", "shortcut");
568 + break;
569 + case ColumnCategory.Template:
570 + writer.WriteAttributeString("category", "template");
571 + break;
572 + case ColumnCategory.Text:
573 + writer.WriteAttributeString("category", "text");
574 + break;
575 + case ColumnCategory.TimeDate:
576 + writer.WriteAttributeString("category", "timeDate");
577 + break;
578 + case ColumnCategory.UpperCase:
579 + writer.WriteAttributeString("category", "upperCase");
580 + break;
581 + case ColumnCategory.Version:
582 + writer.WriteAttributeString("category", "version");
583 + break;
584 + case ColumnCategory.WildCardFilename:
585 + writer.WriteAttributeString("category", "wildCardFilename");
586 + break;
587 + }
588 +
589 + if (!String.IsNullOrEmpty(this.Possibilities))
590 + {
591 + writer.WriteAttributeString("set", this.Possibilities);
592 + }
593 +
594 + if (!String.IsNullOrEmpty(this.Description))
595 + {
596 + writer.WriteAttributeString("description", this.Description);
597 + }
598 +
599 + if (this.UseCData)
600 + {
601 + writer.WriteAttributeString("useCData", "yes");
602 + }
603 +
604 + writer.WriteEndElement();
605 + }
606 +
607 + /// <summary>
608 + /// Compare this column definition to another column definition.
609 + /// </summary>
610 + /// <remarks>
611 + /// Only Windows Installer traits are compared, allowing for updates to WiX-specific table definitions.
612 + /// </remarks>
613 + /// <param name="other">The <see cref="ColumnDefinition"/> to compare with this one.</param>
614 + /// <returns>0 if the columns' core propeties are the same; otherwise, non-0.</returns>
615 + public int CompareTo(ColumnDefinition other)
616 + {
617 + // by definition, this object is greater than null
618 + if (null == other)
619 + {
620 + return 1;
621 + }
622 +
623 + // compare column names
624 + int ret = String.Compare(this.Name, other.Name, StringComparison.Ordinal);
625 +
626 + // compare column types
627 + if (0 == ret)
628 + {
629 + ret = this.Type == other.Type ? 0 : -1;
630 +
631 + // compare column lengths
632 + if (0 == ret)
633 + {
634 + ret = this.Length == other.Length ? 0 : -1;
635 +
636 + // compare whether both are primary keys
637 + if (0 == ret)
638 + {
639 + ret = this.PrimaryKey == other.PrimaryKey ? 0 : -1;
640 +
641 + // compare nullability
642 + if (0 == ret)
643 + {
644 + ret = this.Nullable == other.Nullable ? 0 : -1;
645 + }
646 + }
647 + }
648 + }
649 +
650 + return ret;
651 + }
652 +
653 + private static ColumnModularizeType CalculateModularizationType(ColumnModularizeType? modularizeType, ColumnCategory category)
654 + {
655 + if (modularizeType.HasValue)
656 + {
657 + return modularizeType.Value;
658 + }
659 +
660 + switch (category)
661 + {
662 + case ColumnCategory.Identifier:
663 + case ColumnCategory.CustomSource:
664 + return ColumnModularizeType.Column;
665 +
666 + case ColumnCategory.Condition:
667 + return ColumnModularizeType.Condition;
668 +
669 + case ColumnCategory.AnyPath:
670 + case ColumnCategory.Formatted:
671 + case ColumnCategory.FormattedSDDLText:
672 + case ColumnCategory.Path:
673 + case ColumnCategory.Paths:
674 + case ColumnCategory.RegPath:
675 + case ColumnCategory.Template:
676 + return ColumnModularizeType.Property;
677 +
678 + case ColumnCategory.Shortcut:
679 + return ColumnModularizeType.Property;
680 + }
681 +
682 + return ColumnModularizeType.None;
683 + }
684 + }
685 +}
src/WixToolset.Data/WindowsInstaller/ColumnModularizeType.cs new
+37
@@ -0,0 +1,37 @@
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.Data.WindowsInstaller
4 +{
5 + /// <summary>
6 + /// Specifies if the column should be modularized.
7 + /// </summary>
8 + public enum ColumnModularizeType
9 + {
10 + /// <summary>Column should not be modularized.</summary>
11 + None,
12 +
13 + /// <summary>Column should be modularized.</summary>
14 + Column,
15 +
16 + /// <summary>When the column is an primary or foreign key to the Icon table it should be modularized special.</summary>
17 + Icon,
18 +
19 + /// <summary>When the column is a companion file it should be modularized.</summary>
20 + CompanionFile,
21 +
22 + /// <summary>Column is a condition and should be modularized.</summary>
23 + Condition,
24 +
25 + /// <summary>Special modularization type for the ControlEvent table's Argument column.</summary>
26 + ControlEventArgument,
27 +
28 + /// <summary>Special modularization type for the Control table's Text column.</summary>
29 + ControlText,
30 +
31 + /// <summary>Any Properties in the column should be modularized.</summary>
32 + Property,
33 +
34 + /// <summary>Semi-colon list of keys, all of which need to be modularized.</summary>
35 + SemicolonDelimited,
36 + }
37 +}
src/WixToolset.Data/WindowsInstaller/ColumnType.cs new
+28
@@ -0,0 +1,28 @@
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.Data.WindowsInstaller
4 +{
5 + /// <summary>
6 + /// Defines MSI column types.
7 + /// </summary>
8 + public enum ColumnType
9 + {
10 + /// <summary>Unknown column type, default and invalid.</summary>
11 + Unknown,
12 +
13 + /// <summary>Column is a string.</summary>
14 + String,
15 +
16 + /// <summary>Column is a localizable string.</summary>
17 + Localized,
18 +
19 + /// <summary>Column is a number.</summary>
20 + Number,
21 +
22 + /// <summary>Column is a binary stream.</summary>
23 + Object,
24 +
25 + /// <summary>Column is a string that is preserved in transforms (like Object).</summary>
26 + Preserved,
27 + }
28 +}
src/WixToolset.Data/WindowsInstaller/Field.cs new
+312
@@ -0,0 +1,312 @@
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.Data.WindowsInstaller
4 +{
5 + using System;
6 + using System.Diagnostics;
7 + using System.Globalization;
8 + using System.Xml;
9 +
10 + /// <summary>
11 + /// Field containing data for a column in a row.
12 + /// </summary>
13 + public class Field
14 + {
15 + private object data;
16 +
17 + /// <summary>
18 + /// Instantiates a new Field.
19 + /// </summary>
20 + /// <param name="columnDefinition">Column definition for this field.</param>
21 + protected Field(ColumnDefinition columnDefinition)
22 + {
23 + this.Column = columnDefinition;
24 + }
25 +
26 + /// <summary>
27 + /// Gets or sets the column definition for this field.
28 + /// </summary>
29 + /// <value>Column definition.</value>
30 + public ColumnDefinition Column { get; private set; }
31 +
32 + /// <summary>
33 + /// Gets or sets the data for this field.
34 + /// </summary>
35 + /// <value>Data in the field.</value>
36 + public object Data
37 + {
38 + get
39 + {
40 + return this.data;
41 + }
42 +
43 + set
44 + {
45 + // Validate the value before setting it.
46 + this.data = this.ValidateValue(this.Column, value);
47 + }
48 + }
49 +
50 + /// <summary>
51 + /// Gets or sets whether this field is modified.
52 + /// </summary>
53 + /// <value>Whether this field is modified.</value>
54 + public bool Modified { get; set; }
55 +
56 + /// <summary>
57 + /// Gets or sets the previous data.
58 + /// </summary>
59 + /// <value>The previous data.</value>
60 + public string PreviousData { get; set; }
61 +
62 + /// <summary>
63 + /// Instantiate a new Field object of the correct type.
64 + /// </summary>
65 + /// <param name="columnDefinition">The column definition for the field.</param>
66 + /// <returns>The new Field object.</returns>
67 + public static Field Create(ColumnDefinition columnDefinition)
68 + {
69 + return (ColumnType.Object == columnDefinition.Type) ? new ObjectField(columnDefinition) : new Field(columnDefinition);
70 + }
71 +
72 + /// <summary>
73 + /// Sets the value of a particular field in the row without validating.
74 + /// </summary>
75 + /// <param name="field">field index.</param>
76 + /// <param name="value">Value of a field in the row.</param>
77 + /// <returns>True if successful, false if validation failed.</returns>
78 + public bool BestEffortSet(object value)
79 + {
80 + bool success = true;
81 + object bestEffortValue = value;
82 +
83 + try
84 + {
85 + bestEffortValue = this.ValidateValue(this.Column, value);
86 + }
87 + catch (InvalidOperationException)
88 + {
89 + success = false;
90 + }
91 +
92 + this.data = bestEffortValue;
93 + return success;
94 + }
95 +
96 + /// <summary>
97 + /// Determine if this field is identical to another field.
98 + /// </summary>
99 + /// <param name="field">The other field to compare to.</param>
100 + /// <returns>true if they are equal; false otherwise.</returns>
101 + public bool IsIdentical(Field field)
102 + {
103 + return (this.Column.Name == field.Column.Name &&
104 + ((null != this.data && this.data.Equals(field.data)) || (null == this.data && null == field.data)));
105 + }
106 +
107 + /// <summary>
108 + /// Overrides the built in object implementation to return the field's data as a string.
109 + /// </summary>
110 + /// <returns>Field's data as a string.</returns>
111 + public override string ToString()
112 + {
113 + return this.AsString();
114 + }
115 +
116 + /// <summary>
117 + /// Gets the field as an integer.
118 + /// </summary>
119 + /// <returns>Field's data as an integer.</returns>
120 + public int AsInteger()
121 + {
122 + return (this.data is int) ? (int)this.data : Convert.ToInt32(this.data, CultureInfo.InvariantCulture);
123 + }
124 +
125 + /// <summary>
126 + /// Gets the field as an integer that could be null.
127 + /// </summary>
128 + /// <returns>Field's data as an integer that could be null.</returns>
129 + public int? AsNullableInteger()
130 + {
131 + return (null == this.data) ? (int?)null : (this.data is int) ? (int)this.data : Convert.ToInt32(this.data, CultureInfo.InvariantCulture);
132 + }
133 +
134 + /// <summary>
135 + /// Gets the field as a string.
136 + /// </summary>
137 + /// <returns>Field's data as a string.</returns>
138 + public string AsString()
139 + {
140 + return (null == this.data) ? null : Convert.ToString(this.data, CultureInfo.InvariantCulture);
141 + }
142 +
143 + /// <summary>
144 + /// Validate a value for this column.
145 + /// </summary>
146 + /// <param name="value">The value to validate.</param>
147 + /// <returns>Validated value.</returns>
148 + internal object ValidateValue(ColumnDefinition column, object value)
149 + {
150 + if (null == value)
151 + {
152 + if (!column.Nullable)
153 + {
154 + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set column '{0}' with a null value because this is a required field.", column.Name));
155 + }
156 + }
157 + else // check numerical values against their specified minimum and maximum values.
158 + {
159 + if (ColumnType.Number == column.Type && !column.IsLocalizable)
160 + {
161 + // For now all enums in the tables can be represented by integers. This if statement would need to
162 + // be enhanced if that ever changes.
163 + if (value is int || value.GetType().IsEnum)
164 + {
165 + int intValue = (int)value;
166 +
167 + // validate the value against the minimum allowed value
168 + if (column.MinValue.HasValue && column.MinValue > intValue)
169 + {
170 + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set column '{0}' with value {1} because it is less than the minimum allowed value for this column, {2}.", column.Name, intValue, column.MinValue));
171 + }
172 +
173 + // validate the value against the maximum allowed value
174 + if (column.MaxValue.HasValue && column.MaxValue < intValue)
175 + {
176 + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set column '{0}' with value {1} because it is greater than the maximum allowed value for this column, {2}.", column.Name, intValue, column.MaxValue));
177 + }
178 +
179 + return intValue;
180 + }
181 + else if (value is long longValue)
182 + {
183 + // validate the value against the minimum allowed value
184 + if (column.MinValue.HasValue && column.MinValue > longValue)
185 + {
186 + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set column '{0}' with value {1} because it is less than the minimum allowed value for this column, {2}.", column.Name, longValue, column.MinValue));
187 + }
188 +
189 + // validate the value against the maximum allowed value
190 + if (column.MaxValue.HasValue && column.MaxValue < longValue)
191 + {
192 + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set column '{0}' with value {1} because it is greater than the maximum allowed value for this column, {2}.", column.Name, longValue, column.MaxValue));
193 + }
194 +
195 + return longValue;
196 + }
197 + else
198 + {
199 + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set number column '{0}' with a value of type '{1}'.", column.Name, value.GetType().ToString()));
200 + }
201 + }
202 + else
203 + {
204 + if (!(value is string))
205 + {
206 + //throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Cannot set string column '{0}' with a value of type '{1}'.", this.name, value.GetType().ToString()));
207 + return value.ToString();
208 + }
209 + }
210 + }
211 +
212 + return value;
213 + }
214 +
215 + /// <summary>
216 + /// Parse a field from the xml.
217 + /// </summary>
218 + /// <param name="reader">XmlReader where the intermediate is persisted.</param>
219 + internal virtual void Read(XmlReader reader)
220 + {
221 + Debug.Assert("field" == reader.LocalName);
222 +
223 + bool empty = reader.IsEmptyElement;
224 +
225 + while (reader.MoveToNextAttribute())
226 + {
227 + switch (reader.LocalName)
228 + {
229 + case "modified":
230 + this.Modified = reader.Value.Equals("yes");
231 + break;
232 + case "previousData":
233 + this.PreviousData = reader.Value;
234 + break;
235 + }
236 + }
237 +
238 + if (!empty)
239 + {
240 + bool done = false;
241 +
242 + while (!done && reader.Read())
243 + {
244 + switch (reader.NodeType)
245 + {
246 + case XmlNodeType.Element:
247 + throw new XmlException();
248 + case XmlNodeType.CDATA:
249 + case XmlNodeType.Text:
250 + case XmlNodeType.SignificantWhitespace:
251 + if (0 < reader.Value.Length)
252 + {
253 + if (ColumnType.Number == this.Column.Type && !this.Column.IsLocalizable)
254 + {
255 + // older wix files could persist data as a long value (which would overflow an int)
256 + // since the Convert class always throws exceptions for overflows, read in integral
257 + // values as a long to avoid the overflow, then cast it to an int (this operation can
258 + // overflow without throwing an exception inside an unchecked block)
259 + this.data = unchecked((int)Convert.ToInt64(reader.Value, CultureInfo.InvariantCulture));
260 + }
261 + else
262 + {
263 + this.data = reader.Value;
264 + }
265 + }
266 + break;
267 + case XmlNodeType.EndElement:
268 + done = true;
269 + break;
270 + }
271 + }
272 +
273 + if (!done)
274 + {
275 + throw new XmlException();
276 + }
277 + }
278 + }
279 +
280 + /// <summary>
281 + /// Persists a field in an XML format.
282 + /// </summary>
283 + /// <param name="writer">XmlWriter where the Field should persist itself as XML.</param>
284 + internal virtual void Write(XmlWriter writer)
285 + {
286 + writer.WriteStartElement("field", Intermediate.XmlNamespaceUri);
287 +
288 + if (this.Modified)
289 + {
290 + writer.WriteAttributeString("modified", "yes");
291 + }
292 +
293 + if (null != this.PreviousData)
294 + {
295 + writer.WriteAttributeString("previousData", this.PreviousData);
296 + }
297 +
298 + // Convert the data to a string that will persist nicely (nulls as String.Empty).
299 + string text = Convert.ToString(this.data, CultureInfo.InvariantCulture);
300 + if (this.Column.UseCData)
301 + {
302 + writer.WriteCData(text);
303 + }
304 + else
305 + {
306 + writer.WriteString(text);
307 + }
308 +
309 + writer.WriteEndElement();
310 + }
311 + }
312 +}
src/WixToolset.Data/WindowsInstaller/ObjectField.cs new
+183
@@ -0,0 +1,183 @@
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.Data.WindowsInstaller
4 +{
5 + using System;
6 + using System.Diagnostics;
7 + using System.Globalization;
8 + using System.Xml;
9 +
10 + /// <summary>
11 + /// Field containing data for an object column in a row.
12 + /// </summary>
13 + public sealed class ObjectField : Field
14 + {
15 + /// <summary>
16 + /// Instantiates a new Field.
17 + /// </summary>
18 + /// <param name="columnDefinition">Column definition for this field.</param>
19 + internal ObjectField(ColumnDefinition columnDefinition) :
20 + base(columnDefinition)
21 + {
22 + }
23 +
24 + /// <summary>
25 + /// Gets or sets the index of the embedded file in a library.
26 + /// </summary>
27 + /// <value>The index of the embedded file.</value>
28 + public int? EmbeddedFileIndex { get; set; }
29 +
30 + /// <summary>
31 + /// Gets or sets the previous index of the embedded file in the library.
32 + /// </summary>
33 + /// <value>The previous index of the embedded file.</value>
34 + public int? PreviousEmbeddedFileIndex { get; set; }
35 +
36 + /// <summary>
37 + /// Gets or sets the path to the embedded cabinet of the previous file.
38 + /// </summary>
39 + /// <value>The path of the cabinet containing the previous file.</value>
40 + public Uri PreviousBaseUri { get; set; }
41 +
42 + /// <summary>
43 + /// Gets the base URI of the object field.
44 + /// </summary>
45 + /// <value>The base URI of the object field.</value>
46 + public Uri BaseUri { get; private set; }
47 +
48 + /// <summary>
49 + /// Gets or sets the unresolved data for this field.
50 + /// </summary>
51 + /// <value>Unresolved Data in the field.</value>
52 + public string UnresolvedData { get; set; }
53 +
54 + /// <summary>
55 + /// Gets or sets the unresolved previous data.
56 + /// </summary>
57 + /// <value>The unresolved previous data.</value>
58 + public string UnresolvedPreviousData { get; set; }
59 +
60 + /// <summary>
61 + /// Parse a field from the xml.
62 + /// </summary>
63 + /// <param name="reader">XmlReader where the intermediate is persisted.</param>
64 + internal override void Read(XmlReader reader)
65 + {
66 + Debug.Assert("field" == reader.LocalName);
67 +
68 + bool empty = reader.IsEmptyElement;
69 +
70 + this.BaseUri = new Uri(reader.BaseURI);
71 +
72 + while (reader.MoveToNextAttribute())
73 + {
74 + switch (reader.LocalName)
75 + {
76 + case "cabinetFileId":
77 + this.EmbeddedFileIndex = Convert.ToInt32(reader.Value);
78 + break;
79 + case "modified":
80 + this.Modified = reader.Value.Equals("yes");
81 + break;
82 + case "previousData":
83 + this.PreviousData = reader.Value;
84 + break;
85 + case "unresolvedPreviousData":
86 + this.UnresolvedPreviousData = reader.Value;
87 + break;
88 + case "unresolvedData":
89 + this.UnresolvedData = reader.Value;
90 + break;
91 + case "previousCabinetFileId":
92 + this.PreviousEmbeddedFileIndex = Convert.ToInt32(reader.Value);
93 + break;
94 + }
95 + }
96 +
97 + if (!empty)
98 + {
99 + bool done = false;
100 +
101 + while (!done && reader.Read())
102 + {
103 + switch (reader.NodeType)
104 + {
105 + case XmlNodeType.Element:
106 + throw new XmlException();
107 + case XmlNodeType.CDATA:
108 + case XmlNodeType.Text:
109 + if (0 < reader.Value.Length)
110 + {
111 + this.Data = reader.Value;
112 + }
113 + break;
114 + case XmlNodeType.EndElement:
115 + done = true;
116 + break;
117 + }
118 + }
119 +
120 + if (!done)
121 + {
122 + throw new XmlException();
123 + }
124 + }
125 + }
126 +
127 + /// <summary>
128 + /// Persists a field in an XML format.
129 + /// </summary>
130 + /// <param name="writer">XmlWriter where the Field should persist itself as XML.</param>
131 + internal override void Write(XmlWriter writer)
132 + {
133 + writer.WriteStartElement("field", Intermediate.XmlNamespaceUri);
134 +
135 + if (this.EmbeddedFileIndex.HasValue)
136 + {
137 + writer.WriteStartAttribute("cabinetFileId");
138 + writer.WriteValue(this.EmbeddedFileIndex);
139 + writer.WriteEndAttribute();
140 + }
141 +
142 + if (this.Modified)
143 + {
144 + writer.WriteAttributeString("modified", "yes");
145 + }
146 +
147 + if (null != this.UnresolvedPreviousData)
148 + {
149 + writer.WriteAttributeString("unresolvedPreviousData", this.UnresolvedPreviousData);
150 + }
151 +
152 + if (null != this.PreviousData)
153 + {
154 + writer.WriteAttributeString("previousData", this.PreviousData);
155 + }
156 +
157 + if (null != this.UnresolvedData)
158 + {
159 + writer.WriteAttributeString("unresolvedData", this.UnresolvedData);
160 + }
161 +
162 + if (this.PreviousEmbeddedFileIndex.HasValue)
163 + {
164 + writer.WriteStartAttribute("previousCabinetFileId");
165 + writer.WriteValue(this.PreviousEmbeddedFileIndex);
166 + writer.WriteEndAttribute();
167 + }
168 +
169 + // Convert the data to a string that will persist nicely (nulls as String.Empty).
170 + string text = Convert.ToString(this.Data, CultureInfo.InvariantCulture);
171 + if (this.Column.UseCData)
172 + {
173 + writer.WriteCData(text);
174 + }
175 + else
176 + {
177 + writer.WriteString(text);
178 + }
179 +
180 + writer.WriteEndElement();
181 + }
182 + }
183 +}
src/WixToolset.Data/WindowsInstaller/Output.cs new
+274
@@ -0,0 +1,274 @@
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.Data.WindowsInstaller
4 +{
5 + using System;
6 + using System.Collections.Generic;
7 + using System.Globalization;
8 + using System.IO;
9 + using System.Linq;
10 + using System.Xml;
11 +
12 + /// <summary>
13 + /// Output is generated by the linker.
14 + /// </summary>
15 + public sealed class Output
16 + {
17 + public const string XmlNamespaceUri = "http://wixtoolset.org/schemas/v4/wixout";
18 + private static readonly Version CurrentVersion = new Version("4.0.0.0");
19 +
20 + /// <summary>
21 + /// Creates a new empty output object.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">The source line information for the output.</param>
24 + public Output(SourceLineNumber sourceLineNumbers)
25 + {
26 + this.SourceLineNumbers = sourceLineNumbers;
27 + this.SubStorages = new List<SubStorage>();
28 + this.Tables = new TableIndexedCollection();
29 + }
30 +
31 + /// <summary>
32 + /// Gets the type of the output.
33 + /// </summary>
34 + /// <value>Type of the output.</value>
35 + public OutputType Type { get; set; }
36 +
37 + /// <summary>
38 + /// Gets or sets the codepage for this output.
39 + /// </summary>
40 + /// <value>Codepage of the output.</value>
41 + public int Codepage { get; set; }
42 +
43 + /// <summary>
44 + /// Gets the source line information for this output.
45 + /// </summary>
46 + /// <value>The source line information for this output.</value>
47 + public SourceLineNumber SourceLineNumbers { get; private set; }
48 +
49 + /// <summary>
50 + /// Gets the substorages in this output.
51 + /// </summary>
52 + /// <value>The substorages in this output.</value>
53 + public ICollection<SubStorage> SubStorages { get; private set; }
54 +
55 + /// <summary>
56 + /// Gets the tables contained in this output.
57 + /// </summary>
58 + /// <value>Collection of tables.</value>
59 + public TableIndexedCollection Tables { get; private set; }
60 +
61 + /// <summary>
62 + /// Loads an output from a path on disk.
63 + /// </summary>
64 + /// <param name="path">Path to output file saved on disk.</param>
65 + /// <param name="suppressVersionCheck">Suppresses wix.dll version mismatch check.</param>
66 + /// <returns>Output object.</returns>
67 + public static Output Load(string path, bool suppressVersionCheck)
68 + {
69 + using (FileStream stream = File.OpenRead(path))
70 + using (FileStructure fs = FileStructure.Read(stream))
71 + {
72 + if (FileFormat.Wixout != fs.FileFormat)
73 + {
74 + throw new WixUnexpectedFileFormatException(path, FileFormat.Wixout, fs.FileFormat);
75 + }
76 +
77 + Uri uri = new Uri(Path.GetFullPath(path));
78 + using (XmlReader reader = XmlReader.Create(fs.GetDataStream(), null, uri.AbsoluteUri))
79 + {
80 + try
81 + {
82 + reader.MoveToContent();
83 + return Output.Read(reader, suppressVersionCheck);
84 + }
85 + catch (XmlException xe)
86 + {
87 + throw new WixCorruptFileException(path, fs.FileFormat, xe);
88 + }
89 + }
90 + }
91 + }
92 +
93 + /// <summary>
94 + /// Saves an output to a path on disk.
95 + /// </summary>
96 + /// <param name="path">Path to save output file to on disk.</param>
97 + public void Save(string path)
98 + {
99 + Directory.CreateDirectory(Path.GetDirectoryName(Path.GetFullPath(path)));
100 +
101 + using (FileStream stream = File.Create(path))
102 + using (FileStructure fs = FileStructure.Create(stream, FileFormat.Wixout, null))
103 + using (XmlWriter writer = XmlWriter.Create(fs.GetDataStream()))
104 + {
105 + writer.WriteStartDocument();
106 + this.Write(writer);
107 + writer.WriteEndDocument();
108 + }
109 + }
110 +
111 + /// <summary>
112 + /// Processes an XmlReader and builds up the output object.
113 + /// </summary>
114 + /// <param name="reader">Reader to get data from.</param>
115 + /// <param name="suppressVersionCheck">Suppresses wix.dll version mismatch check.</param>
116 + /// <returns>The Output represented by the Xml.</returns>
117 + internal static Output Read(XmlReader reader, bool suppressVersionCheck)
118 + {
119 + if (!reader.LocalName.Equals("wixOutput"))
120 + {
121 + throw new XmlException();
122 + }
123 +
124 + bool empty = reader.IsEmptyElement;
125 + Output output = new Output(SourceLineNumber.CreateFromUri(reader.BaseURI));
126 + Version version = null;
127 +
128 + while (reader.MoveToNextAttribute())
129 + {
130 + switch (reader.LocalName)
131 + {
132 + case "codepage":
133 + output.Codepage = Convert.ToInt32(reader.Value, CultureInfo.InvariantCulture.NumberFormat);
134 + break;
135 + case "type":
136 + switch (reader.Value)
137 + {
138 + case "Bundle":
139 + output.Type = OutputType.Bundle;
140 + break;
141 + case "Module":
142 + output.Type = OutputType.Module;
143 + break;
144 + case "Patch":
145 + output.Type = OutputType.Patch;
146 + break;
147 + case "PatchCreation":
148 + output.Type = OutputType.PatchCreation;
149 + break;
150 + case "Product":
151 + output.Type = OutputType.Product;
152 + break;
153 + case "Transform":
154 + output.Type = OutputType.Transform;
155 + break;
156 + default:
157 + throw new XmlException();
158 + }
159 + break;
160 + case "version":
161 + version = new Version(reader.Value);
162 + break;
163 + }
164 + }
165 +
166 + if (!suppressVersionCheck && null != version && !Output.CurrentVersion.Equals(version))
167 + {
168 + throw new WixException(WixDataErrors.VersionMismatch(SourceLineNumber.CreateFromUri(reader.BaseURI), "wixOutput", version.ToString(), Output.CurrentVersion.ToString()));
169 + }
170 +
171 + // loop through the rest of the xml building up the Output object
172 + TableDefinitionCollection tableDefinitions = null;
173 + List<Table> tables = new List<Table>();
174 + if (!empty)
175 + {
176 + bool done = false;
177 +
178 + // loop through all the fields in a row
179 + while (!done && reader.Read())
180 + {
181 + switch (reader.NodeType)
182 + {
183 + case XmlNodeType.Element:
184 + switch (reader.LocalName)
185 + {
186 + case "subStorage":
187 + output.SubStorages.Add(SubStorage.Read(reader));
188 + break;
189 + case "table":
190 + if (null == tableDefinitions)
191 + {
192 + throw new XmlException();
193 + }
194 + tables.Add(Table.Read(reader, tableDefinitions));
195 + break;
196 + case "tableDefinitions":
197 + tableDefinitions = TableDefinitionCollection.Read(reader);
198 + break;
199 + default:
200 + throw new XmlException();
201 + }
202 + break;
203 + case XmlNodeType.EndElement:
204 + done = true;
205 + break;
206 + }
207 + }
208 +
209 + if (!done)
210 + {
211 + throw new XmlException();
212 + }
213 + }
214 +
215 + output.Tables = new TableIndexedCollection(tables);
216 + return output;
217 + }
218 +
219 + /// <summary>
220 + /// Ensure this output contains a particular table.
221 + /// </summary>
222 + /// <param name="tableDefinition">Definition of the table that should exist.</param>
223 + /// <param name="section">Optional section to use for the table. If one is not provided, the entry section will be used.</param>
224 + /// <returns>The table in this output.</returns>
225 + public Table EnsureTable(TableDefinition tableDefinition)
226 + {
227 + if (!this.Tables.TryGetTable(tableDefinition.Name, out Table table))
228 + {
229 + table = new Table(tableDefinition);
230 + this.Tables.Add(table);
231 + }
232 +
233 + return table;
234 + }
235 +
236 + /// <summary>
237 + /// Persists an output in an XML format.
238 + /// </summary>
239 + /// <param name="writer">XmlWriter where the Output should persist itself as XML.</param>
240 + internal void Write(XmlWriter writer)
241 + {
242 + writer.WriteStartElement("wixOutput", XmlNamespaceUri);
243 +
244 + writer.WriteAttributeString("type", this.Type.ToString());
245 +
246 + if (0 != this.Codepage)
247 + {
248 + writer.WriteAttributeString("codepage", this.Codepage.ToString(CultureInfo.InvariantCulture));
249 + }
250 +
251 + writer.WriteAttributeString("version", Output.CurrentVersion.ToString());
252 +
253 + // Collect all the table definitions and write them.
254 + TableDefinitionCollection tableDefinitions = new TableDefinitionCollection();
255 + foreach (Table table in this.Tables)
256 + {
257 + tableDefinitions.Add(table.Definition);
258 + }
259 + tableDefinitions.Write(writer);
260 +
261 + foreach (Table table in this.Tables.OrderBy(t => t.Name))
262 + {
263 + table.Write(writer);
264 + }
265 +
266 + foreach (SubStorage subStorage in this.SubStorages)
267 + {
268 + subStorage.Write(writer);
269 + }
270 +
271 + writer.WriteEndElement();
272 + }
273 + }
274 +}
src/WixToolset.Data/WindowsInstaller/Pdb.cs new
+163
@@ -0,0 +1,163 @@
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.Data.WindowsInstaller
4 +{
5 + using System;
6 + using System.IO;
7 + using System.Xml;
8 +
9 + /// <summary>
10 + /// Pdb generated by the binder.
11 + /// </summary>
12 + public sealed class Pdb
13 + {
14 + public const string XmlNamespaceUri = "http://wixtoolset.org/schemas/v4/wixpdb";
15 + private static readonly Version CurrentVersion = new Version("4.0.0.0");
16 +
17 + /// <summary>
18 + /// Creates a new empty pdb object.
19 + /// </summary>
20 + /// <param name="sourceLineNumbers">The source line information for the pdb.</param>
21 + public Pdb()
22 + {
23 + }
24 +
25 + /// <summary>
26 + /// Gets or sets the output that is a part of this pdb.
27 + /// </summary>
28 + /// <value>Type of the output.</value>
29 + public Output Output { get; set; }
30 +
31 + /// <summary>
32 + /// Loads a pdb from a path on disk.
33 + /// </summary>
34 + /// <param name="path">Path to pdb file saved on disk.</param>
35 + /// <param name="suppressVersionCheck">Suppresses wix.dll version mismatch check.</param>
36 + /// <returns>Pdb pdb.</returns>
37 + public static Pdb Load(string path, bool suppressVersionCheck)
38 + {
39 + using (FileStream stream = File.OpenRead(path))
40 + using (FileStructure fs = FileStructure.Read(stream))
41 + {
42 + if (FileFormat.Wixpdb != fs.FileFormat)
43 + {
44 + throw new WixUnexpectedFileFormatException(path, FileFormat.Wixpdb, fs.FileFormat);
45 + }
46 +
47 + Uri uri = new Uri(Path.GetFullPath(path));
48 + using (XmlReader reader = XmlReader.Create(fs.GetDataStream(), null, uri.AbsoluteUri))
49 + {
50 + try
51 + {
52 + reader.MoveToContent();
53 + return Pdb.Read(reader, suppressVersionCheck);
54 + }
55 + catch (XmlException xe)
56 + {
57 + throw new WixCorruptFileException(path, fs.FileFormat, xe);
58 + }
59 + }
60 + }
61 + }
62 +
63 + /// <summary>
64 + /// Saves a pdb to a path on disk.
65 + /// </summary>
66 + /// <param name="path">Path to save pdb file to on disk.</param>
67 + public void Save(string path)
68 + {
69 + Directory.CreateDirectory(Path.GetDirectoryName(Path.GetFullPath(path)));
70 +
71 + using (FileStream stream = File.Create(path))
72 + using (FileStructure fs = FileStructure.Create(stream, FileFormat.Wixpdb, null))
73 + using (XmlWriter writer = XmlWriter.Create(fs.GetDataStream()))
74 + {
75 + writer.WriteStartDocument();
76 + this.Write(writer);
77 + writer.WriteEndDocument();
78 + }
79 + }
80 +
81 + /// <summary>
82 + /// Processes an XmlReader and builds up the pdb object.
83 + /// </summary>
84 + /// <param name="reader">Reader to get data from.</param>
85 + /// <param name="suppressVersionCheck">Suppresses wix.dll version mismatch check.</param>
86 + /// <returns>The Pdb represented by the Xml.</returns>
87 + internal static Pdb Read(XmlReader reader, bool suppressVersionCheck)
88 + {
89 + if ("wixPdb" != reader.LocalName)
90 + {
91 + throw new XmlException();
92 + }
93 +
94 + bool empty = reader.IsEmptyElement;
95 + Pdb pdb = new Pdb();
96 + Version version = null;
97 +
98 + while (reader.MoveToNextAttribute())
99 + {
100 + switch (reader.LocalName)
101 + {
102 + case "version":
103 + version = new Version(reader.Value);
104 + break;
105 + }
106 + }
107 +
108 + if (!suppressVersionCheck && null != version && !Pdb.CurrentVersion.Equals(version))
109 + {
110 + throw new WixException(WixDataErrors.VersionMismatch(SourceLineNumber.CreateFromUri(reader.BaseURI), "wixPdb", version.ToString(), Pdb.CurrentVersion.ToString()));
111 + }
112 +
113 + // loop through the rest of the pdb building up the Output object
114 + if (!empty)
115 + {
116 + bool done = false;
117 +
118 + // loop through all the fields in a row
119 + while (!done && reader.Read())
120 + {
121 + switch (reader.NodeType)
122 + {
123 + case XmlNodeType.Element:
124 + switch (reader.LocalName)
125 + {
126 + case "wixOutput":
127 + pdb.Output = Output.Read(reader, suppressVersionCheck);
128 + break;
129 + default:
130 + throw new XmlException();
131 + }
132 + break;
133 + case XmlNodeType.EndElement:
134 + done = true;
135 + break;
136 + }
137 + }
138 +
139 + if (!done)
140 + {
141 + throw new XmlException();
142 + }
143 + }
144 +
145 + return pdb;
146 + }
147 +
148 + /// <summary>
149 + /// Persists a pdb in an XML format.
150 + /// </summary>
151 + /// <param name="writer">XmlWriter where the Pdb should persist itself as XML.</param>
152 + internal void Write(XmlWriter writer)
153 + {
154 + writer.WriteStartElement("wixPdb", XmlNamespaceUri);
155 +
156 + writer.WriteAttributeString("version", Pdb.CurrentVersion.ToString());
157 +
158 + this.Output.Write(writer);
159 +
160 + writer.WriteEndElement();
161 + }
162 + }
163 +}
src/WixToolset.Data/WindowsInstaller/Row.cs new
+387
@@ -0,0 +1,387 @@
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.Data.WindowsInstaller
4 +{
5 + using System;
6 + using System.Diagnostics;
7 + using System.Globalization;
8 + using System.Text;
9 + using System.Xml;
10 +
11 + /// <summary>
12 + /// Row containing data for a table.
13 + /// </summary>
14 + public class Row
15 + {
16 + private static long rowCount;
17 +
18 + /// <summary>
19 + /// Creates a row that belongs to a table.
20 + /// </summary>
21 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
22 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
23 + /// <remarks>The compiler should use this constructor exclusively.</remarks>
24 + public Row(SourceLineNumber sourceLineNumbers, Table table)
25 + : this(sourceLineNumbers, table.Definition)
26 + {
27 + this.Table = table;
28 + }
29 +
30 + /// <summary>
31 + /// Creates a row that does not belong to a table.
32 + /// </summary>
33 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
34 + /// <param name="tableDefinition">TableDefinition this row should get its column definitions from.</param>
35 + /// <remarks>This constructor is used in cases where there isn't a clear owner of the row. The linker uses this constructor for the rows it generates.</remarks>
36 + public Row(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition)
37 + {
38 + this.Number = rowCount++;
39 + this.SourceLineNumbers = sourceLineNumbers;
40 + this.Fields = new Field[tableDefinition.Columns.Count];
41 + this.TableDefinition = tableDefinition;
42 +
43 + for (var i = 0; i < this.Fields.Length; ++i)
44 + {
45 + this.Fields[i] = Field.Create(this.TableDefinition.Columns[i]);
46 + }
47 + }
48 +
49 + /// <summary>
50 + /// Creates a shallow copy of a row from another row.
51 + /// </summary>
52 + /// <param name="source">The row the data is copied from.</param>
53 + protected Row(Row source)
54 + {
55 + this.Table = source.Table;
56 + this.TableDefinition = source.TableDefinition;
57 + this.Number = source.Number;
58 + this.Operation = source.Operation;
59 + this.Redundant = source.Redundant;
60 + this.SectionId = source.SectionId;
61 + this.SourceLineNumbers = source.SourceLineNumbers;
62 + this.Fields = source.Fields;
63 + }
64 +
65 + /// <summary>
66 + /// Gets or sets the row transform operation.
67 + /// </summary>
68 + /// <value>The row transform operation.</value>
69 + public RowOperation Operation { get; set; }
70 +
71 + /// <summary>
72 + /// Gets or sets wether the row is a duplicate of another row thus redundant.
73 + /// </summary>
74 + public bool Redundant { get; set; }
75 +
76 + /// <summary>
77 + /// Gets or sets the SectionId property on the row.
78 + /// </summary>
79 + /// <value>The SectionId property on the row.</value>
80 + public string SectionId { get; set; }
81 +
82 + /// <summary>
83 + /// Gets the source file and line number for the row.
84 + /// </summary>
85 + /// <value>Source file and line number.</value>
86 + public SourceLineNumber SourceLineNumbers { get; }
87 +
88 + /// <summary>
89 + /// Gets the table this row belongs to.
90 + /// </summary>
91 + /// <value>null if Row does not belong to a Table, or owner Table otherwise.</value>
92 + public Table Table { get; }
93 +
94 + /// <summary>
95 + /// Gets the table definition for this row.
96 + /// </summary>
97 + /// <remarks>A Row always has a TableDefinition, even if the Row does not belong to a Table.</remarks>
98 + /// <value>TableDefinition for Row.</value>
99 + public TableDefinition TableDefinition { get; }
100 +
101 + /// <summary>
102 + /// Gets the fields contained by this row.
103 + /// </summary>
104 + /// <value>Array of field objects</value>
105 + public Field[] Fields { get; }
106 +
107 + /// <summary>
108 + /// Gets the unique number for the row.
109 + /// </summary>
110 + /// <value>Number for row.</value>
111 + public long Number { get; }
112 +
113 + /// <summary>
114 + /// Gets or sets the value of a particular field in the row.
115 + /// </summary>
116 + /// <param name="field">field index.</param>
117 + /// <value>Value of a field in the row.</value>
118 + public object this[int field]
119 + {
120 + get { return this.Fields[field].Data; }
121 + set { this.Fields[field].Data = value; }
122 + }
123 +
124 + /// <summary>
125 + /// Gets the field as an integer.
126 + /// </summary>
127 + /// <returns>Field's data as an integer.</returns>
128 + public int FieldAsInteger(int field)
129 + {
130 + return this.Fields[field].AsInteger();
131 + }
132 +
133 + /// <summary>
134 + /// Gets the field as an integer that could be null.
135 + /// </summary>
136 + /// <returns>Field's data as an integer that could be null.</returns>
137 + public int? FieldAsNullableInteger(int field)
138 + {
139 + return this.Fields[field].AsNullableInteger();
140 + }
141 +
142 + /// <summary>
143 + /// Gets the field as a string.
144 + /// </summary>
145 + /// <returns>Field's data as a string.</returns>
146 + public string FieldAsString(int field)
147 + {
148 + return this.Fields[field].AsString();
149 + }
150 +
151 + /// <summary>
152 + /// Sets the value of a particular field in the row without validating.
153 + /// </summary>
154 + /// <param name="field">field index.</param>
155 + /// <param name="value">Value of a field in the row.</param>
156 + /// <returns>True if successful, false if validation failed.</returns>
157 + public bool BestEffortSetField(int field, object value)
158 + {
159 + return this.Fields[field].BestEffortSet(value);
160 + }
161 +
162 + /// <summary>
163 + /// Get the value used to represent the row in a keyed row collection.
164 + /// </summary>
165 + /// <returns>Primary key or row number if no primary key is available.</returns>
166 + public string GetKey()
167 + {
168 + return this.GetPrimaryKey() ?? Convert.ToString(this.Number, CultureInfo.InvariantCulture);
169 + }
170 +
171 + /// <summary>
172 + /// Get the primary key of this row.
173 + /// </summary>
174 + /// <param name="delimiter">Delimiter character for multiple column primary keys.</param>
175 + /// <returns>The primary key or null if the row's table has no primary key columns.</returns>
176 + public string GetPrimaryKey(char delimiter = '/')
177 + {
178 + return this.GetPrimaryKey(delimiter, String.Empty);
179 + }
180 +
181 + /// <summary>
182 + /// Get the primary key of this row.
183 + /// </summary>
184 + /// <param name="delimiter">Delimiter character for multiple column primary keys.</param>
185 + /// <param name="nullReplacement">String to represent null values in the primary key.</param>
186 + /// <returns>The primary key or null if the row's table has no primary key columns.</returns>
187 + public string GetPrimaryKey(char delimiter, string nullReplacement)
188 + {
189 + var foundPrimaryKey = false;
190 + var primaryKey = new StringBuilder();
191 +
192 + foreach (var field in this.Fields)
193 + {
194 + if (field.Column.PrimaryKey)
195 + {
196 + if (foundPrimaryKey)
197 + {
198 + primaryKey.Append(delimiter);
199 + }
200 +
201 + primaryKey.Append((null == field.Data) ? nullReplacement : Convert.ToString(field.Data, CultureInfo.InvariantCulture));
202 +
203 + foundPrimaryKey = true;
204 + }
205 + else // primary keys must be the first columns of a row so the first non-primary key means we can stop looking.
206 + {
207 + break;
208 + }
209 + }
210 +
211 + return foundPrimaryKey ? primaryKey.ToString() : null;
212 + }
213 +
214 + /// <summary>
215 + /// Returns true if the specified field is null or an empty string.
216 + /// </summary>
217 + /// <param name="field">Index of the field to check.</param>
218 + /// <returns>true if the specified field is null or an empty string, false otherwise.</returns>
219 + public bool IsColumnEmpty(int field)
220 + {
221 + if (null == this.Fields[field].Data)
222 + {
223 + return true;
224 + }
225 +
226 + string dataString = this.Fields[field].Data as string;
227 + if (null != dataString && 0 == dataString.Length)
228 + {
229 + return true;
230 + }
231 +
232 + return false;
233 + }
234 +
235 + /// <summary>
236 + /// Tests if the passed in row is identical.
237 + /// </summary>
238 + /// <param name="row">Row to compare against.</param>
239 + /// <returns>True if two rows are identical.</returns>
240 + public bool IsIdentical(Row row)
241 + {
242 + bool identical = (this.TableDefinition.Name == row.TableDefinition.Name && this.Fields.Length == row.Fields.Length);
243 +
244 + for (var i = 0; identical && i < this.Fields.Length; ++i)
245 + {
246 + if (!(this.Fields[i].IsIdentical(row.Fields[i])))
247 + {
248 + identical = false;
249 + }
250 + }
251 +
252 + return identical;
253 + }
254 +
255 + /// <summary>
256 + /// Returns a string representation of the Row.
257 + /// </summary>
258 + /// <returns>A string representation of the Row.</returns>
259 + public override string ToString()
260 + {
261 + return String.Join("/", (object[])this.Fields);
262 + }
263 +
264 + /// <summary>
265 + /// Creates a Row from the XmlReader.
266 + /// </summary>
267 + /// <param name="reader">Reader to get data from.</param>
268 + /// <param name="table">Table for this row.</param>
269 + /// <returns>New row object.</returns>
270 + internal static Row Read(XmlReader reader, Table table)
271 + {
272 + Debug.Assert("row" == reader.LocalName);
273 +
274 + bool empty = reader.IsEmptyElement;
275 + RowOperation operation = RowOperation.None;
276 + bool redundant = false;
277 + string sectionId = null;
278 + SourceLineNumber sourceLineNumbers = null;
279 +
280 + while (reader.MoveToNextAttribute())
281 + {
282 + switch (reader.LocalName)
283 + {
284 + case "op":
285 + operation = (RowOperation)Enum.Parse(typeof(RowOperation), reader.Value, true);
286 + break;
287 + case "redundant":
288 + redundant = reader.Value.Equals("yes");
289 + break;
290 + case "sectionId":
291 + sectionId = reader.Value;
292 + break;
293 + case "sourceLineNumber":
294 + sourceLineNumbers = SourceLineNumber.CreateFromEncoded(reader.Value);
295 + break;
296 + }
297 + }
298 +
299 + var row = table.CreateRow(sourceLineNumbers);
300 + row.Operation = operation;
301 + row.Redundant = redundant;
302 + row.SectionId = sectionId;
303 +
304 + // loop through all the fields in a row
305 + if (!empty)
306 + {
307 + var done = false;
308 + var field = 0;
309 +
310 + // loop through all the fields in a row
311 + while (!done && reader.Read())
312 + {
313 + switch (reader.NodeType)
314 + {
315 + case XmlNodeType.Element:
316 + switch (reader.LocalName)
317 + {
318 + case "field":
319 + if (row.Fields.Length <= field)
320 + {
321 + if (!reader.IsEmptyElement)
322 + {
323 + throw new XmlException();
324 + }
325 + }
326 + else
327 + {
328 + row.Fields[field].Read(reader);
329 + }
330 + ++field;
331 + break;
332 + default:
333 + throw new XmlException();
334 + }
335 + break;
336 + case XmlNodeType.EndElement:
337 + done = true;
338 + break;
339 + }
340 + }
341 +
342 + if (!done)
343 + {
344 + throw new XmlException();
345 + }
346 + }
347 +
348 + return row;
349 + }
350 +
351 + /// <summary>
352 + /// Persists a row in an XML format.
353 + /// </summary>
354 + /// <param name="writer">XmlWriter where the Row should persist itself as XML.</param>
355 + internal void Write(XmlWriter writer)
356 + {
357 + writer.WriteStartElement("row", Intermediate.XmlNamespaceUri);
358 +
359 + if (RowOperation.None != this.Operation)
360 + {
361 + writer.WriteAttributeString("op", this.Operation.ToString().ToLowerInvariant());
362 + }
363 +
364 + if (this.Redundant)
365 + {
366 + writer.WriteAttributeString("redundant", "yes");
367 + }
368 +
369 + if (null != this.SectionId)
370 + {
371 + writer.WriteAttributeString("sectionId", this.SectionId);
372 + }
373 +
374 + if (null != this.SourceLineNumbers)
375 + {
376 + writer.WriteAttributeString("sourceLineNumber", this.SourceLineNumbers.GetEncoded());
377 + }
378 +
379 + for (int i = 0; i < this.Fields.Length; ++i)
380 + {
381 + this.Fields[i].Write(writer);
382 + }
383 +
384 + writer.WriteEndElement();
385 + }
386 + }
387 +}
src/WixToolset.Data/WindowsInstaller/RowOperation.cs new
+30
@@ -0,0 +1,30 @@
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.Data.WindowsInstaller
4 +{
5 + /// <summary>
6 + /// The row transform operations.
7 + /// </summary>
8 + public enum RowOperation
9 + {
10 + /// <summary>
11 + /// No operation.
12 + /// </summary>
13 + None,
14 +
15 + /// <summary>
16 + /// Added row.
17 + /// </summary>
18 + Add,
19 +
20 + /// <summary>
21 + /// Deleted row.
22 + /// </summary>
23 + Delete,
24 +
25 + /// <summary>
26 + /// Modified row.
27 + /// </summary>
28 + Modify
29 + }
30 +}
src/WixToolset.Data/WindowsInstaller/Rows/BBControlRow.cs new
+113
@@ -0,0 +1,113 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System.Diagnostics.CodeAnalysis;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the Control table.
9 + /// </summary>
10 + public sealed class BBControlRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a Control row that belongs to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="table">Table this Control row belongs to and should get its column definitions from.</param>
17 + public BBControlRow(SourceLineNumber sourceLineNumbers, Table table) :
18 + base(sourceLineNumbers, table)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Gets or sets the dialog of the Control row.
24 + /// </summary>
25 + /// <value>Primary key of the Control row.</value>
26 + public string Billboard
27 + {
28 + get { return (string)this.Fields[0].Data; }
29 + set { this.Fields[0].Data = value; }
30 + }
31 +
32 + /// <summary>
33 + /// Gets or sets the identifier for this Control row.
34 + /// </summary>
35 + /// <value>Identifier for this Control row.</value>
36 + public string BBControl
37 + {
38 + get { return (string)this.Fields[1].Data; }
39 + set { this.Fields[1].Data = value; }
40 + }
41 +
42 + /// <summary>
43 + /// Gets or sets the type of the BBControl.
44 + /// </summary>
45 + /// <value>Name of the BBControl.</value>
46 + [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")]
47 + public string Type
48 + {
49 + get { return this.Fields[2].AsString(); }
50 + set { this.Fields[2].Data = value; }
51 + }
52 +
53 + /// <summary>
54 + /// Gets or sets the X location of the BBControl.
55 + /// </summary>
56 + /// <value>X location of the BBControl.</value>
57 + public string X
58 + {
59 + get { return this.Fields[3].AsString(); }
60 + set { this.Fields[3].Data = value; }
61 + }
62 +
63 + /// <summary>
64 + /// Gets or sets the Y location of the BBControl.
65 + /// </summary>
66 + /// <value>Y location of the BBControl.</value>
67 + public string Y
68 + {
69 + get { return this.Fields[4].AsString(); }
70 + set { this.Fields[4].Data = value; }
71 + }
72 +
73 + /// <summary>
74 + /// Gets or sets the width of the BBControl.
75 + /// </summary>
76 + /// <value>Width of the BBControl.</value>
77 + public string Width
78 + {
79 + get { return this.Fields[5].AsString(); }
80 + set { this.Fields[5].Data = value; }
81 + }
82 +
83 + /// <summary>
84 + /// Gets or sets the height of the BBControl.
85 + /// </summary>
86 + /// <value>Height of the BBControl.</value>
87 + public string Height
88 + {
89 + get { return this.Fields[6].AsString(); }
90 + set { this.Fields[6].Data = value; }
91 + }
92 +
93 + /// <summary>
94 + /// Gets or sets the attributes for the BBControl.
95 + /// </summary>
96 + /// <value>Attributes for the BBControl.</value>
97 + public int Attributes
98 + {
99 + get { return (int)this.Fields[7].Data; }
100 + set { this.Fields[7].Data = value; }
101 + }
102 +
103 + /// <summary>
104 + /// Gets or sets the text of the BBControl.
105 + /// </summary>
106 + /// <value>Text of the BBControl.</value>
107 + public string Text
108 + {
109 + get { return (string)this.Fields[8].Data; }
110 + set { this.Fields[8].Data = value; }
111 + }
112 + }
113 +}
src/WixToolset.Data/WindowsInstaller/Rows/ComponentRow.cs new
+244
@@ -0,0 +1,244 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using WixToolset.Data.Msi;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the Component table.
9 + /// </summary>
10 + public sealed class ComponentRow : Row
11 + {
12 + private string sourceFile;
13 +
14 + /// <summary>
15 + /// Creates a Control row that belongs to a table.
16 + /// </summary>
17 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
18 + /// <param name="table">Table this Component row belongs to and should get its column definitions from.</param>
19 + public ComponentRow(SourceLineNumber sourceLineNumbers, Table table) :
20 + base(sourceLineNumbers, table)
21 + {
22 + }
23 +
24 + /// <summary>
25 + /// Gets or sets the identifier for this Component row.
26 + /// </summary>
27 + /// <value>Identifier for this Component row.</value>
28 + public string Component
29 + {
30 + get { return (string)this.Fields[0].Data; }
31 + set { this.Fields[0].Data = value; }
32 + }
33 +
34 + /// <summary>
35 + /// Gets or sets the ComponentId for this Component row.
36 + /// </summary>
37 + /// <value>guid for this Component row.</value>
38 + public string Guid
39 + {
40 + get { return (string)this.Fields[1].Data; }
41 + set { this.Fields[1].Data = value; }
42 + }
43 +
44 + /// <summary>
45 + /// Gets or sets the Directory_ of the Component.
46 + /// </summary>
47 + /// <value>Directory of the Component.</value>
48 + public string Directory
49 + {
50 + get { return (string)this.Fields[2].Data; }
51 + set { this.Fields[2].Data = value; }
52 + }
53 +
54 + /// <summary>
55 + /// Gets or sets the local only attribute of the Component.
56 + /// </summary>
57 + /// <value>Local only attribute of the component.</value>
58 + public bool IsLocalOnly
59 + {
60 + get { return MsiInterop.MsidbComponentAttributesLocalOnly == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesLocalOnly); }
61 + set
62 + {
63 + if (value)
64 + {
65 + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesLocalOnly;
66 + }
67 + else
68 + {
69 + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesLocalOnly;
70 + }
71 + }
72 + }
73 +
74 + /// <summary>
75 + /// Gets or sets the source only attribute of the Component.
76 + /// </summary>
77 + /// <value>Source only attribute of the component.</value>
78 + public bool IsSourceOnly
79 + {
80 + get { return MsiInterop.MsidbComponentAttributesSourceOnly == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesSourceOnly); }
81 + set
82 + {
83 + if (value)
84 + {
85 + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesSourceOnly;
86 + }
87 + else
88 + {
89 + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesSourceOnly;
90 + }
91 + }
92 + }
93 +
94 + /// <summary>
95 + /// Gets or sets the optional attribute of the Component.
96 + /// </summary>
97 + /// <value>Optional attribute of the component.</value>
98 + public bool IsOptional
99 + {
100 + get { return MsiInterop.MsidbComponentAttributesOptional == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesOptional); }
101 + set
102 + {
103 + if (value)
104 + {
105 + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesOptional;
106 + }
107 + else
108 + {
109 + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesOptional;
110 + }
111 + }
112 + }
113 +
114 + /// <summary>
115 + /// Gets or sets the registry key path attribute of the Component.
116 + /// </summary>
117 + /// <value>Registry key path attribute of the component.</value>
118 + public bool IsRegistryKeyPath
119 + {
120 + get { return MsiInterop.MsidbComponentAttributesRegistryKeyPath == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesRegistryKeyPath); }
121 + set
122 + {
123 + if (value)
124 + {
125 + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesRegistryKeyPath;
126 + }
127 + else
128 + {
129 + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesRegistryKeyPath;
130 + }
131 + }
132 + }
133 +
134 + /// <summary>
135 + /// Gets or sets the shared dll ref count attribute of the Component.
136 + /// </summary>
137 + /// <value>Shared dll ref countattribute of the component.</value>
138 + public bool IsSharedDll
139 + {
140 + get { return MsiInterop.MsidbComponentAttributesSharedDllRefCount == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesSharedDllRefCount); }
141 + set
142 + {
143 + if (value)
144 + {
145 + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesSharedDllRefCount;
146 + }
147 + else
148 + {
149 + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesSharedDllRefCount;
150 + }
151 + }
152 + }
153 +
154 + /// <summary>
155 + /// Gets or sets the permanent attribute of the Component.
156 + /// </summary>
157 + /// <value>Permanent attribute of the component.</value>
158 + public bool IsPermanent
159 + {
160 + get { return MsiInterop.MsidbComponentAttributesPermanent == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesPermanent); }
161 + set
162 + {
163 + if (value)
164 + {
165 + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesPermanent;
166 + }
167 + else
168 + {
169 + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesPermanent;
170 + }
171 + }
172 + }
173 +
174 + /// <summary>
175 + /// Gets or sets the ODBC data source key path attribute of the Component.
176 + /// </summary>
177 + /// <value>ODBC data source key path attribute of the component.</value>
178 + public bool IsOdbcDataSourceKeyPath
179 + {
180 + get { return MsiInterop.MsidbComponentAttributesODBCDataSource == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributesODBCDataSource); }
181 + set
182 + {
183 + if (value)
184 + {
185 + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributesODBCDataSource;
186 + }
187 + else
188 + {
189 + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributesODBCDataSource;
190 + }
191 + }
192 + }
193 +
194 + /// <summary>
195 + /// Gets or sets the 64 bit attribute of the Component.
196 + /// </summary>
197 + /// <value>64-bitness of the component.</value>
198 + public bool Is64Bit
199 + {
200 + get { return MsiInterop.MsidbComponentAttributes64bit == ((int)this.Fields[3].Data & MsiInterop.MsidbComponentAttributes64bit); }
201 + set
202 + {
203 + if (value)
204 + {
205 + this.Fields[3].Data = (int)this.Fields[3].Data | MsiInterop.MsidbComponentAttributes64bit;
206 + }
207 + else
208 + {
209 + this.Fields[3].Data = (int)this.Fields[3].Data & ~MsiInterop.MsidbComponentAttributes64bit;
210 + }
211 + }
212 + }
213 +
214 + /// <summary>
215 + /// Gets or sets the condition of the Component.
216 + /// </summary>
217 + /// <value>Condition of the Component.</value>
218 + public string Condition
219 + {
220 + get { return (string)this.Fields[4].Data; }
221 + set { this.Fields[4].Data = value; }
222 + }
223 +
224 + /// <summary>
225 + /// Gets or sets the key path of the Component.
226 + /// </summary>
227 + /// <value>Key path of the Component.</value>
228 + public string KeyPath
229 + {
230 + get { return (string)this.Fields[5].Data; }
231 + set { this.Fields[5].Data = value; }
232 + }
233 +
234 + /// <summary>
235 + /// Gets or sets the source location to the file to fill in the Text of the control.
236 + /// </summary>
237 + /// <value>Source location to the file to fill in the Text of the control.</value>
238 + public string SourceFile
239 + {
240 + get { return this.sourceFile; }
241 + set { this.sourceFile = value; }
242 + }
243 + }
244 +}
src/WixToolset.Data/WindowsInstaller/Rows/ContainerType.cs new
+13
@@ -0,0 +1,13 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Types of bundle packages.
7 + /// </summary>
8 + public enum ContainerType
9 + {
10 + Attached,
11 + Detached,
12 + }
13 +}
src/WixToolset.Data/WindowsInstaller/Rows/ControlRow.cs new
+143
@@ -0,0 +1,143 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System.Diagnostics.CodeAnalysis;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the Control table.
9 + /// </summary>
10 + public sealed class ControlRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a Control row that belongs to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="table">Table this Control row belongs to and should get its column definitions from.</param>
17 + public ControlRow(SourceLineNumber sourceLineNumbers, Table table) :
18 + base(sourceLineNumbers, table)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Gets or sets the dialog of the Control row.
24 + /// </summary>
25 + /// <value>Primary key of the Control row.</value>
26 + public string Dialog
27 + {
28 + get { return (string)this.Fields[0].Data; }
29 + set { this.Fields[0].Data = value; }
30 + }
31 +
32 + /// <summary>
33 + /// Gets or sets the identifier for this Control row.
34 + /// </summary>
35 + /// <value>Identifier for this Control row.</value>
36 + public string Control
37 + {
38 + get { return (string)this.Fields[1].Data; }
39 + set { this.Fields[1].Data = value; }
40 + }
41 +
42 + /// <summary>
43 + /// Gets or sets the type of the control.
44 + /// </summary>
45 + /// <value>Name of the control.</value>
46 + [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")]
47 + public string Type
48 + {
49 + get { return (string)this.Fields[2].Data; }
50 + set { this.Fields[2].Data = value; }
51 + }
52 +
53 + /// <summary>
54 + /// Gets or sets the X location of the control.
55 + /// </summary>
56 + /// <value>X location of the control.</value>
57 + public string X
58 + {
59 + get { return this.Fields[3].AsString(); }
60 + set { this.Fields[3].Data = value; }
61 + }
62 +
63 + /// <summary>
64 + /// Gets or sets the Y location of the control.
65 + /// </summary>
66 + /// <value>Y location of the control.</value>
67 + public string Y
68 + {
69 + get { return this.Fields[4].AsString(); }
70 + set { this.Fields[4].Data = value; }
71 + }
72 +
73 + /// <summary>
74 + /// Gets or sets the width of the control.
75 + /// </summary>
76 + /// <value>Width of the control.</value>
77 + public string Width
78 + {
79 + get { return this.Fields[5].AsString(); }
80 + set { this.Fields[5].Data = value; }
81 + }
82 +
83 + /// <summary>
84 + /// Gets or sets the height of the control.
85 + /// </summary>
86 + /// <value>Height of the control.</value>
87 + public string Height
88 + {
89 + get { return this.Fields[6].AsString(); }
90 + set { this.Fields[6].Data = value; }
91 + }
92 +
93 + /// <summary>
94 + /// Gets or sets the attributes for the control.
95 + /// </summary>
96 + /// <value>Attributes for the control.</value>
97 + public int Attributes
98 + {
99 + get { return (int)this.Fields[7].Data; }
100 + set { this.Fields[7].Data = value; }
101 + }
102 +
103 + /// <summary>
104 + /// Gets or sets the Property associated with the control.
105 + /// </summary>
106 + /// <value>Property associated with the control.</value>
107 + public string Property
108 + {
109 + get { return (string)this.Fields[8].Data; }
110 + set { this.Fields[8].Data = value; }
111 + }
112 +
113 + /// <summary>
114 + /// Gets or sets the text of the control.
115 + /// </summary>
116 + /// <value>Text of the control.</value>
117 + public string Text
118 + {
119 + get { return (string)this.Fields[9].Data; }
120 + set { this.Fields[9].Data = value; }
121 + }
122 +
123 + /// <summary>
124 + /// Gets or sets the next control.
125 + /// </summary>
126 + /// <value>Next control.</value>
127 + public string Next
128 + {
129 + get { return (string)this.Fields[10].Data; }
130 + set { this.Fields[10].Data = value; }
131 + }
132 +
133 + /// <summary>
134 + /// Gets or sets the help for the control.
135 + /// </summary>
136 + /// <value>Help for the control.</value>
137 + public string Help
138 + {
139 + get { return (string)this.Fields[11].Data; }
140 + set { this.Fields[11].Data = value; }
141 + }
142 + }
143 +}
src/WixToolset.Data/WindowsInstaller/Rows/FileRow.cs new
+640
@@ -0,0 +1,640 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 + using System.Diagnostics;
7 + using System.Globalization;
8 + using WixToolset.Data.Msi;
9 +
10 + /// <summary>
11 + /// Specialization of a row for the file table.
12 + /// </summary>
13 + public sealed class FileRow : Row //, IComparable
14 + {
15 + //private string assemblyApplication;
16 + //private string assemblyManifest;
17 + //private FileAssemblyType assemblyType;
18 + //private string directory;
19 + //private int diskId;
20 + //private bool fromModule;
21 + //private bool isGeneratedShortFileName;
22 + //private int patchGroup;
23 + //private string processorArchitecture;
24 + //private string source;
25 + //private Row hashRow;
26 + //private List<Row> assemblyNameRows;
27 + //private string[] previousSource;
28 + //private string symbols;
29 + //private string[] previousSymbols;
30 + //private PatchAttributeType patchAttributes;
31 + //private string retainOffsets;
32 + //private string retainLengths;
33 + //private string ignoreOffsets;
34 + //private string ignoreLengths;
35 + //private string[] previousRetainOffsets;
36 + //private string[] previousRetainLengths;
37 + //private string[] previousIgnoreOffsets;
38 + //private string[] previousIgnoreLengths;
39 + //private string patch;
40 +
41 + /// <summary>
42 + /// Creates a File row that belongs to a table.
43 + /// </summary>
44 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
45 + /// <param name="table">Table this File row belongs to and should get its column definitions from.</param>
46 + public FileRow(SourceLineNumber sourceLineNumbers, Table table)
47 + : base(sourceLineNumbers, table)
48 + {
49 + //this.assemblyType = FileAssemblyType.NotAnAssembly;
50 + //this.previousSource = new string[1];
51 + //this.previousSymbols = new string[1];
52 + //this.previousRetainOffsets = new string[1];
53 + //this.previousRetainLengths = new string[1];
54 + //this.previousIgnoreOffsets = new string[1];
55 + //this.previousIgnoreLengths = new string[1];
56 + }
57 +
58 + /// <summary>
59 + /// Creates a File row that does not belong to a table.
60 + /// </summary>
61 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
62 + /// <param name="tableDefinition">TableDefinition this Media row belongs to and should get its column definitions from.</param>
63 + public FileRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition)
64 + : base(sourceLineNumbers, tableDefinition)
65 + {
66 + //this.assemblyType = FileAssemblyType.NotAnAssembly;
67 + //this.previousSource = new string[1];
68 + //this.previousSymbols = new string[1];
69 + //this.previousRetainOffsets = new string[1];
70 + //this.previousRetainLengths = new string[1];
71 + //this.previousIgnoreOffsets = new string[1];
72 + //this.previousIgnoreLengths = new string[1];
73 + }
74 +
75 + /// <summary>
76 + /// Gets or sets the primary key of the file row.
77 + /// </summary>
78 + /// <value>Primary key of the file row.</value>
79 + public string File
80 + {
81 + get { return (string)this.Fields[0].Data; }
82 + set { this.Fields[0].Data = value; }
83 + }
84 +
85 + /// <summary>
86 + /// Gets or sets the component this file row belongs to.
87 + /// </summary>
88 + /// <value>Component this file row belongs to.</value>
89 + public string Component
90 + {
91 + get { return (string)this.Fields[1].Data; }
92 + set { this.Fields[1].Data = value; }
93 + }
94 +
95 + /// <summary>
96 + /// Gets or sets the name of the file.
97 + /// </summary>
98 + /// <value>Name of the file.</value>
99 + public string FileName
100 + {
101 + get { return (string)this.Fields[2].Data; }
102 + set { this.Fields[2].Data = value; }
103 + }
104 +
105 + /// <summary>
106 + /// Gets or sets the real filesystem name of the file (without a pipe). This is typically the long name of the file.
107 + /// However, if no long name is available, falls back to the short name.
108 + /// </summary>
109 + /// <value>Long Name of the file - or if no long name is available, falls back to the short name.</value>
110 + public string LongFileName
111 + {
112 + get
113 + {
114 + string fileName = this.FileName;
115 + int index = fileName.IndexOf('|');
116 +
117 + // If it doesn't contain a pipe, just return the whole string
118 + if (-1 == index)
119 + {
120 + return fileName;
121 + }
122 + else // otherwise, extract the part of the string after the pipe
123 + {
124 + return fileName.Substring(index + 1);
125 + }
126 + }
127 + }
128 +
129 + /// <summary>
130 + /// Gets or sets the size of the file.
131 + /// </summary>
132 + /// <value>Size of the file.</value>
133 + public int FileSize
134 + {
135 + get { return (int)this.Fields[3].Data; }
136 + set { this.Fields[3].Data = value; }
137 + }
138 +
139 + /// <summary>
140 + /// Gets or sets the version of the file.
141 + /// </summary>
142 + /// <value>Version of the file.</value>
143 + public string Version
144 + {
145 + get { return (string)this.Fields[4].Data; }
146 + set { this.Fields[4].Data = value; }
147 + }
148 +
149 + /// <summary>
150 + /// Gets or sets the LCID of the file.
151 + /// </summary>
152 + /// <value>LCID of the file.</value>
153 + public string Language
154 + {
155 + get { return (string)this.Fields[5].Data; }
156 + set { this.Fields[5].Data = value; }
157 + }
158 +
159 + /// <summary>
160 + /// Gets or sets the attributes on a file.
161 + /// </summary>
162 + /// <value>Attributes on a file.</value>
163 + public int Attributes
164 + {
165 + get { return Convert.ToInt32(this.Fields[6].Data, CultureInfo.InvariantCulture); }
166 + set { this.Fields[6].Data = value; }
167 + }
168 +
169 + /// <summary>
170 + /// Gets or sets whether this file should be compressed.
171 + /// </summary>
172 + /// <value>Whether this file should be compressed.</value>
173 + public YesNoType Compressed
174 + {
175 + get
176 + {
177 + bool compressedFlag = (0 < (this.Attributes & MsiInterop.MsidbFileAttributesCompressed));
178 + bool noncompressedFlag = (0 < (this.Attributes & MsiInterop.MsidbFileAttributesNoncompressed));
179 +
180 + if (compressedFlag && noncompressedFlag)
181 + {
182 + throw new WixException(WixDataErrors.IllegalFileCompressionAttributes(this.SourceLineNumbers));
183 + }
184 + else if (compressedFlag)
185 + {
186 + return YesNoType.Yes;
187 + }
188 + else if (noncompressedFlag)
189 + {
190 + return YesNoType.No;
191 + }
192 + else
193 + {
194 + return YesNoType.NotSet;
195 + }
196 + }
197 +
198 + set
199 + {
200 + if (YesNoType.Yes == value)
201 + {
202 + // these are mutually exclusive
203 + this.Attributes |= MsiInterop.MsidbFileAttributesCompressed;
204 + this.Attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed;
205 + }
206 + else if (YesNoType.No == value)
207 + {
208 + // these are mutually exclusive
209 + this.Attributes |= MsiInterop.MsidbFileAttributesNoncompressed;
210 + this.Attributes &= ~MsiInterop.MsidbFileAttributesCompressed;
211 + }
212 + else // not specified
213 + {
214 + Debug.Assert(YesNoType.NotSet == value);
215 +
216 + // clear any compression bits
217 + this.Attributes &= ~MsiInterop.MsidbFileAttributesCompressed;
218 + this.Attributes &= ~MsiInterop.MsidbFileAttributesNoncompressed;
219 + }
220 + }
221 + }
222 +
223 + /// <summary>
224 + /// Gets or sets the sequence of the file row.
225 + /// </summary>
226 + /// <value>Sequence of the file row.</value>
227 + public int Sequence
228 + {
229 + get { return (int)this.Fields[7].Data; }
230 + set { this.Fields[7].Data = value; }
231 + }
232 +
233 + /////// <summary>
234 + /////// Gets or sets the type of assembly of file row.
235 + /////// </summary>
236 + /////// <value>Assembly type for file row.</value>
237 + ////public FileAssemblyType AssemblyType
238 + ////{
239 + //// get { return this.assemblyType; }
240 + //// set { this.assemblyType = value; }
241 + ////}
242 +
243 + /////// <summary>
244 + /////// Gets or sets the identifier for the assembly application.
245 + /////// </summary>
246 + /////// <value>Identifier for the assembly application.</value>
247 + ////public string AssemblyApplication
248 + ////{
249 + //// get { return this.assemblyApplication; }
250 + //// set { this.assemblyApplication = value; }
251 + ////}
252 +
253 + /////// <summary>
254 + /////// Gets or sets the identifier for the assembly manifest.
255 + /////// </summary>
256 + /////// <value>Identifier for the assembly manifest.</value>
257 + ////public string AssemblyManifest
258 + ////{
259 + //// get { return this.assemblyManifest; }
260 + //// set { this.assemblyManifest = value; }
261 + ////}
262 +
263 + /////// <summary>
264 + /////// Gets or sets the directory of the file.
265 + /////// </summary>
266 + /////// <value>Directory of the file.</value>
267 + ////public string Directory
268 + ////{
269 + //// get { return this.directory; }
270 + //// set { this.directory = value; }
271 + ////}
272 +
273 + /////// <summary>
274 + /////// Gets or sets the disk id for this file.
275 + /////// </summary>
276 + /////// <value>Disk id for the file.</value>
277 + ////public int DiskId
278 + ////{
279 + //// get { return this.diskId; }
280 + //// set { this.diskId = value; }
281 + ////}
282 +
283 + /////// <summary>
284 + /////// Gets or sets the source location to the file.
285 + /////// </summary>
286 + /////// <value>Source location to the file.</value>
287 + ////public string Source
288 + ////{
289 + //// get { return this.source; }
290 + //// set { this.source = value; }
291 + ////}
292 +
293 + /////// <summary>
294 + /////// Gets or sets the source location to the previous file.
295 + /////// </summary>
296 + /////// <value>Source location to the previous file.</value>
297 + ////public string PreviousSource
298 + ////{
299 + //// get { return this.previousSource[0]; }
300 + //// set { this.previousSource[0] = value; }
301 + ////}
302 +
303 + /////// <summary>
304 + /////// Gets the source location to the previous files.
305 + /////// </summary>
306 + /////// <value>Source location to the previous files.</value>
307 + ////[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
308 + ////public string[] PreviousSourceArray
309 + ////{
310 + //// get { return this.previousSource; }
311 + ////}
312 +
313 + /////// <summary>
314 + /////// Gets or sets the architecture the file executes on.
315 + /////// </summary>
316 + /////// <value>Architecture the file executes on.</value>
317 + ////public string ProcessorArchitecture
318 + ////{
319 + //// get { return this.processorArchitecture; }
320 + //// set { this.processorArchitecture = value; }
321 + ////}
322 +
323 + /////// <summary>
324 + /////// Gets of sets the patch group of a patch-added file.
325 + /////// </summary>
326 + /////// <value>The patch group of a patch-added file.</value>
327 + ////public int PatchGroup
328 + ////{
329 + //// get { return this.patchGroup; }
330 + //// set { this.patchGroup = value; }
331 + ////}
332 +
333 + /////// <summary>
334 + /////// Gets or sets the patch header of the file.
335 + /////// </summary>
336 + /////// <value>Patch header of the file.</value>
337 + ////public string Patch
338 + ////{
339 + //// get { return this.patch; }
340 + //// set { this.patch = value; }
341 + ////}
342 +
343 + /////// <summary>
344 + /////// Gets or sets the locations to find the file's symbols.
345 + /////// </summary>
346 + /////// <value>Symbol paths for the file.</value>
347 + ////public string Symbols
348 + ////{
349 + //// get { return this.symbols; }
350 + //// set { this.symbols = value; }
351 + ////}
352 +
353 + /////// <summary>
354 + /////// Gets or sets the locations to find the file's previous symbols.
355 + /////// </summary>
356 + /////// <value>Symbol paths for the previous file.</value>
357 + ////public string PreviousSymbols
358 + ////{
359 + //// get { return this.previousSymbols[0]; }
360 + //// set { this.previousSymbols[0] = value; }
361 + ////}
362 +
363 + /////// <summary>
364 + /////// Gets the locations to find the files' previous symbols.
365 + /////// </summary>
366 + /////// <value>Symbol paths for the previous files.</value>
367 + ////[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
368 + ////public string[] PreviousSymbolsArray
369 + ////{
370 + //// get { return this.previousSymbols; }
371 + ////}
372 +
373 + /////// <summary>
374 + /////// Gets or sets the generated short file name attribute.
375 + /////// </summary>
376 + /////// <value>The generated short file name attribute.</value>
377 + ////public bool IsGeneratedShortFileName
378 + ////{
379 + //// get { return this.isGeneratedShortFileName; }
380 +
381 + //// set { this.isGeneratedShortFileName = value; }
382 + ////}
383 +
384 + /////// <summary>
385 + /////// Gets or sets whether this row came from a merge module.
386 + /////// </summary>
387 + /////// <value>Whether this row came from a merge module.</value>
388 + ////public bool FromModule
389 + ////{
390 + //// get { return this.fromModule; }
391 + //// set { this.fromModule = value; }
392 + ////}
393 +
394 + /////// <summary>
395 + /////// Gets or sets the MsiFileHash row created for this FileRow.
396 + /////// </summary>
397 + /////// <value>Row for MsiFileHash table.</value>
398 + ////public Row HashRow
399 + ////{
400 + //// get { return this.hashRow; }
401 + //// set { this.hashRow = value; }
402 + ////}
403 +
404 + /////// <summary>
405 + /////// Gets or sets the set of MsiAssemblyName rows created for this FileRow.
406 + /////// </summary>
407 + /////// <value>RowCollection of MsiAssemblyName table.</value>
408 + ////[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
409 + ////public List<Row> AssemblyNameRows
410 + ////{
411 + //// get { return this.assemblyNameRows; }
412 + //// set { this.assemblyNameRows = value; }
413 + ////}
414 +
415 + /////// <summary>
416 + /////// Gets or sets the patching attributes to the file.
417 + /////// </summary>
418 + /////// <value>Patching attributes of the file.</value>
419 + ////public PatchAttributeType PatchAttributes
420 + ////{
421 + //// get { return this.patchAttributes; }
422 + //// set { this.patchAttributes = value; }
423 + ////}
424 +
425 + /////// <summary>
426 + /////// Gets or sets the delta patch retain-length list for the file.
427 + /////// </summary>
428 + /////// <value>RetainLength list for the file.</value>
429 + ////public string RetainLengths
430 + ////{
431 + //// get { return this.retainLengths; }
432 + //// set { this.retainLengths = value; }
433 + ////}
434 +
435 + /////// <summary>
436 + /////// Gets or sets the delta patch ignore-offset list for the file.
437 + /////// </summary>
438 + /////// <value>IgnoreOffset list for the file.</value>
439 + ////public string IgnoreOffsets
440 + ////{
441 + //// get { return this.ignoreOffsets; }
442 + //// set { this.ignoreOffsets = value; }
443 + ////}
444 +
445 + /////// <summary>
446 + /////// Gets or sets the delta patch ignore-length list for the file.
447 + /////// </summary>
448 + /////// <value>IgnoreLength list for the file.</value>
449 + ////public string IgnoreLengths
450 + ////{
451 + //// get { return this.ignoreLengths; }
452 + //// set { this.ignoreLengths = value; }
453 + ////}
454 +
455 + /////// <summary>
456 + /////// Gets or sets the delta patch retain-offset list for the file.
457 + /////// </summary>
458 + /////// <value>RetainOffset list for the file.</value>
459 + ////public string RetainOffsets
460 + ////{
461 + //// get { return this.retainOffsets; }
462 + //// set { this.retainOffsets = value; }
463 + ////}
464 +
465 + /////// <summary>
466 + /////// Gets or sets the delta patch retain-length list for the previous file.
467 + /////// </summary>
468 + /////// <value>RetainLength list for the previous file.</value>
469 + ////public string PreviousRetainLengths
470 + ////{
471 + //// get { return this.previousRetainLengths[0]; }
472 + //// set { this.previousRetainLengths[0] = value; }
473 + ////}
474 +
475 + /////// <summary>
476 + /////// Gets the delta patch retain-length list for the previous files.
477 + /////// </summary>
478 + /////// <value>RetainLength list for the previous files.</value>
479 + ////[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
480 + ////public string[] PreviousRetainLengthsArray
481 + ////{
482 + //// get { return this.previousRetainLengths; }
483 + ////}
484 +
485 + /////// <summary>
486 + /////// Gets or sets the delta patch ignore-offset list for the previous file.
487 + /////// </summary>
488 + /////// <value>IgnoreOffset list for the previous file.</value>
489 + ////public string PreviousIgnoreOffsets
490 + ////{
491 + //// get { return this.previousIgnoreOffsets[0]; }
492 + //// set { this.previousIgnoreOffsets[0] = value; }
493 + ////}
494 +
495 + /////// <summary>
496 + /////// Gets the delta patch ignore-offset list for the previous files.
497 + /////// </summary>
498 + /////// <value>IgnoreOffset list for the previous files.</value>
499 + ////[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
500 + ////public string[] PreviousIgnoreOffsetsArray
501 + ////{
502 + //// get { return this.previousIgnoreOffsets; }
503 + ////}
504 +
505 + /////// <summary>
506 + /////// Gets or sets the delta patch ignore-length list for the previous file.
507 + /////// </summary>
508 + /////// <value>IgnoreLength list for the previous file.</value>
509 + ////public string PreviousIgnoreLengths
510 + ////{
511 + //// get { return this.previousIgnoreLengths[0]; }
512 + //// set { this.previousIgnoreLengths[0] = value; }
513 + ////}
514 +
515 + /////// <summary>
516 + /////// Gets the delta patch ignore-length list for the previous files.
517 + /////// </summary>
518 + /////// <value>IgnoreLength list for the previous files.</value>
519 + ////[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
520 + ////public string[] PreviousIgnoreLengthsArray
521 + ////{
522 + //// get { return this.previousIgnoreLengths; }
523 + ////}
524 +
525 + /////// <summary>
526 + /////// Gets or sets the delta patch retain-offset list for the previous file.
527 + /////// </summary>
528 + /////// <value>RetainOffset list for the previous file.</value>
529 + ////public string PreviousRetainOffsets
530 + ////{
531 + //// get { return this.previousRetainOffsets[0]; }
532 + //// set { this.previousRetainOffsets[0] = value; }
533 + ////}
534 +
535 + /////// <summary>
536 + /////// Gets the delta patch retain-offset list for the previous files.
537 + /////// </summary>
538 + /////// <value>RetainOffset list for the previous files.</value>
539 + ////[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
540 + ////public string[] PreviousRetainOffsetsArray
541 + ////{
542 + //// get { return this.previousRetainOffsets; }
543 + ////}
544 +
545 + /////// <summary>
546 + /////// Compares the current FileRow with another object of the same type.
547 + /////// </summary>
548 + /////// <param name="obj">An object to compare with this instance.</param>
549 + /////// <returns>An integer that indicates the relative order of the comparands.</returns>
550 + ////[SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.ArgumentException.#ctor(System.String)")]
551 + ////[SuppressMessage("Microsoft.Globalization", "CA1309:UseOrdinalStringComparison")]
552 + ////public int CompareTo(object obj)
553 + ////{
554 + //// if (this == obj)
555 + //// {
556 + //// return 0;
557 + //// }
558 +
559 + //// FileRow fileRow = obj as FileRow;
560 + //// if (null == fileRow)
561 + //// {
562 + //// throw new ArgumentException(WixDataStrings.EXP_OtherObjectIsNotFileRow);
563 + //// }
564 +
565 + //// int compared = this.DiskId - fileRow.DiskId;
566 + //// if (0 == compared)
567 + //// {
568 + //// compared = this.patchGroup - fileRow.patchGroup;
569 +
570 + //// if (0 == compared)
571 + //// {
572 + //// compared = String.Compare(this.File, fileRow.File, StringComparison.InvariantCulture);
573 + //// }
574 + //// }
575 +
576 + //// return compared;
577 + ////}
578 +
579 + /////// <summary>
580 + /////// Copies data from another FileRow object.
581 + /////// </summary>
582 + /////// <param name="src">An row to get data from.</param>
583 + ////public void CopyFrom(FileRow src)
584 + ////{
585 + //// for (int i = 0; i < src.Fields.Length; i++)
586 + //// {
587 + //// this[i] = src[i];
588 + //// }
589 + //// this.assemblyManifest = src.assemblyManifest;
590 + //// this.assemblyType = src.assemblyType;
591 + //// this.directory = src.directory;
592 + //// this.diskId = src.diskId;
593 + //// this.fromModule = src.fromModule;
594 + //// this.isGeneratedShortFileName = src.isGeneratedShortFileName;
595 + //// this.patchGroup = src.patchGroup;
596 + //// this.processorArchitecture = src.processorArchitecture;
597 + //// this.source = src.source;
598 + //// this.PreviousSource = src.PreviousSource;
599 + //// this.Operation = src.Operation;
600 + //// this.symbols = src.symbols;
601 + //// this.PreviousSymbols = src.PreviousSymbols;
602 + //// this.patchAttributes = src.patchAttributes;
603 + //// this.retainOffsets = src.retainOffsets;
604 + //// this.retainLengths = src.retainLengths;
605 + //// this.ignoreOffsets = src.ignoreOffsets;
606 + //// this.ignoreLengths = src.ignoreLengths;
607 + //// this.PreviousRetainOffsets = src.PreviousRetainOffsets;
608 + //// this.PreviousRetainLengths = src.PreviousRetainLengths;
609 + //// this.PreviousIgnoreOffsets = src.PreviousIgnoreOffsets;
610 + //// this.PreviousIgnoreLengths = src.PreviousIgnoreLengths;
611 + ////}
612 +
613 + /////// <summary>
614 + /////// Appends previous data from another FileRow object.
615 + /////// </summary>
616 + /////// <param name="src">An row to get data from.</param>
617 + ////public void AppendPreviousDataFrom(FileRow src)
618 + ////{
619 + //// AppendStringToArray(ref this.previousSource, src.previousSource[0]);
620 + //// AppendStringToArray(ref this.previousSymbols, src.previousSymbols[0]);
621 + //// AppendStringToArray(ref this.previousRetainOffsets, src.previousRetainOffsets[0]);
622 + //// AppendStringToArray(ref this.previousRetainLengths, src.previousRetainLengths[0]);
623 + //// AppendStringToArray(ref this.previousIgnoreOffsets, src.previousIgnoreOffsets[0]);
624 + //// AppendStringToArray(ref this.previousIgnoreLengths, src.previousIgnoreLengths[0]);
625 + ////}
626 +
627 + /////// <summary>
628 + /////// Helper method for AppendPreviousDataFrom.
629 + /////// </summary>
630 + /////// <param name="source">Destination array.</param>
631 + /////// <param name="destination">Source string.</param>
632 + ////private static void AppendStringToArray(ref string[] destination, string source)
633 + ////{
634 + //// string[] result = new string[destination.Length + 1];
635 + //// destination.CopyTo(result, 0);
636 + //// result[destination.Length] = source;
637 + //// destination = result;
638 + ////}
639 + }
640 +}
src/WixToolset.Data/WindowsInstaller/Rows/MediaRow.cs new
+80
@@ -0,0 +1,80 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the Media table.
7 + /// </summary>
8 + public sealed class MediaRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a Media row that belongs to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="table">Table this Media row belongs to and should get its column definitions from.</param>
15 + public MediaRow(SourceLineNumber sourceLineNumbers, Table table)
16 + : base(sourceLineNumbers, table)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Gets or sets the disk id for this media row.
22 + /// </summary>
23 + /// <value>Disk id.</value>
24 + public int DiskId
25 + {
26 + get { return (int)this.Fields[0].Data; }
27 + set { this.Fields[0].Data = value; }
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the last sequence number for this media row.
32 + /// </summary>
33 + /// <value>Last sequence number.</value>
34 + public int LastSequence
35 + {
36 + get { return (int)this.Fields[1].Data; }
37 + set { this.Fields[1].Data = value; }
38 + }
39 +
40 + /// <summary>
41 + /// Gets or sets the disk prompt for this media row.
42 + /// </summary>
43 + /// <value>Disk prompt.</value>
44 + public string DiskPrompt
45 + {
46 + get { return (string)this.Fields[2].Data; }
47 + set { this.Fields[2].Data = value; }
48 + }
49 +
50 + /// <summary>
51 + /// Gets or sets the cabinet name for this media row.
52 + /// </summary>
53 + /// <value>Cabinet name.</value>
54 + public string Cabinet
55 + {
56 + get { return (string)this.Fields[3].Data; }
57 + set { this.Fields[3].Data = value; }
58 + }
59 +
60 + /// <summary>
61 + /// Gets or sets the volume label for this media row.
62 + /// </summary>
63 + /// <value>Volume label.</value>
64 + public string VolumeLabel
65 + {
66 + get { return (string)this.Fields[4].Data; }
67 + set { this.Fields[4].Data = value; }
68 + }
69 +
70 + /// <summary>
71 + /// Gets or sets the source for this media row.
72 + /// </summary>
73 + /// <value>Source.</value>
74 + public string Source
75 + {
76 + get { return (string)this.Fields[5].Data; }
77 + set { this.Fields[5].Data = value; }
78 + }
79 + }
80 +}
src/WixToolset.Data/WindowsInstaller/Rows/PropertyRow.cs new
+40
@@ -0,0 +1,40 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the upgrade table.
7 + /// </summary>
8 + public sealed class PropertyRow : Row
9 + {
10 + /// <summary>
11 + /// Creates an Upgrade row that belongs to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="table">Table this Upgrade row belongs to and should get its column definitions from.</param>
15 + public PropertyRow(SourceLineNumber sourceLineNumbers, Table table) :
16 + base(sourceLineNumbers, table)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Gets and sets the upgrade code for the row.
22 + /// </summary>
23 + /// <value>Property identifier for the row.</value>
24 + public string Property
25 + {
26 + get { return (string)this.Fields[0].Data; }
27 + set { this.Fields[0].Data = value; }
28 + }
29 +
30 + /// <summary>
31 + /// Gets and sets the value for the row.
32 + /// </summary>
33 + /// <value>Property value for the row.</value>
34 + public string Value
35 + {
36 + get { return (string)this.Fields[1].Data; }
37 + set { this.Fields[1].Data = value; }
38 + }
39 + }
40 +}
src/WixToolset.Data/WindowsInstaller/Rows/SummaryInfoRowCollection.cs new
+41
@@ -0,0 +1,41 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 + using System.Collections.ObjectModel;
7 +
8 + /// <summary>
9 + /// Indexed container class for summary information rows.
10 + /// </summary>
11 + public sealed class SummaryInfoRowCollection : KeyedCollection<int, Row>
12 + {
13 + /// <summary>
14 + /// Creates the keyed collection from existing rows in a table.
15 + /// </summary>
16 + /// <param name="table">The summary information table to index.</param>
17 + public SummaryInfoRowCollection(Table table)
18 + {
19 + if (0 != String.CompareOrdinal("_SummaryInformation", table.Name))
20 + {
21 + string message = string.Format(WixDataStrings.EXP_UnsupportedTable, table.Name);
22 + throw new ArgumentException(message, "table");
23 + }
24 +
25 + foreach (Row row in table.Rows)
26 + {
27 + this.Add(row);
28 + }
29 + }
30 +
31 + /// <summary>
32 + /// Gets the summary property ID for the <paramref name="row"/>.
33 + /// </summary>
34 + /// <param name="row">The row to index.</param>
35 + /// <returns>The summary property ID for the <paramref name="row"/>.
36 + protected override int GetKeyForItem(Row row)
37 + {
38 + return (int)row[0];
39 + }
40 + }
41 +}
src/WixToolset.Data/WindowsInstaller/Rows/UpgradeRow.cs new
+90
@@ -0,0 +1,90 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the upgrade table.
7 + /// </summary>
8 + public sealed class UpgradeRow : Row
9 + {
10 + /// <summary>
11 + /// Creates an Upgrade row that belongs to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="table">Table this Upgrade row belongs to and should get its column definitions from.</param>
15 + public UpgradeRow(SourceLineNumber sourceLineNumbers, Table table) :
16 + base(sourceLineNumbers, table)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Gets and sets the upgrade code for the row.
22 + /// </summary>
23 + /// <value>Upgrade code for the row.</value>
24 + public string UpgradeCode
25 + {
26 + get { return (string)this.Fields[0].Data; }
27 + set { this.Fields[0].Data = value; }
28 + }
29 +
30 + /// <summary>
31 + /// Gets and sets the version minimum for the row.
32 + /// </summary>
33 + /// <value>Version minimum for the row.</value>
34 + public string VersionMin
35 + {
36 + get { return (string)this.Fields[1].Data; }
37 + set { this.Fields[1].Data = value; }
38 + }
39 +
40 + /// <summary>
41 + /// Gets and sets the version maximum for the row.
42 + /// </summary>
43 + /// <value>Version maximum for the row.</value>
44 + public string VersionMax
45 + {
46 + get { return (string)this.Fields[2].Data; }
47 + set { this.Fields[2].Data = value; }
48 + }
49 +
50 + /// <summary>
51 + /// Gets and sets the language for the row.
52 + /// </summary>
53 + /// <value>Language for the row.</value>
54 + public string Language
55 + {
56 + get { return (string)this.Fields[3].Data; }
57 + set { this.Fields[3].Data = value; }
58 + }
59 +
60 + /// <summary>
61 + /// Gets and sets the attributes for the row.
62 + /// </summary>
63 + /// <value>Attributes for the row.</value>
64 + public int Attributes
65 + {
66 + get { return (int)this.Fields[4].Data; }
67 + set { this.Fields[4].Data = value; }
68 + }
69 +
70 + /// <summary>
71 + /// Gets and sets the remove code for the row.
72 + /// </summary>
73 + /// <value>Remove code for the row.</value>
74 + public string Remove
75 + {
76 + get { return (string)this.Fields[5].Data; }
77 + set { this.Fields[5].Data = value; }
78 + }
79 +
80 + /// <summary>
81 + /// Gets and sets the action property for the row.
82 + /// </summary>
83 + /// <value>Action property for the row.</value>
84 + public string ActionProperty
85 + {
86 + get { return (string)this.Fields[6].Data; }
87 + set { this.Fields[6].Data = value; }
88 + }
89 + }
90 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixActionRow.cs new
+118
@@ -0,0 +1,118 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 + using System.Diagnostics;
7 + using System.Globalization;
8 + using System.Xml;
9 + using WixToolset.Data.Tuples;
10 +
11 + /// <summary>
12 + /// Specialization of a row for the sequence tables.
13 + /// </summary>
14 + public sealed class WixActionRow : Row, IComparable
15 + {
16 + /// <summary>
17 + /// Instantiates an ActionRow that belongs to a table.
18 + /// </summary>
19 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
20 + /// <param name="table">Table this Action row belongs to and should get its column definitions from.</param>
21 + public WixActionRow(SourceLineNumber sourceLineNumbers, Table table) :
22 + base(sourceLineNumbers, table)
23 + {
24 + }
25 +
26 + /// <summary>
27 + /// Instantiates an ActionRow by copying data from another ActionRow.
28 + /// </summary>
29 + /// <param name="source">The row the data is copied from.</param>
30 + /// <remarks>The previous and next action collections are not copied.</remarks>
31 + private WixActionRow(WixActionRow source)
32 + : base(source)
33 + {
34 + }
35 +
36 + /// <summary>
37 + /// Gets or sets the name of the action.
38 + /// </summary>
39 + /// <value>The name of the action.</value>
40 + public string Action
41 + {
42 + get { return (string)this.Fields[1].Data; }
43 + set { this.Fields[1].Data = value; }
44 + }
45 +
46 + /// <summary>
47 + /// Gets the name of the action this action should be scheduled after.
48 + /// </summary>
49 + /// <value>The name of the action this action should be scheduled after.</value>
50 + public string After
51 + {
52 + get { return (string)this.Fields[5].Data; }
53 + set { this.Fields[5].Data = value; }
54 + }
55 +
56 + /// <summary>
57 + /// Gets the name of the action this action should be scheduled before.
58 + /// </summary>
59 + /// <value>The name of the action this action should be scheduled before.</value>
60 + public string Before
61 + {
62 + get { return (string)this.Fields[4].Data; }
63 + set { this.Fields[4].Data = value; }
64 + }
65 +
66 + /// <summary>
67 + /// Gets or sets the condition of the action.
68 + /// </summary>
69 + /// <value>The condition of the action.</value>
70 + public string Condition
71 + {
72 + get { return (string)this.Fields[2].Data; }
73 + set { this.Fields[2].Data = value; }
74 + }
75 +
76 + /// <summary>
77 + /// Gets or sets whether this action is overridable.
78 + /// </summary>
79 + /// <value>Whether this action is overridable.</value>
80 + public bool Overridable
81 + {
82 + get { return (1 == Convert.ToInt32(this.Fields[6].Data, CultureInfo.InvariantCulture)); }
83 + set { this.Fields[6].Data = (value ? 1 : 0); }
84 + }
85 +
86 + /// <summary>
87 + /// Gets or sets the sequence number of this action.
88 + /// </summary>
89 + /// <value>The sequence number of this action.</value>
90 + public int Sequence
91 + {
92 + get { return Convert.ToInt32(this.Fields[3].Data, CultureInfo.InvariantCulture); }
93 + set { this.Fields[3].Data = value; }
94 + }
95 +
96 + /// <summary>
97 + /// Gets of sets the sequence table of this action.
98 + /// </summary>
99 + /// <value>The sequence table of this action.</value>
100 + public SequenceTable SequenceTable
101 + {
102 + get { return (SequenceTable)Enum.Parse(typeof(SequenceTable), (string)this.Fields[0].Data); }
103 + set { this.Fields[0].Data = value.ToString(); }
104 + }
105 +
106 + /// <summary>
107 + /// Compares the current instance with another object of the same type.
108 + /// </summary>
109 + /// <param name="obj">Other reference to compare this one to.</param>
110 + /// <returns>Returns less than 0 for less than, 0 for equals, and greater than 0 for greater.</returns>
111 + public int CompareTo(object obj)
112 + {
113 + WixActionRow otherActionRow = (WixActionRow)obj;
114 +
115 + return this.Sequence.CompareTo(otherActionRow.Sequence);
116 + }
117 + }
118 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixApprovedExeForElevationRow.cs new
+78
@@ -0,0 +1,78 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the WixApprovedExeForElevation table.
7 + /// </summary>
8 + public class WixApprovedExeForElevationRow : Row
9 + {
10 + /// <summary>
11 + /// Creates an ApprovedExeForElevation row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this ApprovedExeForElevation row belongs to and should get its column definitions from.</param>
15 + public WixApprovedExeForElevationRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates an ApprovedExeForElevation row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this ApprovedExeForElevation row belongs to and should get its column definitions from.</param>
25 + public WixApprovedExeForElevationRow(SourceLineNumber sourceLineNumbers, Table table)
26 + : base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the ApprovedExeForElevation identifier.
32 + /// </summary>
33 + /// <value>The ApprovedExeForElevation identifier.</value>
34 + public string Id
35 + {
36 + get { return (string)this.Fields[0].Data; }
37 + set { this.Fields[0].Data = value; }
38 + }
39 +
40 + /// <summary>
41 + /// Gets or sets the Key path.
42 + /// </summary>
43 + /// <value>The Key path.</value>
44 + public string Key
45 + {
46 + get { return (string)this.Fields[1].Data; }
47 + set { this.Fields[1].Data = value; }
48 + }
49 +
50 + /// <summary>
51 + /// Gets or sets the Value name.
52 + /// </summary>
53 + /// <value>The Value name.</value>
54 + public string ValueName
55 + {
56 + get { return (string)this.Fields[2].Data; }
57 + set { this.Fields[2].Data = value; }
58 + }
59 +
60 + /// <summary>
61 + /// Gets or sets the attibutes.
62 + /// </summary>
63 + /// <value>The BundleApprovedExeForElevationAttributes.</value>
64 + public BundleApprovedExeForElevationAttributes Attributes
65 + {
66 + get { return (BundleApprovedExeForElevationAttributes)this.Fields[3].Data; }
67 + set { this.Fields[3].Data = (int)value; }
68 + }
69 +
70 + /// <summary>
71 + /// Gets whether this row is 64-bit.
72 + /// </summary>
73 + public bool Win64
74 + {
75 + get { return BundleApprovedExeForElevationAttributes.Win64 == (this.Attributes & BundleApprovedExeForElevationAttributes.Win64); }
76 + }
77 + }
78 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleCatalogRow.cs new
+50
@@ -0,0 +1,50 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the WixCatalog table.
7 + /// </summary>
8 + public sealed class WixBundleCatalogRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a Catalog row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this Catalog row belongs to and should get its column definitions from.</param>
15 + public WixBundleCatalogRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a Catalog row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this Catalog row belongs to and should get its column definitions from.</param>
25 + public WixBundleCatalogRow(SourceLineNumber sourceLineNumbers, Table table)
26 + : base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the catalog identifier.
32 + /// </summary>
33 + /// <value>The catalog identifier.</value>
34 + public string Id
35 + {
36 + get { return (string)this.Fields[0].Data; }
37 + set { this.Fields[0].Data = value; }
38 + }
39 +
40 + /// <summary>
41 + /// Gets or sets the payload identifier.
42 + /// </summary>
43 + /// <value>The payload identifier.</value>
44 + public string Payload
45 + {
46 + get { return (string)this.Fields[1].Data; }
47 + set { this.Fields[1].Data = value; }
48 + }
49 + }
50 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleContainerRow.cs new
+78
@@ -0,0 +1,78 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the Container table.
7 + /// </summary>
8 + public class WixBundleContainerRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a ContainerRow row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this Media row belongs to and should get its column definitions from.</param>
15 + public WixBundleContainerRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a ContainerRow row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this Media row belongs to and should get its column definitions from.</param>
25 + public WixBundleContainerRow(SourceLineNumber sourceLineNumbers, Table table) :
26 + base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + public string Id
31 + {
32 + get { return (string)this.Fields[0].Data; }
33 + set { this.Fields[0].Data = value; }
34 + }
35 +
36 + public string Name
37 + {
38 + get { return (string)this.Fields[1].Data; }
39 + set { this.Fields[1].Data = value; }
40 + }
41 +
42 + public ContainerType Type
43 + {
44 + get { return (ContainerType)this.Fields[2].Data; }
45 + set { this.Fields[2].Data = (int)value; }
46 + }
47 +
48 + public string DownloadUrl
49 + {
50 + get { return (string)this.Fields[3].Data; }
51 + set { this.Fields[3].Data = value; }
52 + }
53 +
54 + public long Size
55 + {
56 + get { return (long)this.Fields[4].Data; }
57 + set { this.Fields[4].Data = value; }
58 + }
59 +
60 + public string Hash
61 + {
62 + get { return (string)this.Fields[5].Data; }
63 + set { this.Fields[5].Data = value; }
64 + }
65 +
66 + public int AttachedContainerIndex
67 + {
68 + get { return (null == this.Fields[6].Data) ? -1 : (int)this.Fields[6].Data; }
69 + set { this.Fields[6].Data = value; }
70 + }
71 +
72 + public string WorkingPath
73 + {
74 + get { return (string)this.Fields[7].Data; }
75 + set { this.Fields[7].Data = value; }
76 + }
77 + }
78 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleExePackageRow.cs new
+103
@@ -0,0 +1,103 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using WixToolset.Data.Tuples;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the WixBundleExePackage table.
9 + /// </summary>
10 + public sealed class WixBundleExePackageRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a WixBundleExePackage row that does not belong to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="tableDef">TableDefinition this row belongs to and should get its column definitions from.</param>
17 + public WixBundleExePackageRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
18 + base(sourceLineNumbers, tableDef)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Creates a WixBundleExePackageRow row that belongs to a table.
24 + /// </summary>
25 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
26 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
27 + public WixBundleExePackageRow(SourceLineNumber sourceLineNumbers, Table table) :
28 + base(sourceLineNumbers, table)
29 + {
30 + }
31 +
32 + /// <summary>
33 + /// Gets or sets the foreign key identifier to the ChainPackage row.
34 + /// </summary>
35 + public string ChainPackageId
36 + {
37 + get { return (string)this.Fields[0].Data; }
38 + set { this.Fields[0].Data = value; }
39 + }
40 +
41 + /// <summary>
42 + /// Gets or sets the raw Exe attributes of a patch.
43 + /// </summary>
44 + public WixBundleExePackageAttributes Attributes
45 + {
46 + get { return (WixBundleExePackageAttributes)this.Fields[1].Data; }
47 + set { this.Fields[1].Data = value; }
48 + }
49 +
50 + /// <summary>
51 + /// Gets or sets the protcol for the executable package.
52 + /// </summary>
53 + public string DetectCondition
54 + {
55 + get { return (string)this.Fields[2].Data; }
56 + set { this.Fields[2].Data = value; }
57 + }
58 +
59 + /// <summary>
60 + /// Gets or sets the install command for the executable package.
61 + /// </summary>
62 + public string InstallCommand
63 + {
64 + get { return (string)this.Fields[3].Data; }
65 + set { this.Fields[3].Data = value; }
66 + }
67 +
68 + /// <summary>
69 + /// Gets or sets the repair command for the executable package.
70 + /// </summary>
71 + public string RepairCommand
72 + {
73 + get { return (string)this.Fields[4].Data; }
74 + set { this.Fields[4].Data = value; }
75 + }
76 +
77 + /// <summary>
78 + /// Gets or sets the uninstall command for the executable package.
79 + /// </summary>
80 + public string UninstallCommand
81 + {
82 + get { return (string)this.Fields[5].Data; }
83 + set { this.Fields[5].Data = value; }
84 + }
85 +
86 + /// <summary>
87 + /// Gets or sets the protcol for the executable package.
88 + /// </summary>
89 + public string ExeProtocol
90 + {
91 + get { return (string)this.Fields[6].Data; }
92 + set { this.Fields[6].Data = value; }
93 + }
94 +
95 + /// <summary>
96 + /// Gets whether the executable package is repairable.
97 + /// </summary>
98 + public bool Repairable
99 + {
100 + get { return 0 != (this.Attributes & WixBundleExePackageAttributes.Repairable); }
101 + }
102 + }
103 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleMsiFeatureRow.cs new
+93
@@ -0,0 +1,93 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the MsiFeature table.
7 + /// </summary>
8 + public class WixBundleMsiFeatureRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a MsiFeatureRow row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this Media row belongs to and should get its column definitions from.</param>
15 + public WixBundleMsiFeatureRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a MsiFeatureRow row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this Media row belongs to and should get its column definitions from.</param>
25 + public WixBundleMsiFeatureRow(SourceLineNumber sourceLineNumbers, Table table) :
26 + base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the foreign key identifier to the ChainPackage row.
32 + /// </summary>
33 + public string ChainPackageId
34 + {
35 + get { return (string)this.Fields[0].Data; }
36 + set { this.Fields[0].Data = value; }
37 + }
38 +
39 + public string Name
40 + {
41 + get { return (string)this.Fields[1].Data; }
42 + set { this.Fields[1].Data = value; }
43 + }
44 +
45 + public long Size
46 + {
47 + get { return (long)this.Fields[2].Data; }
48 + set { this.Fields[2].Data = value; }
49 + }
50 +
51 + public string Parent
52 + {
53 + get { return (string)this.Fields[3].Data; }
54 + set { this.Fields[3].Data = value; }
55 + }
56 +
57 + public string Title
58 + {
59 + get { return (string)this.Fields[4].Data; }
60 + set { this.Fields[4].Data = value; }
61 + }
62 +
63 + public string Description
64 + {
65 + get { return (string)this.Fields[5].Data; }
66 + set { this.Fields[5].Data = value; }
67 + }
68 +
69 + public int Display
70 + {
71 + get { return (int)this.Fields[6].Data; }
72 + set { this.Fields[6].Data = value; }
73 + }
74 +
75 + public int Level
76 + {
77 + get { return (int)this.Fields[7].Data; }
78 + set { this.Fields[7].Data = value; }
79 + }
80 +
81 + public string Directory
82 + {
83 + get { return (string)this.Fields[8].Data; }
84 + set { this.Fields[8].Data = value; }
85 + }
86 +
87 + public int Attributes
88 + {
89 + get { return (int)this.Fields[9].Data; }
90 + set { this.Fields[9].Data = value; }
91 + }
92 + }
93 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleMsiPackageRow.cs new
+138
@@ -0,0 +1,138 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 + using System.Globalization;
7 + using WixToolset.Data.Tuples;
8 +
9 + /// <summary>
10 + /// Specialization of a row for the WixBundleMsiPackage table.
11 + /// </summary>
12 + public sealed class WixBundleMsiPackageRow : Row
13 + {
14 + /// <summary>
15 + /// Creates a WixBundleMsiPackage row that does not belong to a table.
16 + /// </summary>
17 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
18 + /// <param name="tableDef">TableDefinition this row belongs to and should get its column definitions from.</param>
19 + public WixBundleMsiPackageRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
20 + base(sourceLineNumbers, tableDef)
21 + {
22 + }
23 +
24 + /// <summary>
25 + /// Creates a WixBundleMsiPackageRow row that belongs to a table.
26 + /// </summary>
27 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
28 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
29 + public WixBundleMsiPackageRow(SourceLineNumber sourceLineNumbers, Table table) :
30 + base(sourceLineNumbers, table)
31 + {
32 + }
33 +
34 + /// <summary>
35 + /// Gets or sets the foreign key identifier to the ChainPackage row.
36 + /// </summary>
37 + public string ChainPackageId
38 + {
39 + get { return (string)this.Fields[0].Data; }
40 + set { this.Fields[0].Data = value; }
41 + }
42 +
43 + /// <summary>
44 + /// Gets or sets the raw MSI attributes of a package.
45 + /// </summary>
46 + public WixBundleMsiPackageAttributes Attributes
47 + {
48 + get { return (WixBundleMsiPackageAttributes)this.Fields[1].Data; }
49 + set { this.Fields[1].Data = value; }
50 + }
51 +
52 + /// <summary>
53 + /// Gets or sets the MSI package's product code.
54 + /// </summary>
55 + public string ProductCode
56 + {
57 + get { return (string)this.Fields[2].Data; }
58 + set { this.Fields[2].Data = value; }
59 + }
60 +
61 + /// <summary>
62 + /// Gets or sets the MSI package's upgrade code.
63 + /// </summary>
64 + public string UpgradeCode
65 + {
66 + get { return (string)this.Fields[3].Data; }
67 + set { this.Fields[3].Data = value; }
68 + }
69 +
70 + /// <summary>
71 + /// Gets or sets the product version of the MSI package.
72 + /// </summary>
73 + public string ProductVersion
74 + {
75 + get { return (string)this.Fields[4].Data; }
76 + set { this.Fields[4].Data = value; }
77 + }
78 +
79 + /// <summary>
80 + /// Gets or sets the language of the MSI package.
81 + /// </summary>
82 + public int ProductLanguage
83 + {
84 + get { return Convert.ToInt32(this.Fields[5].Data, CultureInfo.InvariantCulture); }
85 + set { this.Fields[5].Data = value; }
86 + }
87 +
88 + /// <summary>
89 + /// Gets or sets the product name of the MSI package.
90 + /// </summary>
91 + public string ProductName
92 + {
93 + get { return (string)this.Fields[6].Data; }
94 + set { this.Fields[6].Data = value; }
95 + }
96 +
97 + /// <summary>
98 + /// Gets or sets the MSI package's manufacturer.
99 + /// </summary>
100 + public string Manufacturer
101 + {
102 + get { return (string)this.Fields[7].Data; }
103 + set { this.Fields[7].Data = value; }
104 + }
105 +
106 + /// <summary>
107 + /// Gets the display internal UI of a package.
108 + /// </summary>
109 + public bool DisplayInternalUI
110 + {
111 + get { return 0 != (this.Attributes & WixBundleMsiPackageAttributes.DisplayInternalUI); }
112 + }
113 +
114 + /// <summary>
115 + /// Gets the display internal UI of a package.
116 + /// </summary>
117 + public bool EnableFeatureSelection
118 + {
119 + get { return 0 != (this.Attributes & WixBundleMsiPackageAttributes.EnableFeatureSelection); }
120 + }
121 +
122 + /// <summary>
123 + /// Gets the display internal UI of a package.
124 + /// </summary>
125 + public bool ForcePerMachine
126 + {
127 + get { return 0 != (this.Attributes & WixBundleMsiPackageAttributes.ForcePerMachine); }
128 + }
129 +
130 + /// <summary>
131 + /// Gets the suppress loose file payload generation of a package.
132 + /// </summary>
133 + public bool SuppressLooseFilePayloadGeneration
134 + {
135 + get { return 0 != (this.Attributes & WixBundleMsiPackageAttributes.SuppressLooseFilePayloadGeneration); }
136 + }
137 + }
138 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleMsiPropertyRow.cs new
+58
@@ -0,0 +1,58 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the WixBundleMsiProperty table.
7 + /// </summary>
8 + public sealed class WixBundleMsiPropertyRow : Row
9 + {
10 + /// <summary>
11 + /// Creates an WixBundleMsiProperty row that belongs to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="table">Table this WixBundleMsiProperty row belongs to and should get its column definitions from.</param>
15 + public WixBundleMsiPropertyRow(SourceLineNumber sourceLineNumbers, Table table) :
16 + base(sourceLineNumbers, table)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Gets or sets the foreign key identifier to the ChainPackage row.
22 + /// </summary>
23 + public string ChainPackageId
24 + {
25 + get { return (string)this.Fields[0].Data; }
26 + set { this.Fields[0].Data = value; }
27 + }
28 +
29 + /// <summary>
30 + /// Gets and sets the property identity.
31 + /// </summary>
32 + public string Name
33 + {
34 + get { return (string)this.Fields[1].Data; }
35 + set { this.Fields[1].Data = value; }
36 + }
37 +
38 + /// <summary>
39 + /// Gets and sets the value for the row.
40 + /// </summary>
41 + /// <value>MsiProperty value for the row.</value>
42 + public string Value
43 + {
44 + get { return (string)this.Fields[2].Data; }
45 + set { this.Fields[2].Data = value; }
46 + }
47 +
48 + /// <summary>
49 + /// Gets and sets the condition for the row.
50 + /// </summary>
51 + /// <value>MsiProperty condition for the row.</value>
52 + public string Condition
53 + {
54 + get { return (string)this.Fields[3].Data; }
55 + set { this.Fields[3].Data = value; }
56 + }
57 + }
58 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleMspPackageRow.cs new
+101
@@ -0,0 +1,101 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using WixToolset.Data.Tuples;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the ChainMspPackage table.
9 + /// </summary>
10 + public sealed class WixBundleMspPackageRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a ChainMspPackage row that does not belong to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="tableDef">TableDefinition this row belongs to and should get its column definitions from.</param>
17 + public WixBundleMspPackageRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
18 + base(sourceLineNumbers, tableDef)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Creates a WixBundleMspPackage row that belongs to a table.
24 + /// </summary>
25 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
26 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
27 + public WixBundleMspPackageRow(SourceLineNumber sourceLineNumbers, Table table) :
28 + base(sourceLineNumbers, table)
29 + {
30 + }
31 +
32 + /// <summary>
33 + /// Gets or sets the foreign key identifier to the ChainPackage row.
34 + /// </summary>
35 + public string ChainPackageId
36 + {
37 + get { return (string)this.Fields[0].Data; }
38 + set { this.Fields[0].Data = value; }
39 + }
40 +
41 + /// <summary>
42 + /// Gets or sets the raw MSP attributes of a patch.
43 + /// </summary>
44 + public WixBundleMspPackageAttributes Attributes
45 + {
46 + get { return (WixBundleMspPackageAttributes)this.Fields[1].Data; }
47 + set { this.Fields[1].Data = value; }
48 + }
49 +
50 + /// <summary>
51 + /// Gets or sets the patch code.
52 + /// </summary>
53 + public string PatchCode
54 + {
55 + get { return (string)this.Fields[2].Data; }
56 + set { this.Fields[2].Data = value; }
57 + }
58 +
59 + /// <summary>
60 + /// Gets or sets the patch's manufacturer.
61 + /// </summary>
62 + public string Manufacturer
63 + {
64 + get { return (string)this.Fields[3].Data; }
65 + set { this.Fields[3].Data = value; }
66 + }
67 +
68 + /// <summary>
69 + /// Gets or sets the patch's xml.
70 + /// </summary>
71 + public string PatchXml
72 + {
73 + get { return (string)this.Fields[4].Data; }
74 + set { this.Fields[4].Data = value; }
75 + }
76 +
77 + /// <summary>
78 + /// Gets the display internal UI of a patch.
79 + /// </summary>
80 + public bool DisplayInternalUI
81 + {
82 + get { return 0 != (this.Attributes & WixBundleMspPackageAttributes.DisplayInternalUI); }
83 + }
84 +
85 + /// <summary>
86 + /// Gets whether to slipstream the patch.
87 + /// </summary>
88 + public bool Slipstream
89 + {
90 + get { return 0 != (this.Attributes & WixBundleMspPackageAttributes.Slipstream); }
91 + }
92 +
93 + /// <summary>
94 + /// Gets whether the patch targets an unspecified number of packages.
95 + /// </summary>
96 + public bool TargetUnspecified
97 + {
98 + get { return 0 != (this.Attributes & WixBundleMspPackageAttributes.TargetUnspecified); }
99 + }
100 + }
101 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleMsuPackageRow.cs new
+57
@@ -0,0 +1,57 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the WixBundleMsuPackage table.
7 + /// </summary>
8 + public sealed class WixBundleMsuPackageRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a WixBundleMsuPackage row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this row belongs to and should get its column definitions from.</param>
15 + public WixBundleMsuPackageRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a WixBundleMsuPackage row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
25 + public WixBundleMsuPackageRow(SourceLineNumber sourceLineNumbers, Table table) :
26 + base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the foreign key identifier to the ChainPackage row.
32 + /// </summary>
33 + public string ChainPackageId
34 + {
35 + get { return (string)this.Fields[0].Data; }
36 + set { this.Fields[0].Data = value; }
37 + }
38 +
39 + /// <summary>
40 + /// Gets or sets the detection condition the package.
41 + /// </summary>
42 + public string DetectCondition
43 + {
44 + get { return (string)this.Fields[1].Data; }
45 + set { this.Fields[1].Data = value; }
46 + }
47 +
48 + /// <summary>
49 + /// Gets or sets the KB of the package.
50 + /// </summary>
51 + public string MsuKB
52 + {
53 + get { return (string)this.Fields[2].Data; }
54 + set { this.Fields[2].Data = value; }
55 + }
56 + }
57 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundlePackageCommandLineRow.cs new
+80
@@ -0,0 +1,80 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the WixBundlePackageCommandLine table.
7 + /// </summary>
8 + public class WixBundlePackageCommandLineRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a WixBundlePackageCommandLineRow row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this WixBundlePackageCommandLineRow row belongs to and should get its column definitions from.</param>
15 + public WixBundlePackageCommandLineRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates an WixBundlePackageCommandLineRow row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this WixBundlePackageCommandLineRow row belongs to and should get its column definitions from.</param>
25 + public WixBundlePackageCommandLineRow(SourceLineNumber sourceLineNumbers, Table table)
26 + : base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the package identifier.
32 + /// </summary>
33 + /// <value>The package identifier.</value>
34 + public string ChainPackageId
35 + {
36 + get { return (string)this.Fields[0].Data; }
37 + set { this.Fields[0].Data = value; }
38 + }
39 +
40 + /// <summary>
41 + /// Gets or sets the command-line argument for installation.
42 + /// </summary>
43 + /// <value>The command-line argument.</value>
44 + public string InstallArgument
45 + {
46 + get { return (string)this.Fields[1].Data; }
47 + set { this.Fields[1].Data = value; }
48 + }
49 +
50 + /// <summary>
51 + /// Gets or sets the command-line argument for uninstallation.
52 + /// </summary>
53 + /// <value>The command-line argument.</value>
54 + public string UninstallArgument
55 + {
56 + get { return (string)this.Fields[2].Data; }
57 + set { this.Fields[2].Data = value; }
58 + }
59 +
60 + /// <summary>
61 + /// Gets or sets the command-line argument for repair.
62 + /// </summary>
63 + /// <value>The command-line argument.</value>
64 + public string RepairArgument
65 + {
66 + get { return (string)this.Fields[3].Data; }
67 + set { this.Fields[3].Data = value; }
68 + }
69 +
70 + /// <summary>
71 + /// Gets or sets the condition.
72 + /// </summary>
73 + /// <value>The condition.</value>
74 + public string Condition
75 + {
76 + get { return (string)this.Fields[4].Data; }
77 + set { this.Fields[4].Data = value; }
78 + }
79 + }
80 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundlePackageExitCodeRow.cs new
+53
@@ -0,0 +1,53 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using WixToolset.Data.Tuples;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the ExitCode table.
9 + /// </summary>
10 + public class WixBundlePackageExitCodeRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a ExitCodeRow row that does not belong to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="tableDef">TableDefinition this Media row belongs to and should get its column definitions from.</param>
17 + public WixBundlePackageExitCodeRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
18 + base(sourceLineNumbers, tableDef)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Creates a ExitCodeRow row that belongs to a table.
24 + /// </summary>
25 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
26 + /// <param name="table">Table this Media row belongs to and should get its column definitions from.</param>
27 + public WixBundlePackageExitCodeRow(SourceLineNumber sourceLineNumbers, Table table) :
28 + base(sourceLineNumbers, table)
29 + {
30 + }
31 +
32 + /// <summary>
33 + /// Gets or sets the foreign key identifier to the ChainPackage row.
34 + /// </summary>
35 + public string ChainPackageId
36 + {
37 + get { return (string)this.Fields[0].Data; }
38 + set { this.Fields[0].Data = value; }
39 + }
40 +
41 + public int? Code
42 + {
43 + get { return (null == this.Fields[1].Data) ? (int?)null : (int?)this.Fields[1].Data; }
44 + set { this.Fields[1].Data = value; }
45 + }
46 +
47 + public ExitCodeBehaviorType Behavior
48 + {
49 + get { return (ExitCodeBehaviorType)this.Fields[2].Data; }
50 + set { this.Fields[2].Data = (int)value; }
51 + }
52 + }
53 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundlePackageRow.cs new
+228
@@ -0,0 +1,228 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using WixToolset.Data.Tuples;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the WixBundlePackage table.
9 + /// </summary>
10 + public sealed class WixBundlePackageRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a WixBundlePackage row that does not belong to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="tableDef">TableDefinition this row belongs to and should get its column definitions from.</param>
17 + public WixBundlePackageRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
18 + base(sourceLineNumbers, tableDef)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Creates a WixBundlePackage row that belongs to a table.
24 + /// </summary>
25 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
26 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
27 + public WixBundlePackageRow(SourceLineNumber sourceLineNumbers, Table table) :
28 + base(sourceLineNumbers, table)
29 + {
30 + }
31 +
32 + /// <summary>
33 + /// Gets or sets the foreign key to the WixChainItem.
34 + /// </summary>
35 + public string WixChainItemId
36 + {
37 + get { return (string)this.Fields[0].Data; }
38 + set { this.Fields[0].Data = value; }
39 + }
40 +
41 + /// <summary>
42 + /// Gets or sets the item type.
43 + /// </summary>
44 + public WixBundlePackageType Type
45 + {
46 + get { return (WixBundlePackageType)this.Fields[1].Data; }
47 + set { this.Fields[1].Data = (int)value; }
48 + }
49 +
50 + /// <summary>
51 + /// Gets or sets the indentifier of the package's payload.
52 + /// </summary>
53 + public string PackagePayload
54 + {
55 + get { return (string)this.Fields[2].Data; }
56 + set { this.Fields[2].Data = value; }
57 + }
58 +
59 + /// <summary>
60 + /// Gets or sets the raw attributes of a package.
61 + /// </summary>
62 + public WixBundlePackageAttributes Attributes
63 + {
64 + get { return (WixBundlePackageAttributes)this.Fields[3].Data; }
65 + set { this.Fields[3].Data = value; }
66 + }
67 +
68 + /// <summary>
69 + /// Gets or sets the install condition of the package.
70 + /// </summary>
71 + public string InstallCondition
72 + {
73 + get { return (string)this.Fields[4].Data; }
74 + set { this.Fields[4].Data = value; }
75 + }
76 +
77 + /// <summary>
78 + /// Gets or sets the language of the package.
79 + /// </summary>
80 + public YesNoAlwaysType Cache
81 + {
82 + get { return (null == this.Fields[5].Data) ? YesNoAlwaysType.NotSet : (YesNoAlwaysType)this.Fields[5].Data; }
83 + set { this.Fields[5].Data = (int)value; }
84 + }
85 +
86 + /// <summary>
87 + /// Gets or sets the indentifier of the package's cache.
88 + /// </summary>
89 + public string CacheId
90 + {
91 + get { return (string)this.Fields[6].Data; }
92 + set { this.Fields[6].Data = value; }
93 + }
94 +
95 + /// <summary>
96 + /// Gets or sets whether the package is vital.
97 + /// </summary>
98 + public YesNoType Vital
99 + {
100 + get { return (null == this.Fields[7].Data) ? YesNoType.NotSet : (YesNoType)this.Fields[7].Data; }
101 + set { this.Fields[7].Data = (int)value; }
102 + }
103 +
104 + /// <summary>
105 + /// Gets or sets whether the package is per-machine.
106 + /// </summary>
107 + public YesNoDefaultType PerMachine
108 + {
109 + get { return (null == this.Fields[8].Data) ? YesNoDefaultType.NotSet : (YesNoDefaultType)this.Fields[8].Data; }
110 + set { this.Fields[8].Data = (int)value; }
111 + }
112 +
113 + /// <summary>
114 + /// Gets or sets the variable that points to the log for the package.
115 + /// </summary>
116 + public string LogPathVariable
117 + {
118 + get { return (string)this.Fields[9].Data; }
119 + set { this.Fields[9].Data = value; }
120 + }
121 +
122 + /// <summary>
123 + /// Gets or sets the variable that points to the rollback log for the package.
124 + /// </summary>
125 + public string RollbackLogPathVariable
126 + {
127 + get { return (string)this.Fields[10].Data; }
128 + set { this.Fields[10].Data = value; }
129 + }
130 +
131 + /// <summary>
132 + /// Gets or sets the size of the package.
133 + /// </summary>
134 + public long Size
135 + {
136 + get { return (long)this.Fields[11].Data; }
137 + set { this.Fields[11].Data = value; }
138 + }
139 +
140 + /// <summary>
141 + /// Gets or sets the install size of the package.
142 + /// </summary>
143 + public long? InstallSize
144 + {
145 + get { return (long?)this.Fields[12].Data; }
146 + set { this.Fields[12].Data = value; }
147 + }
148 +
149 + /// <summary>
150 + /// Gets or sets the version of the package.
151 + /// </summary>
152 + public string Version
153 + {
154 + get { return (string)this.Fields[13].Data; }
155 + set { this.Fields[13].Data = value; }
156 + }
157 +
158 + /// <summary>
159 + /// Gets or sets the language of the package.
160 + /// </summary>
161 + public int Language
162 + {
163 + get { return (int)this.Fields[14].Data; }
164 + set { this.Fields[14].Data = value; }
165 + }
166 +
167 + /// <summary>
168 + /// Gets or sets the display name of the package.
169 + /// </summary>
170 + public string DisplayName
171 + {
172 + get { return (string)this.Fields[15].Data; }
173 + set { this.Fields[15].Data = value; }
174 + }
175 +
176 + /// <summary>
177 + /// Gets or sets the description of the package.
178 + /// </summary>
179 + public string Description
180 + {
181 + get { return (string)this.Fields[16].Data; }
182 + set { this.Fields[16].Data = value; }
183 + }
184 +
185 + /// <summary>
186 + /// Gets or sets the rollback boundary identifier for the package.
187 + /// </summary>
188 + public string RollbackBoundary
189 + {
190 + get { return (string)this.Fields[17].Data; }
191 + set { this.Fields[17].Data = value; }
192 + }
193 +
194 + /// <summary>
195 + /// Gets or sets the backward rollback boundary identifier for the package.
196 + /// </summary>
197 + public string RollbackBoundaryBackward
198 + {
199 + get { return (string)this.Fields[18].Data; }
200 + set { this.Fields[18].Data = value; }
201 + }
202 +
203 + /// <summary>
204 + /// Gets or sets whether the package is x64.
205 + /// </summary>
206 + public YesNoType x64
207 + {
208 + get { return (null == this.Fields[19].Data) ? YesNoType.NotSet : (YesNoType)this.Fields[19].Data; }
209 + set { this.Fields[19].Data = (int)value; }
210 + }
211 +
212 + /// <summary>
213 + /// Gets whether the package is permanent.
214 + /// </summary>
215 + public bool Permanent
216 + {
217 + get { return 0 != (this.Attributes & WixBundlePackageAttributes.Permanent); }
218 + }
219 +
220 + /// <summary>
221 + /// Gets whether the package is visible.
222 + /// </summary>
223 + public bool Visible
224 + {
225 + get { return 0 != (this.Attributes & WixBundlePackageAttributes.Visible); }
226 + }
227 + }
228 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundlePatchTargetCodeRow.cs new
+79
@@ -0,0 +1,79 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 +
7 + /// <summary>
8 + /// Attributes for the PatchTargetCode table.
9 + /// </summary>
10 + [Flags]
11 + public enum WixBundlePatchTargetCodeAttributes : int
12 + {
13 + None = 0,
14 +
15 + /// <summary>
16 + /// The transform targets a specific ProductCode.
17 + /// </summary>
18 + TargetsProductCode = 1,
19 +
20 + /// <summary>
21 + /// The transform targets a specific UpgradeCode.
22 + /// </summary>
23 + TargetsUpgradeCode = 2,
24 + }
25 +
26 + /// <summary>
27 + /// Specialization of a row for the PatchTargetCode table.
28 + /// </summary>
29 + public class WixBundlePatchTargetCodeRow : Row
30 + {
31 + /// <summary>
32 + /// Creates a PatchTargetCodeRow row that does not belong to a table.
33 + /// </summary>
34 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
35 + /// <param name="tableDef">TableDefinition this PatchTargetCode row belongs to and should get its column definitions from.</param>
36 + public WixBundlePatchTargetCodeRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
37 + base(sourceLineNumbers, tableDef)
38 + {
39 + }
40 +
41 + /// <summary>
42 + /// Creates a PatchTargetCodeRow row that belongs to a table.
43 + /// </summary>
44 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
45 + /// <param name="table">Table this PatchTargetCode row belongs to and should get its column definitions from.</param>
46 + public WixBundlePatchTargetCodeRow(SourceLineNumber sourceLineNumbers, Table table) :
47 + base(sourceLineNumbers, table)
48 + {
49 + }
50 +
51 + public string MspPackageId
52 + {
53 + get { return (string)this.Fields[0].Data; }
54 + set { this.Fields[0].Data = value; }
55 + }
56 +
57 + public string TargetCode
58 + {
59 + get { return (string)this.Fields[1].Data; }
60 + set { this.Fields[1].Data = value; }
61 + }
62 +
63 + public WixBundlePatchTargetCodeAttributes Attributes
64 + {
65 + get { return (WixBundlePatchTargetCodeAttributes)this.Fields[2].Data; }
66 + set { this.Fields[2].Data = (int)value; }
67 + }
68 +
69 + public bool TargetsProductCode
70 + {
71 + get { return 0 != (WixBundlePatchTargetCodeAttributes.TargetsProductCode & this.Attributes); }
72 + }
73 +
74 + public bool TargetsUpgradeCode
75 + {
76 + get { return 0 != (WixBundlePatchTargetCodeAttributes.TargetsUpgradeCode & this.Attributes); }
77 + }
78 + }
79 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundlePayloadRow.cs new
+185
@@ -0,0 +1,185 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 + using System.IO;
7 +
8 + /// <summary>
9 + /// Specialization of a row for the PayloadInfo table.
10 + /// </summary>
11 + public class WixBundlePayloadRow : Row
12 + {
13 + /// <summary>
14 + /// Creates a PayloadRow row that does not belong to a table.
15 + /// </summary>
16 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
17 + /// <param name="tableDef">TableDefinition this Media row belongs to and should get its column definitions from.</param>
18 + public WixBundlePayloadRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
19 + base(sourceLineNumbers, tableDef)
20 + {
21 + }
22 +
23 + /// <summary>
24 + /// Creates a PayloadRow row that belongs to a table.
25 + /// </summary>
26 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
27 + /// <param name="table">Table this Media row belongs to and should get its column definitions from.</param>
28 + public WixBundlePayloadRow(SourceLineNumber sourceLineNumbers, Table table) :
29 + base(sourceLineNumbers, table)
30 + {
31 + }
32 +
33 + public string Id
34 + {
35 + get { return (string)this.Fields[0].Data; }
36 + set { this.Fields[0].Data = value; }
37 + }
38 +
39 + public string Name
40 + {
41 + get { return (string)this.Fields[1].Data; }
42 + set { this.Fields[1].Data = value; }
43 + }
44 +
45 + public string SourceFile
46 + {
47 + get { return (string)this.Fields[2].Data; }
48 + set { this.Fields[2].Data = value; }
49 + }
50 +
51 + public string DownloadUrl
52 + {
53 + get { return (string)this.Fields[3].Data; }
54 + set { this.Fields[3].Data = value; }
55 + }
56 +
57 + public YesNoDefaultType Compressed
58 + {
59 + get { return (YesNoDefaultType)this.Fields[4].Data; }
60 + set { this.Fields[4].Data = (int)value; }
61 + }
62 +
63 + public string UnresolvedSourceFile
64 + {
65 + get { return (string)this.Fields[5].Data; }
66 + set { this.Fields[5].Data = value; }
67 + }
68 +
69 + public string DisplayName
70 + {
71 + get { return (string)this.Fields[6].Data; }
72 + set { this.Fields[6].Data = value; }
73 + }
74 +
75 + public string Description
76 + {
77 + get { return (string)this.Fields[7].Data; }
78 + set { this.Fields[7].Data = value; }
79 + }
80 +
81 + public bool EnableSignatureValidation
82 + {
83 + get { return (null != this.Fields[8].Data) && (1 == (int)this.Fields[8].Data); }
84 + set { this.Fields[8].Data = value ? 1 : 0; }
85 + }
86 +
87 + public int FileSize
88 + {
89 + get { return (int)this.Fields[9].Data; }
90 + set { this.Fields[9].Data = value; }
91 + }
92 +
93 + public string Version
94 + {
95 + get { return (string)this.Fields[10].Data; }
96 + set { this.Fields[10].Data = value; }
97 + }
98 +
99 + public string Hash
100 + {
101 + get { return (string)this.Fields[11].Data; }
102 + set { this.Fields[11].Data = value; }
103 + }
104 +
105 + public string PublicKey
106 + {
107 + get { return (string)this.Fields[12].Data; }
108 + set { this.Fields[12].Data = value; }
109 + }
110 +
111 + public string Thumbprint
112 + {
113 + get { return (string)this.Fields[13].Data; }
114 + set { this.Fields[13].Data = value; }
115 + }
116 +
117 + public string Catalog
118 + {
119 + get { return (string)this.Fields[14].Data; }
120 + set { this.Fields[14].Data = value; }
121 + }
122 +
123 + public string Container
124 + {
125 + get { return (string)this.Fields[15].Data; }
126 + set { this.Fields[15].Data = value; }
127 + }
128 +
129 + public string Package
130 + {
131 + get { return (string)this.Fields[16].Data; }
132 + set { this.Fields[16].Data = value; }
133 + }
134 +
135 + public bool ContentFile
136 + {
137 + get { return (null != this.Fields[17].Data) && (1 == (int)this.Fields[17].Data); }
138 + set { this.Fields[17].Data = value ? 1 : 0; }
139 + }
140 +
141 + public string EmbeddedId
142 + {
143 + get { return (string)this.Fields[18].Data; }
144 + set { this.Fields[18].Data = value; }
145 + }
146 +
147 + public bool LayoutOnly
148 + {
149 + get { return (null != this.Fields[19].Data) && (1 == (int)this.Fields[19].Data); }
150 + set { this.Fields[19].Data = value ? 1 : 0; }
151 + }
152 +
153 + public PackagingType Packaging
154 + {
155 + get
156 + {
157 + object data = this.Fields[20].Data;
158 + return (null == data) ? PackagingType.Unknown : (PackagingType)data;
159 + }
160 +
161 + set
162 + {
163 + if (PackagingType.Unknown == value)
164 + {
165 + this.Fields[20].Data = null;
166 + }
167 + else
168 + {
169 + this.Fields[20].Data = (int)value;
170 + }
171 + }
172 + }
173 +
174 + public string ParentPackagePayload
175 + {
176 + get { return (string)this.Fields[21].Data; }
177 + set { this.Fields[21].Data = value; }
178 + }
179 +
180 + public string FullFileName
181 + {
182 + get { return String.IsNullOrEmpty(this.SourceFile) ? String.Empty : Path.GetFullPath(this.SourceFile); }
183 + }
184 + }
185 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleRelatedPackageRow.cs new
+87
@@ -0,0 +1,87 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the RelatedPackage table.
7 + /// </summary>
8 + public class WixBundleRelatedPackageRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a RelatedPackageRow row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this Media row belongs to and should get its column definitions from.</param>
15 + public WixBundleRelatedPackageRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a RelatedPackageRow row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this Media row belongs to and should get its column definitions from.</param>
25 + public WixBundleRelatedPackageRow(SourceLineNumber sourceLineNumbers, Table table) :
26 + base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the foreign key identifier to the ChainPackage row.
32 + /// </summary>
33 + public string ChainPackageId
34 + {
35 + get { return (string)this.Fields[0].Data; }
36 + set { this.Fields[0].Data = value; }
37 + }
38 +
39 + public string Id
40 + {
41 + get { return (string)this.Fields[1].Data; }
42 + set { this.Fields[1].Data = value; }
43 + }
44 +
45 + public string MinVersion
46 + {
47 + get { return (string)this.Fields[2].Data; }
48 + set { this.Fields[2].Data = value; }
49 + }
50 +
51 + public string MaxVersion
52 + {
53 + get { return (string)this.Fields[3].Data; }
54 + set { this.Fields[3].Data = value; }
55 + }
56 +
57 + public string Languages
58 + {
59 + get { return (string)this.Fields[4].Data; }
60 + set { this.Fields[4].Data = value; }
61 + }
62 +
63 + public bool MinInclusive
64 + {
65 + get { return 1 == (int)this.Fields[5].Data; }
66 + set { this.Fields[5].Data = value ? 1 : 0; }
67 + }
68 +
69 + public bool MaxInclusive
70 + {
71 + get { return 1 == (int)this.Fields[6].Data; }
72 + set { this.Fields[6].Data = value ? 1 : 0; }
73 + }
74 +
75 + public bool LangInclusive
76 + {
77 + get { return 1 == (int)this.Fields[7].Data; }
78 + set { this.Fields[7].Data = value ? 1 : 0; }
79 + }
80 +
81 + public bool OnlyDetect
82 + {
83 + get { return 1 == (int)this.Fields[8].Data; }
84 + set { this.Fields[8].Data = value ? 1 : 0; }
85 + }
86 + }
87 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleRollbackBoundaryRow.cs new
+59
@@ -0,0 +1,59 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the WixBundleRollbackBoundary table.
7 + /// </summary>
8 + public sealed class WixBundleRollbackBoundaryRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a WixBundleRollbackBoundary row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this row belongs to and should get its column definitions from.</param>
15 + public WixBundleRollbackBoundaryRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a RollbackBoundaryRow row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
25 + public WixBundleRollbackBoundaryRow(SourceLineNumber sourceLineNumbers, Table table) :
26 + base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the foreign key identifier to the ChainPackage row.
32 + /// </summary>
33 + public string ChainPackageId
34 + {
35 + get { return (string)this.Fields[0].Data; }
36 + set { this.Fields[0].Data = value; }
37 + }
38 +
39 + /// <summary>
40 + /// Gets or sets whether the package is vital.
41 + /// </summary>
42 + /// <value>Vitality of the package.</value>
43 + public YesNoType Vital
44 + {
45 + get { return (null == this.Fields[1].Data) ? YesNoType.NotSet : (YesNoType)this.Fields[1].Data; }
46 + set { this.Fields[1].Data = (int)value; }
47 + }
48 +
49 + /// <summary>
50 + /// Gets or sets whether the rollback-boundary should be installed as an MSI transaction.
51 + /// </summary>
52 + /// <value>Vitality of the package.</value>
53 + public YesNoType Transaction
54 + {
55 + get { return (null == this.Fields[2].Data) ? YesNoType.NotSet : (YesNoType)this.Fields[2].Data; }
56 + set { this.Fields[2].Data = (int)value; }
57 + }
58 + }
59 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleRow.cs new
+228
@@ -0,0 +1,228 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 +
7 + /// <summary>
8 + /// Bundle info for binding Bundles.
9 + /// </summary>
10 + public class WixBundleRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a WixBundleRow row that does not belong to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="tableDef">TableDefinition this WixBundleRow row belongs to and should get its column definitions from.</param>
17 + public WixBundleRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
18 + base(sourceLineNumbers, tableDef)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Creates a WixBundleRow row that belongs to a table.
24 + /// </summary>
25 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
26 + /// <param name="table">Table this WixBundleRow row belongs to and should get its column definitions from.</param>
27 + public WixBundleRow(SourceLineNumber sourceLineNumbers, Table table) :
28 + base(sourceLineNumbers, table)
29 + {
30 + }
31 +
32 + public string Version
33 + {
34 + get { return (string)this.Fields[0].Data; }
35 + set { this.Fields[0].Data = value; }
36 + }
37 +
38 + public string Copyright
39 + {
40 + get { return (string)this.Fields[1].Data; }
41 + set { this.Fields[1].Data = value; }
42 + }
43 +
44 + public string Name
45 + {
46 + get { return (string)this.Fields[2].Data; }
47 + set { this.Fields[2].Data = value; }
48 + }
49 +
50 + public string AboutUrl
51 + {
52 + get { return (string)this.Fields[3].Data; }
53 + set { this.Fields[3].Data = value; }
54 + }
55 +
56 + public int DisableModify
57 + {
58 + get { return (null == this.Fields[4].Data) ? 0 : (int)this.Fields[4].Data; }
59 + set { this.Fields[4].Data = value; }
60 + }
61 +
62 + public bool DisableRemove
63 + {
64 + get { return (null != this.Fields[5].Data && 0 != (int)this.Fields[5].Data); }
65 + set { this.Fields[5].Data = value ? 1 : 0; }
66 + }
67 +
68 + // There is no 6. It used to be DisableRepair.
69 +
70 + public string HelpTelephone
71 + {
72 + get { return (string)this.Fields[7].Data; }
73 + set { this.Fields[7].Data = value; }
74 + }
75 +
76 + public string HelpLink
77 + {
78 + get { return (string)this.Fields[8].Data; }
79 + set { this.Fields[8].Data = value; }
80 + }
81 +
82 + public string Publisher
83 + {
84 + get { return (string)this.Fields[9].Data; }
85 + set { this.Fields[9].Data = value; }
86 + }
87 +
88 + public string UpdateUrl
89 + {
90 + get { return (string)this.Fields[10].Data; }
91 + set { this.Fields[10].Data = value; }
92 + }
93 +
94 + public YesNoDefaultType Compressed
95 + {
96 + get { return (null == this.Fields[11].Data) ? YesNoDefaultType.Default : (0 == (int)this.Fields[11].Data) ? YesNoDefaultType.No : YesNoDefaultType.Yes; }
97 + set { this.Fields[11].Data = (int)value; }
98 + }
99 +
100 + public PackagingType DefaultPackagingType
101 + {
102 + get { return (YesNoDefaultType.No == this.Compressed) ? PackagingType.External : PackagingType.Embedded; }
103 + }
104 +
105 + public string LogPathPrefixExtension
106 + {
107 + get { return (string)this.Fields[12].Data ?? String.Empty; }
108 + set { this.Fields[12].Data = value; }
109 + }
110 +
111 + public string LogPathVariable
112 + {
113 + get
114 + {
115 + string[] logVariableAndPrefixExtension = this.LogPathPrefixExtension.Split(':');
116 + return logVariableAndPrefixExtension[0];
117 + }
118 + }
119 +
120 + public string LogPrefix
121 + {
122 + get
123 + {
124 + string[] logVariableAndPrefixExtension = this.LogPathPrefixExtension.Split(':');
125 + if (2 > logVariableAndPrefixExtension.Length)
126 + {
127 + return String.Empty;
128 + }
129 + string logPrefixAndExtension = logVariableAndPrefixExtension[1];
130 + int extensionIndex = logPrefixAndExtension.LastIndexOf('.');
131 + return logPrefixAndExtension.Substring(0, extensionIndex);
132 + }
133 + }
134 +
135 + public string LogExtension
136 + {
137 + get
138 + {
139 + string[] logVariableAndPrefixExtension = this.LogPathPrefixExtension.Split(':');
140 + if (2 > logVariableAndPrefixExtension.Length)
141 + {
142 + return String.Empty;
143 + }
144 + string logPrefixAndExtension = logVariableAndPrefixExtension[1];
145 + int extensionIndex = logPrefixAndExtension.LastIndexOf('.');
146 + return logPrefixAndExtension.Substring(extensionIndex + 1);
147 + }
148 + }
149 +
150 + public string IconPath
151 + {
152 + get { return (string)this.Fields[13].Data; }
153 + set { this.Fields[13].Data = value; }
154 + }
155 +
156 + public string SplashScreenBitmapPath
157 + {
158 + get { return (string)this.Fields[14].Data; }
159 + set { this.Fields[14].Data = value; }
160 + }
161 +
162 + public string Condition
163 + {
164 + get { return (string)this.Fields[15].Data; }
165 + set { this.Fields[15].Data = value; }
166 + }
167 +
168 + public string Tag
169 + {
170 + get { return (string)this.Fields[16].Data; }
171 + set { this.Fields[16].Data = value; }
172 + }
173 +
174 + public Platform Platform
175 + {
176 + get { return (Platform)Enum.Parse(typeof(Platform), (string)this.Fields[17].Data); }
177 + set { this.Fields[17].Data = value.ToString(); }
178 + }
179 +
180 + public string ParentName
181 + {
182 + get { return (string)this.Fields[18].Data; }
183 + set { this.Fields[18].Data = value; }
184 + }
185 +
186 + public string UpgradeCode
187 + {
188 + get { return (string)this.Fields[19].Data; }
189 + set { this.Fields[19].Data = value; }
190 + }
191 +
192 + public Guid BundleId
193 + {
194 + get
195 + {
196 + if (null == this.Fields[20].Data)
197 + {
198 + this.Fields[20].Data = Guid.NewGuid().ToString("B");
199 + }
200 +
201 + return new Guid((string)this.Fields[20].Data);
202 + }
203 +
204 + set { this.Fields[20].Data = value.ToString(); }
205 + }
206 +
207 + public string ProviderKey
208 + {
209 + get
210 + {
211 + if (null == this.Fields[21].Data)
212 + {
213 + this.Fields[21].Data = this.BundleId.ToString("B");
214 + }
215 +
216 + return (string)this.Fields[21].Data;
217 + }
218 +
219 + set { this.Fields[21].Data = value; }
220 + }
221 +
222 + public bool PerMachine
223 + {
224 + get { return (null != this.Fields[22].Data && 0 != (int)this.Fields[22].Data); }
225 + set { this.Fields[22].Data = value ? 1 : 0; }
226 + }
227 + }
228 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleSlipstreamMspRow.cs new
+48
@@ -0,0 +1,48 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the SlipstreamMsp table.
7 + /// </summary>
8 + public class WixBundleSlipstreamMspRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a SlipstreamMspRow row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this Media row belongs to and should get its column definitions from.</param>
15 + public WixBundleSlipstreamMspRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a SlipstreamMspRow row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this Media row belongs to and should get its column definitions from.</param>
25 + public WixBundleSlipstreamMspRow(SourceLineNumber sourceLineNumbers, Table table) :
26 + base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the foreign key identifier to the ChainPackage row.
32 + /// </summary>
33 + public string ChainPackageId
34 + {
35 + get { return (string)this.Fields[0].Data; }
36 + set { this.Fields[0].Data = value; }
37 + }
38 +
39 + /// <summary>
40 + /// Gets or sets the foreign key identifier to the ChainPackage row for the MSP package.
41 + /// </summary>
42 + public string MspPackageId
43 + {
44 + get { return (string)this.Fields[1].Data; }
45 + set { this.Fields[1].Data = value; }
46 + }
47 + }
48 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleUpdateRow.cs new
+36
@@ -0,0 +1,36 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Bundle update info for binding Bundles.
7 + /// </summary>
8 + public class WixBundleUpdateRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a WixBundleUpdateRow row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this WixBundleUpdateRow row belongs to and should get its column definitions from.</param>
15 + public WixBundleUpdateRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a WixBundleUpdateRow row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this WixBundleUpdateRow row belongs to and should get its column definitions from.</param>
25 + public WixBundleUpdateRow(SourceLineNumber sourceLineNumbers, Table table) :
26 + base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + public string Location
31 + {
32 + get { return (string)this.Fields[0].Data; }
33 + set { this.Fields[0].Data = value; }
34 + }
35 + }
36 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixBundleVariableRow.cs new
+80
@@ -0,0 +1,80 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the Variable table.
7 + /// </summary>
8 + public sealed class WixBundleVariableRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a Variable row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this Media row belongs to and should get its column definitions from.</param>
15 + public WixBundleVariableRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a Variable row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this Media row belongs to and should get its column definitions from.</param>
25 + public WixBundleVariableRow(SourceLineNumber sourceLineNumbers, Table table)
26 + : base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the variable identifier.
32 + /// </summary>
33 + /// <value>The variable identifier.</value>
34 + public string Id
35 + {
36 + get { return (string)this.Fields[0].Data; }
37 + set { this.Fields[0].Data = value; }
38 + }
39 +
40 + /// <summary>
41 + /// Gets or sets the variable's value.
42 + /// </summary>
43 + /// <value>The variable's value.</value>
44 + public string Value
45 + {
46 + get { return (string)this.Fields[1].Data; }
47 + set { this.Fields[1].Data = value; }
48 + }
49 +
50 + /// <summary>
51 + /// Gets or sets the variable's type.
52 + /// </summary>
53 + /// <value>The variable's type.</value>
54 + public string Type
55 + {
56 + get { return (string)this.Fields[2].Data; }
57 + set { this.Fields[2].Data = value; }
58 + }
59 +
60 + /// <summary>
61 + /// Gets or sets whether this variable is hidden.
62 + /// </summary>
63 + /// <value>Whether this variable is hidden.</value>
64 + public bool Hidden
65 + {
66 + get { return (null == this.Fields[3].Data || 0 == ((int)this.Fields[3].Data)) ? false : true; }
67 + set { this.Fields[3].Data = value ? 1 : 0; }
68 + }
69 +
70 + /// <summary>
71 + /// Gets or sets whether this variable is persisted.
72 + /// </summary>
73 + /// <value>Whether this variable is persisted.</value>
74 + public bool Persisted
75 + {
76 + get { return (null == this.Fields[4].Data || 0 == ((int)this.Fields[4].Data)) ? false : true; }
77 + set { this.Fields[4].Data = value ? 1 : 0; }
78 + }
79 + }
80 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixChainItemRow.cs new
+39
@@ -0,0 +1,39 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the WixChainItem table.
7 + /// </summary>
8 + public sealed class WixChainItemRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a WixChainItem row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this ChainItem row belongs to and should get its column definitions from.</param>
15 + public WixChainItemRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a WixChainItem row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this ChainItem row belongs to and should get its column definitions from.</param>
25 + public WixChainItemRow(SourceLineNumber sourceLineNumbers, Table table)
26 + : base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the WixChainItem identifier.
32 + /// </summary>
33 + public string Id
34 + {
35 + get { return (string)this.Fields[0].Data; }
36 + set { this.Fields[0].Data = value; }
37 + }
38 + }
39 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixChainRow.cs new
+65
@@ -0,0 +1,65 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using WixToolset.Data.Tuples;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the WixChain table.
9 + /// </summary>
10 + public sealed class WixChainRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a WixChain row that does not belong to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="tableDef">TableDefinition this row belongs to and should get its column definitions from.</param>
17 + public WixChainRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
18 + base(sourceLineNumbers, tableDef)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Creates a WixChainRow row that belongs to a table.
24 + /// </summary>
25 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
26 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
27 + public WixChainRow(SourceLineNumber sourceLineNumbers, Table table) :
28 + base(sourceLineNumbers, table)
29 + {
30 + }
31 +
32 + /// <summary>
33 + /// Gets or sets the raw chain attributes.
34 + /// </summary>
35 + public WixChainAttributes Attributes
36 + {
37 + get { return (WixChainAttributes)this.Fields[0].Data; }
38 + set { this.Fields[0].Data = value; }
39 + }
40 +
41 + /// <summary>
42 + /// Gets the disable rollback state of a chain.
43 + /// </summary>
44 + public bool DisableRollback
45 + {
46 + get { return 0 != (this.Attributes & WixChainAttributes.DisableRollback); }
47 + }
48 +
49 + /// <summary>
50 + /// Gets disable system restore state of a chain.
51 + /// </summary>
52 + public bool DisableSystemRestore
53 + {
54 + get { return 0 != (this.Attributes & WixChainAttributes.DisableSystemRestore); }
55 + }
56 +
57 + /// <summary>
58 + /// Gets parallel cache of a chain.
59 + /// </summary>
60 + public bool ParallelCache
61 + {
62 + get { return 0 != (this.Attributes & WixChainAttributes.ParallelCache); }
63 + }
64 + }
65 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixComplexReferenceRow.cs new
+202
@@ -0,0 +1,202 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 + using System.Diagnostics.CodeAnalysis;
7 +
8 + /// <summary>
9 + /// Specialization of a row for the WixComplexReference table.
10 + /// </summary>
11 + public sealed class WixComplexReferenceRow : Row, IComparable
12 + {
13 + /// <summary>
14 + /// Creates a WixComplexReferenceRow row that belongs to a table.
15 + /// </summary>
16 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
17 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
18 + public WixComplexReferenceRow(SourceLineNumber sourceLineNumbers, Table table)
19 + : base(sourceLineNumbers, table)
20 + {
21 + }
22 +
23 + /// <summary>
24 + /// Gets the parent type of the complex reference.
25 + /// </summary>
26 + /// <value>Parent type of the complex reference.</value>
27 + public ComplexReferenceParentType ParentType
28 + {
29 + get { return (ComplexReferenceParentType)Enum.ToObject(typeof(ComplexReferenceParentType), (int)this.Fields[1].Data); }
30 + set { this.Fields[1].Data = (int)value; }
31 + }
32 +
33 + /// <summary>
34 + /// Gets or sets the parent identifier of the complex reference.
35 + /// </summary>
36 + /// <value>Parent identifier of the complex reference.</value>
37 + public string ParentId
38 + {
39 + get { return (string)this.Fields[0].Data; }
40 + set { this.Fields[0].Data = value; }
41 + }
42 +
43 + /// <summary>
44 + /// Gets the parent language of the complex reference.
45 + /// </summary>
46 + /// <value>Parent language of the complex reference.</value>
47 + public string ParentLanguage
48 + {
49 + get { return (string)this.Fields[2].Data; }
50 + set { this.Fields[2].Data = value; }
51 + }
52 +
53 + /// <summary>
54 + /// Gets the child type of the complex reference.
55 + /// </summary>
56 + /// <value>Child type of the complex reference.</value>
57 + public ComplexReferenceChildType ChildType
58 + {
59 + get { return (ComplexReferenceChildType)Enum.ToObject(typeof(ComplexReferenceChildType), (int)this.Fields[4].Data); }
60 + set { this.Fields[4].Data = (int)value; }
61 + }
62 +
63 + /// <summary>
64 + /// Gets the child identifier of the complex reference.
65 + /// </summary>
66 + /// <value>Child identifier of the complex reference.</value>
67 + public string ChildId
68 + {
69 + get { return (string)this.Fields[3].Data; }
70 + set { this.Fields[3].Data = value; }
71 + }
72 +
73 + /// <summary>
74 + /// Gets if this is the primary complex reference.
75 + /// </summary>
76 + /// <value>true if primary complex reference.</value>
77 + public bool IsPrimary
78 + {
79 + get
80 + {
81 + return (0x1 == ((int)this.Fields[5].Data & 0x1));
82 + }
83 +
84 + set
85 + {
86 + if (null == this.Fields[5].Data)
87 + {
88 + this.Fields[5].Data = 0;
89 + }
90 +
91 + if (value)
92 + {
93 + this.Fields[5].Data = (int)this.Fields[5].Data | 0x1;
94 + }
95 + else
96 + {
97 + this.Fields[5].Data = (int)this.Fields[5].Data & ~0x1;
98 + }
99 + }
100 + }
101 +
102 + /// <summary>
103 + /// Determines if two complex references are equivalent.
104 + /// </summary>
105 + /// <param name="obj">Complex reference to compare.</param>
106 + /// <returns>True if complex references are equivalent.</returns>
107 + public override bool Equals(object obj)
108 + {
109 + return 0 == this.CompareTo(obj);
110 + }
111 +
112 + /// <summary>
113 + /// Gets the hash code for the complex reference.
114 + /// </summary>
115 + /// <returns>Hash code for the complex reference.</returns>
116 + public override int GetHashCode()
117 + {
118 + return this.ChildType.GetHashCode() ^ this.ChildId.GetHashCode() ^ this.ParentType.GetHashCode() ^ this.ParentLanguage.GetHashCode() ^ this.ParentId.GetHashCode() ^ this.IsPrimary.GetHashCode();
119 + }
120 +
121 + /// <summary>
122 + /// Compares two complex references.
123 + /// </summary>
124 + /// <param name="obj">Complex reference to compare to.</param>
125 + /// <returns>Zero if the objects are equivalent, negative number if the provided object is less, positive if greater.</returns>
126 + public int CompareTo(object obj)
127 + {
128 + int comparison = this.CompareToWithoutConsideringPrimary(obj);
129 + if (0 == comparison)
130 + {
131 + comparison = ((WixComplexReferenceRow)obj).IsPrimary.CompareTo(this.IsPrimary); // Note: the order of these is purposely switched to ensure that "Yes" is lower than "No" and "NotSet"
132 + }
133 + return comparison;
134 + }
135 +
136 + /// <summary>
137 + /// Compares two complex references without considering the primary bit.
138 + /// </summary>
139 + /// <param name="obj">Complex reference to compare to.</param>
140 + /// <returns>Zero if the objects are equivalent, negative number if the provided object is less, positive if greater.</returns>
141 + [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.ArgumentException.#ctor(System.String,System.String)")]
142 + public int CompareToWithoutConsideringPrimary(object obj)
143 + {
144 + var other = obj as WixComplexReferenceRow ?? throw new ArgumentNullException(nameof(obj));
145 +
146 + int comparison = this.ChildType - other.ChildType;
147 + if (0 == comparison)
148 + {
149 + comparison = String.Compare(this.ChildId, other.ChildId, StringComparison.Ordinal);
150 + if (0 == comparison)
151 + {
152 + comparison = this.ParentType - other.ParentType;
153 + if (0 == comparison)
154 + {
155 + string thisParentLanguage = null == this.ParentLanguage ? String.Empty : this.ParentLanguage;
156 + string otherParentLanguage = null == other.ParentLanguage ? String.Empty : other.ParentLanguage;
157 + comparison = String.Compare(thisParentLanguage, otherParentLanguage, StringComparison.Ordinal);
158 + if (0 == comparison)
159 + {
160 + comparison = String.Compare(this.ParentId, other.ParentId, StringComparison.Ordinal);
161 + }
162 + }
163 + }
164 + }
165 +
166 + return comparison;
167 + }
168 +
169 + /// <summary>
170 + /// Creates a shallow copy of the ComplexReference.
171 + /// </summary>
172 + /// <returns>A shallow copy of the ComplexReference.</returns>
173 + public WixComplexReferenceRow Clone()
174 + {
175 + WixComplexReferenceRow wixComplexReferenceRow = new WixComplexReferenceRow(this.SourceLineNumbers, this.Table);
176 + wixComplexReferenceRow.ParentType = this.ParentType;
177 + wixComplexReferenceRow.ParentId = this.ParentId;
178 + wixComplexReferenceRow.ParentLanguage = this.ParentLanguage;
179 + wixComplexReferenceRow.ChildType = this.ChildType;
180 + wixComplexReferenceRow.ChildId = this.ChildId;
181 + wixComplexReferenceRow.IsPrimary = this.IsPrimary;
182 +
183 + return wixComplexReferenceRow;
184 + }
185 +
186 + /// <summary>
187 + /// Changes all of the parent references to point to the passed in parent reference.
188 + /// </summary>
189 + /// <param name="parent">New parent complex reference.</param>
190 + public void Reparent(WixComplexReferenceRow parent)
191 + {
192 + this.ParentId = parent.ParentId;
193 + this.ParentLanguage = parent.ParentLanguage;
194 + this.ParentType = parent.ParentType;
195 +
196 + if (!this.IsPrimary)
197 + {
198 + this.IsPrimary = parent.IsPrimary;
199 + }
200 + }
201 + }
202 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixDeltaPatchFileRow.cs new
+142
@@ -0,0 +1,142 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the WixDeltaPatchFile table.
7 + /// </summary>
8 + public sealed class WixDeltaPatchFileRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a WixDeltaPatchFile row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this Media row belongs to and should get its column definitions from.</param>
15 + public WixDeltaPatchFileRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a WixDeltaPatchFile row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this File row belongs to and should get its column definitions from.</param>
25 + public WixDeltaPatchFileRow(SourceLineNumber sourceLineNumbers, Table table) :
26 + base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the primary key of the file row.
32 + /// </summary>
33 + /// <value>Primary key of the file row.</value>
34 + public string File
35 + {
36 + get { return (string)this.Fields[0].Data; }
37 + set { this.Fields[0].Data = value; }
38 + }
39 +
40 + /// <summary>
41 + /// Gets or sets the delta patch retain-length list for the file.
42 + /// </summary>
43 + /// <value>RetainLength list for the file.</value>
44 + public string RetainLengths
45 + {
46 + get { return (string)this.Fields[1].Data; }
47 + set { this.Fields[1].Data = value; }
48 + }
49 +
50 + /// <summary>
51 + /// Gets or sets the previous delta patch retain-length list for the file.
52 + /// </summary>
53 + /// <value>Previous RetainLength list for the file.</value>
54 + public string PreviousRetainLengths
55 + {
56 + get { return this.Fields[1].PreviousData; }
57 + set { this.Fields[1].PreviousData = value; }
58 + }
59 +
60 + /// <summary>
61 + /// Gets or sets the delta patch ignore-offset list for the file.
62 + /// </summary>
63 + /// <value>IgnoreOffset list for the file.</value>
64 + public string IgnoreOffsets
65 + {
66 + get { return (string)this.Fields[2].Data; }
67 + set { this.Fields[2].Data = value; }
68 + }
69 +
70 + /// <summary>
71 + /// Gets or sets the previous delta patch ignore-offset list for the file.
72 + /// </summary>
73 + /// <value>Previous IgnoreOffset list for the file.</value>
74 + public string PreviousIgnoreOffsets
75 + {
76 + get { return this.Fields[2].PreviousData; }
77 + set { this.Fields[2].PreviousData = value; }
78 + }
79 +
80 + /// <summary>
81 + /// Gets or sets the delta patch ignore-length list for the file.
82 + /// </summary>
83 + /// <value>IgnoreLength list for the file.</value>
84 + public string IgnoreLengths
85 + {
86 + get { return (string)this.Fields[3].Data; }
87 + set { this.Fields[3].Data = value; }
88 + }
89 +
90 + /// <summary>
91 + /// Gets or sets the previous delta patch ignore-length list for the file.
92 + /// </summary>
93 + /// <value>Previous IgnoreLength list for the file.</value>
94 + public string PreviousIgnoreLengths
95 + {
96 + get { return this.Fields[3].PreviousData; }
97 + set { this.Fields[3].PreviousData = value; }
98 + }
99 +
100 + /// <summary>
101 + /// Gets or sets the delta patch retain-offset list for the file.
102 + /// </summary>
103 + /// <value>RetainOffset list for the file.</value>
104 + public string RetainOffsets
105 + {
106 + get { return (string)this.Fields[4].Data; }
107 + set { this.Fields[4].Data = value; }
108 + }
109 +
110 + /// <summary>
111 + /// Gets or sets the previous delta patch retain-offset list for the file.
112 + /// </summary>
113 + /// <value>PreviousRetainOffset list for the file.</value>
114 + public string PreviousRetainOffsets
115 + {
116 + get { return this.Fields[4].PreviousData; }
117 + set { this.Fields[4].PreviousData = value; }
118 + }
119 +
120 + /// <summary>
121 + /// Gets or sets the symbol paths for the file.
122 + /// </summary>
123 + /// <value>SymbolPath list for the file.</value>
124 + /// <remarks>This is set during binding.</remarks>
125 + public string Symbols
126 + {
127 + get { return (string)this.Fields[5].Data; }
128 + set { this.Fields[5].Data = value; }
129 + }
130 +
131 + /// <summary>
132 + /// Gets or sets the previous symbol paths for the file.
133 + /// </summary>
134 + /// <value>PreviousSymbolPath list for the file.</value>
135 + /// <remarks>This is set during binding.</remarks>
136 + public string PreviousSymbols
137 + {
138 + get { return (string)this.Fields[5].PreviousData; }
139 + set { this.Fields[5].PreviousData = value; }
140 + }
141 + }
142 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixDeltaPatchSymbolPathsRow.cs new
+60
@@ -0,0 +1,60 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using WixToolset.Data.Tuples;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the WixDeltaPatchSymbolPaths table.
9 + /// </summary>
10 + public sealed class WixDeltaPatchSymbolPathsRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a WixDeltaPatchSymbolPaths row that does not belong to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="tableDef">TableDefinition this row belongs to and should get its column definitions from.</param>
17 + public WixDeltaPatchSymbolPathsRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
18 + base(sourceLineNumbers, tableDef)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Creates a WixDeltaPatchSymbolPaths row that belongs to a table.
24 + /// </summary>
25 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
26 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
27 + public WixDeltaPatchSymbolPathsRow(SourceLineNumber sourceLineNumbers, Table table) :
28 + base(sourceLineNumbers, table)
29 + {
30 + }
31 +
32 + /// <summary>
33 + /// Gets or sets the identifier the symbol paths apply to.
34 + /// </summary>
35 + /// <value>RetainLength list for the file.</value>
36 + public string Id
37 + {
38 + get { return (string)this.Fields[0].Data; }
39 + set { this.Fields[0].Data = value; }
40 + }
41 +
42 + /// <summary>
43 + /// Gets or sets the type of the identifier.
44 + /// </summary>
45 + public SymbolPathType Type
46 + {
47 + get { return (SymbolPathType)this.Fields[1].AsInteger(); }
48 + set { this.Fields[1].Data = value; }
49 + }
50 +
51 + /// <summary>
52 + /// Gets or sets the delta patch symbol paths.
53 + /// </summary>
54 + public string SymbolPaths
55 + {
56 + get { return (string)this.Fields[2].Data; }
57 + set { this.Fields[2].Data = value; }
58 + }
59 + }
60 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixFileRow.cs new
+163
@@ -0,0 +1,163 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using WixToolset.Data.Tuples;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the WixFile table.
9 + /// </summary>
10 + public sealed class WixFileRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a WixFile row that does not belong to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="tableDef">TableDefinition this row belongs to and should get its column definitions from.</param>
17 + public WixFileRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
18 + base(sourceLineNumbers, tableDef)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Creates a WixFile row that belongs to a table.
24 + /// </summary>
25 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
26 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
27 + public WixFileRow(SourceLineNumber sourceLineNumbers, Table table) :
28 + base(sourceLineNumbers, table)
29 + {
30 + }
31 +
32 + /// <summary>
33 + /// Gets or sets the primary key of the file row.
34 + /// </summary>
35 + /// <value>Primary key of the file row.</value>
36 + public string File
37 + {
38 + get { return (string)this.Fields[0].Data; }
39 + set { this.Fields[0].Data = value; }
40 + }
41 +
42 + /// <summary>
43 + /// Gets or sets the assembly type of the file row.
44 + /// </summary>
45 + /// <value>Assembly type of the file row.</value>
46 + public FileAssemblyType AssemblyType
47 + {
48 + get { return (null == this.Fields[1]) ? FileAssemblyType.NotAnAssembly : (FileAssemblyType)this.Fields[1].AsInteger(); }
49 + set { this.Fields[1].Data = (int)value; }
50 + }
51 +
52 + /// <summary>
53 + /// Gets or sets the identifier for the assembly manifest.
54 + /// </summary>
55 + /// <value>Identifier for the assembly manifest.</value>
56 + public string AssemblyManifest
57 + {
58 + get { return (string)this.Fields[2].Data; }
59 + set { this.Fields[2].Data = value; }
60 + }
61 +
62 + /// <summary>
63 + /// Gets or sets the application for the assembly.
64 + /// </summary>
65 + /// <value>Application for the assembly.</value>
66 + public string AssemblyApplication
67 + {
68 + get { return (string)this.Fields[3].Data; }
69 + set { this.Fields[3].Data = value; }
70 + }
71 +
72 + /// <summary>
73 + /// Gets or sets the directory of the file.
74 + /// </summary>
75 + /// <value>Directory of the file.</value>
76 + public string Directory
77 + {
78 + get { return (string)this.Fields[4].Data; }
79 + set { this.Fields[4].Data = value; }
80 + }
81 +
82 + /// <summary>
83 + /// Gets or sets the disk id for this file.
84 + /// </summary>
85 + /// <value>Disk id for the file.</value>
86 + public int DiskId
87 + {
88 + get { return (int)this.Fields[5].Data; }
89 + set { this.Fields[5].Data = value; }
90 + }
91 +
92 + /// <summary>
93 + /// Gets or sets the source location to the file.
94 + /// </summary>
95 + /// <value>Source location to the file.</value>
96 + public string Source
97 + {
98 + get { return (string)this.Fields[6].Data; }
99 + set { this.Fields[6].Data = value; }
100 + }
101 +
102 + /// <summary>
103 + /// Gets or sets the source location to the file.
104 + /// </summary>
105 + /// <value>Source location to the file.</value>
106 + public string PreviousSource
107 + {
108 + get { return (string)this.Fields[6].PreviousData; }
109 + set { this.Fields[6].PreviousData = value; }
110 + }
111 +
112 + /// <summary>
113 + /// Gets or sets the architecture the file executes on.
114 + /// </summary>
115 + /// <value>Architecture the file executes on.</value>
116 + public string ProcessorArchitecture
117 + {
118 + get { return (string)this.Fields[7].Data; }
119 + set { this.Fields[7].Data = value; }
120 + }
121 +
122 + /// <summary>
123 + /// Gets or sets the patch group of a patch-added file.
124 + /// </summary>
125 + /// <value>The patch group of a patch-added file.</value>
126 + public int PatchGroup
127 + {
128 + get { return (null == this.Fields[8].Data) ? 0 : (int)this.Fields[8].Data; }
129 + set { this.Fields[8].Data = value; }
130 + }
131 +
132 + /// <summary>
133 + /// Gets or sets the attributes on a file.
134 + /// </summary>
135 + /// <value>Attributes on a file.</value>
136 + public int Attributes
137 + {
138 + get { return (int)this.Fields[9].Data; }
139 + set { this.Fields[9].Data = value; }
140 + }
141 +
142 + /// <summary>
143 + /// Gets or sets the patching attributes to the file.
144 + /// </summary>
145 + /// <value>Patching attributes of the file.</value>
146 + public PatchAttributeType PatchAttributes
147 + {
148 + get { return (PatchAttributeType)this.Fields[10].AsInteger(); }
149 + set { this.Fields[10].Data = (int)value; }
150 + }
151 +
152 + /// <summary>
153 + /// Gets or sets the path to the delta patch header.
154 + /// </summary>
155 + /// <value>Patch header path.</value>
156 + /// <remarks>Set by the binder only when doing delta patching.</remarks>
157 + public string DeltaPatchHeaderSource
158 + {
159 + get { return (string)this.Fields[11].Data; }
160 + set { this.Fields[11].Data = value; }
161 + }
162 + }
163 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixGroupRow.cs new
+62
@@ -0,0 +1,62 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the WixGroup table.
9 + /// </summary>
10 + public sealed class WixGroupRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a WixGroupRow row that belongs to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
17 + public WixGroupRow(SourceLineNumber sourceLineNumbers, Table table)
18 + : base(sourceLineNumbers, table)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Gets or sets the parent identifier of the complex reference.
24 + /// </summary>
25 + /// <value>Parent identifier of the complex reference.</value>
26 + public string ParentId
27 + {
28 + get { return (string)this.Fields[0].Data; }
29 + set { this.Fields[0].Data = value; }
30 + }
31 +
32 + /// <summary>
33 + /// Gets the parent type of the complex reference.
34 + /// </summary>
35 + /// <value>Parent type of the complex reference.</value>
36 + public ComplexReferenceParentType ParentType
37 + {
38 + get { return (ComplexReferenceParentType)Enum.Parse(typeof(ComplexReferenceParentType), (string)this.Fields[1].Data); }
39 + set { this.Fields[1].Data = value.ToString(); }
40 + }
41 +
42 + /// <summary>
43 + /// Gets the child identifier of the complex reference.
44 + /// </summary>
45 + /// <value>Child identifier of the complex reference.</value>
46 + public string ChildId
47 + {
48 + get { return (string)this.Fields[2].Data; }
49 + set { this.Fields[2].Data = value; }
50 + }
51 +
52 + /// <summary>
53 + /// Gets the child type of the complex reference.
54 + /// </summary>
55 + /// <value>Child type of the complex reference.</value>
56 + public ComplexReferenceChildType ChildType
57 + {
58 + get { return (ComplexReferenceChildType)Enum.Parse(typeof(ComplexReferenceChildType), (string)this.Fields[3].Data); }
59 + set { this.Fields[3].Data = value.ToString(); }
60 + }
61 + }
62 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixMediaRow.cs new
+60
@@ -0,0 +1,60 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the WixMedia table.
7 + /// </summary>
8 + public sealed class WixMediaRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a WixMedia row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this Media row belongs to and should get its column definitions from.</param>
15 + public WixMediaRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a WixMedia row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this Media row belongs to and should get its column definitions from.</param>
25 + public WixMediaRow(SourceLineNumber sourceLineNumbers, Table table) :
26 + base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the disk id for this media.
32 + /// </summary>
33 + /// <value>Disk id for the media.</value>
34 + public int DiskId
35 + {
36 + get { return (int)this.Fields[0].Data; }
37 + set { this.Fields[0].Data = value; }
38 + }
39 +
40 + /// <summary>
41 + /// Gets or sets the compression level for this media row.
42 + /// </summary>
43 + /// <value>Compression level.</value>
44 + public CompressionLevel? CompressionLevel
45 + {
46 + get { return (CompressionLevel?)this.Fields[1].AsNullableInteger(); }
47 + set { this.Fields[1].Data = value; }
48 + }
49 +
50 + /// <summary>
51 + /// Gets or sets the layout location for this media row.
52 + /// </summary>
53 + /// <value>Layout location to the root of the media.</value>
54 + public string Layout
55 + {
56 + get { return (string)this.Fields[2].Data; }
57 + set { this.Fields[2].Data = value; }
58 + }
59 + }
60 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixMediaTemplateRow.cs new
+81
@@ -0,0 +1,81 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the MediaTemplate table.
7 + /// </summary>
8 + public sealed class WixMediaTemplateRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a MediaTemplate row that belongs to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="table">Table this MediaTeplate row belongs to and should get its column definitions from.</param>
15 + public WixMediaTemplateRow(SourceLineNumber sourceLineNumbers, Table table)
16 + : base(sourceLineNumbers, table)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Gets or sets the cabinet template name for this media template row.
22 + /// </summary>
23 + /// <value>Cabinet name.</value>
24 + public string CabinetTemplate
25 + {
26 + get { return (string)this.Fields[0].Data; }
27 + set { this.Fields[0].Data = value; }
28 + }
29 +
30 + /// <summary>
31 + /// Gets or sets the compression level for this media template row.
32 + /// </summary>
33 + /// <value>Compression level.</value>
34 + public CompressionLevel? CompressionLevel
35 + {
36 + get { return (CompressionLevel?)this.Fields[1].AsNullableInteger(); }
37 + set { this.Fields[1].Data = value; }
38 + }
39 +
40 + /// <summary>
41 + /// Gets or sets the disk prompt for this media template row.
42 + /// </summary>
43 + /// <value>Disk prompt.</value>
44 + public string DiskPrompt
45 + {
46 + get { return (string)this.Fields[2].Data; }
47 + set { this.Fields[2].Data = value; }
48 + }
49 +
50 +
51 + /// <summary>
52 + /// Gets or sets the volume label for this media template row.
53 + /// </summary>
54 + /// <value>Volume label.</value>
55 + public string VolumeLabel
56 + {
57 + get { return (string)this.Fields[3].Data; }
58 + set { this.Fields[3].Data = value; }
59 + }
60 +
61 + /// <summary>
62 + /// Gets or sets the maximum uncompressed media size for this media template row.
63 + /// </summary>
64 + /// <value>Disk id.</value>
65 + public int MaximumUncompressedMediaSize
66 + {
67 + get { return (int)this.Fields[4].Data; }
68 + set { this.Fields[4].Data = value; }
69 + }
70 +
71 + /// <summary>
72 + /// Gets or sets the Maximum Cabinet Size For Large File Splitting for this media template row.
73 + /// </summary>
74 + /// <value>Disk id.</value>
75 + public int MaximumCabinetSizeForLargeFileSplitting
76 + {
77 + get { return (int)this.Fields[5].Data; }
78 + set { this.Fields[5].Data = value; }
79 + }
80 + }
81 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixMergeRow.cs new
+147
@@ -0,0 +1,147 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 + using System.Globalization;
7 +
8 + /// <summary>
9 + /// Specialization of a row for tracking merge statements.
10 + /// </summary>
11 + public sealed class WixMergeRow : Row
12 + {
13 + /// <summary>
14 + /// Creates a Merge row that does not belong to a table.
15 + /// </summary>
16 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
17 + /// <param name="tableDef">TableDefinition this Merge row belongs to and should get its column definitions from.</param>
18 + public WixMergeRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
19 + base(sourceLineNumbers, tableDef)
20 + {
21 + }
22 +
23 + /// <summary>Creates a Merge row that belongs to a table.</summary>
24 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
25 + /// <param name="table">Table this Merge row belongs to and should get its column definitions from.</param>
26 + public WixMergeRow(SourceLineNumber sourceLineNumbers, Table table) :
27 + base(sourceLineNumbers, table)
28 + {
29 + }
30 +
31 + /// <summary>
32 + /// Gets and sets the id for a merge row.
33 + /// </summary>
34 + /// <value>Id for the row.</value>
35 + public string Id
36 + {
37 + get { return (string)this.Fields[0].Data; }
38 + set { this.Fields[0].Data = value; }
39 + }
40 +
41 + /// <summary>
42 + /// Gets and sets the language for a merge row.
43 + /// </summary>
44 + /// <value>Language for the row.</value>
45 + public string Language
46 + {
47 + get { return (string)this.Fields[1].Data; }
48 + set { this.Fields[1].Data = value; }
49 + }
50 +
51 + /// <summary>
52 + /// Gets and sets the directory for a merge row.
53 + /// </summary>
54 + /// <value>Direcotory for the row.</value>
55 + public string Directory
56 + {
57 + get { return (string)this.Fields[2].Data; }
58 + set { this.Fields[2].Data = value; }
59 + }
60 +
61 + /// <summary>
62 + /// Gets and sets the path to the merge module for a merge row.
63 + /// </summary>
64 + /// <value>Source path for the row.</value>
65 + public string SourceFile
66 + {
67 + get { return (string)this.Fields[3].Data; }
68 + set { this.Fields[3].Data = value; }
69 + }
70 +
71 + /// <summary>
72 + /// Gets and sets the disk id the merge module should be placed on for a merge row.
73 + /// </summary>
74 + /// <value>Disk identifier for row.</value>
75 + public int DiskId
76 + {
77 + get { return (int)this.Fields[4].Data; }
78 + set { this.Fields[4].Data = value; }
79 + }
80 +
81 + /// <summary>
82 + /// Gets and sets the compression value for a merge row.
83 + /// </summary>
84 + /// <value>Compression for a merge row.</value>
85 + public YesNoType FileCompression
86 + {
87 + get
88 + {
89 + if (null == this.Fields[5].Data)
90 + {
91 + return YesNoType.NotSet;
92 + }
93 + else if (1 == (int)this.Fields[5].Data)
94 + {
95 + return YesNoType.Yes;
96 + }
97 + else if (0 == (int)this.Fields[5].Data)
98 + {
99 + return YesNoType.No;
100 + }
101 + else
102 + {
103 + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixDataStrings.EXP_MergeTableFileCompressionColumnContainsInvalidValue, this.Fields[5].Data));
104 + }
105 + }
106 + set
107 + {
108 + if (YesNoType.Yes == value)
109 + {
110 + this.Fields[5].Data = 1;
111 + }
112 + else if (YesNoType.No == value)
113 + {
114 + this.Fields[5].Data = 0;
115 + }
116 + else if (YesNoType.NotSet == value)
117 + {
118 + this.Fields[5].Data = null;
119 + }
120 + else
121 + {
122 + throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixDataStrings.EXP_CannotSetMergeTableFileCompressionColumnToInvalidValue, value));
123 + }
124 + }
125 + }
126 +
127 + /// <summary>
128 + /// Gets and sets the configuration data for a merge row.
129 + /// </summary>
130 + /// <value>Comma delimited string of "name=value" pairs.</value>
131 + public string ConfigurationData
132 + {
133 + get { return (string)this.Fields[6].Data; }
134 + set { this.Fields[6].Data = value; }
135 + }
136 +
137 + /// <summary>
138 + /// Gets and sets the primary feature for a merge row.
139 + /// </summary>
140 + /// <value>The primary feature for a merge row.</value>
141 + public string Feature
142 + {
143 + get { return (string)this.Fields[7].Data; }
144 + set { this.Fields[7].Data = value; }
145 + }
146 + }
147 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixPayloadPropertiesRow.cs new
+72
@@ -0,0 +1,72 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + /// <summary>
6 + /// Specialization of a row for the WixPayloadProperties table.
7 + /// </summary>
8 + public class WixPayloadPropertiesRow : Row
9 + {
10 + /// <summary>
11 + /// Creates a WixPayloadProperties row that does not belong to a table.
12 + /// </summary>
13 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
14 + /// <param name="tableDef">TableDefinition this WixPayloadProperties row belongs to and should get its column definitions from.</param>
15 + public WixPayloadPropertiesRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
16 + base(sourceLineNumbers, tableDef)
17 + {
18 + }
19 +
20 + /// <summary>
21 + /// Creates a WixPayloadProperties row that belongs to a table.
22 + /// </summary>
23 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
24 + /// <param name="table">Table this WixPayloadProperties row belongs to and should get its column definitions from.</param>
25 + public WixPayloadPropertiesRow(SourceLineNumber sourceLineNumbers, Table table) :
26 + base(sourceLineNumbers, table)
27 + {
28 + }
29 +
30 + public string Id
31 + {
32 + get { return (string)this.Fields[0].Data; }
33 + set { this.Fields[0].Data = value; }
34 + }
35 +
36 + public string Package
37 + {
38 + get { return (string)this.Fields[1].Data; }
39 + set { this.Fields[1].Data = value; }
40 + }
41 +
42 + public string Container
43 + {
44 + get { return (string)this.Fields[2].Data; }
45 + set { this.Fields[2].Data = value; }
46 + }
47 +
48 + public string Name
49 + {
50 + get { return (string)this.Fields[3].Data; }
51 + set { this.Fields[3].Data = value; }
52 + }
53 +
54 + public string Size
55 + {
56 + get { return (string)this.Fields[4].Data; }
57 + set { this.Fields[4].Data = value; }
58 + }
59 +
60 + public string DownloadUrl
61 + {
62 + get { return (string)this.Fields[5].Data; }
63 + set { this.Fields[5].Data = value; }
64 + }
65 +
66 + public string LayoutOnly
67 + {
68 + get { return (string)this.Fields[6].Data; }
69 + set { this.Fields[6].Data = value; }
70 + }
71 + }
72 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixPropertyRow.cs new
+118
@@ -0,0 +1,118 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 + using System.Globalization;
7 +
8 + /// <summary>
9 + /// Specialization of a row for the WixProperty table.
10 + /// </summary>
11 + public sealed class WixPropertyRow : Row
12 + {
13 + /// <summary>Creates a WixProperty row that belongs to a table.</summary>
14 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
15 + /// <param name="table">Table this WixProperty row belongs to and should get its column definitions from.</param>
16 + public WixPropertyRow(SourceLineNumber sourceLineNumbers, Table table) :
17 + base(sourceLineNumbers, table)
18 + {
19 + }
20 +
21 + /// <summary>
22 + /// Gets and sets the id for this property row.
23 + /// </summary>
24 + /// <value>Id for the property.</value>
25 + public string Id
26 + {
27 + get { return (string)this.Fields[0].Data; }
28 + set { this.Fields[0].Data = value; }
29 + }
30 +
31 + /// <summary>
32 + /// Gets and sets if this is an admin property row.
33 + /// </summary>
34 + /// <value>Flag if this is an admin property.</value>
35 + public bool Admin
36 + {
37 + get
38 + {
39 + return (0x1 == (Convert.ToInt32(this.Fields[1].Data, CultureInfo.InvariantCulture) & 0x1));
40 + }
41 +
42 + set
43 + {
44 + if (null == this.Fields[1].Data)
45 + {
46 + this.Fields[1].Data = 0;
47 + }
48 +
49 + if (value)
50 + {
51 + this.Fields[1].Data = (int)this.Fields[1].Data | 0x1;
52 + }
53 + else
54 + {
55 + this.Fields[1].Data = (int)this.Fields[1].Data & ~0x1;
56 + }
57 + }
58 + }
59 +
60 + /// <summary>
61 + /// Gets and sets if this is a hidden property row.
62 + /// </summary>
63 + /// <value>Flag if this is a hidden property.</value>
64 + public bool Hidden
65 + {
66 + get
67 + {
68 + return (0x2 == (Convert.ToInt32(this.Fields[1].Data, CultureInfo.InvariantCulture) & 0x2));
69 + }
70 +
71 + set
72 + {
73 + if (null == this.Fields[1].Data)
74 + {
75 + this.Fields[1].Data = 0;
76 + }
77 +
78 + if (value)
79 + {
80 + this.Fields[1].Data = (int)this.Fields[1].Data | 0x2;
81 + }
82 + else
83 + {
84 + this.Fields[1].Data = (int)this.Fields[1].Data & ~0x2;
85 + }
86 + }
87 + }
88 +
89 + /// <summary>
90 + /// Gets and sets if this is a secure property row.
91 + /// </summary>
92 + /// <value>Flag if this is a secure property.</value>
93 + public bool Secure
94 + {
95 + get
96 + {
97 + return (0x4 == (Convert.ToInt32(this.Fields[1].Data, CultureInfo.InvariantCulture) & 0x4));
98 + }
99 +
100 + set
101 + {
102 + if (null == this.Fields[1].Data)
103 + {
104 + this.Fields[1].Data = 0;
105 + }
106 +
107 + if (value)
108 + {
109 + this.Fields[1].Data = (int)this.Fields[1].Data | 0x4;
110 + }
111 + else
112 + {
113 + this.Fields[1].Data = (int)this.Fields[1].Data & ~0x4;
114 + }
115 + }
116 + }
117 + }
118 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixRelatedBundleRow.cs new
+52
@@ -0,0 +1,52 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using Serialize = WixToolset.Data.Serialize;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the RelatedBundle table.
9 + /// </summary>
10 + public sealed class WixRelatedBundleRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a RelatedBundle row that does not belong to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="tableDef">TableDefinition this RelatedBundle row belongs to and should get its column definitions from.</param>
17 + public WixRelatedBundleRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
18 + base(sourceLineNumbers, tableDef)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Creates a RelatedBundle row that belongs to a table.
24 + /// </summary>
25 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
26 + /// <param name="table">Table this RelatedBundle row belongs to and should get its column definitions from.</param>
27 + public WixRelatedBundleRow(SourceLineNumber sourceLineNumbers, Table table)
28 + : base(sourceLineNumbers, table)
29 + {
30 + }
31 +
32 + /// <summary>
33 + /// Gets or sets the related bundle identifier.
34 + /// </summary>
35 + /// <value>The related bundle identifier.</value>
36 + public string Id
37 + {
38 + get { return (string)this.Fields[0].Data; }
39 + set { this.Fields[0].Data = value; }
40 + }
41 +
42 + /// <summary>
43 + /// Gets or sets the related bundle action.
44 + /// </summary>
45 + /// <value>The related bundle action.</value>
46 + public Serialize.RelatedBundle.ActionType Action
47 + {
48 + get { return (Serialize.RelatedBundle.ActionType)this.Fields[1].Data; }
49 + set { this.Fields[1].Data = (int)value; }
50 + }
51 + }
52 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixSimpleReferenceRow.cs new
+61
@@ -0,0 +1,61 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 +
7 + /// <summary>
8 + /// Specialization of a row for the WixSimpleReference table.
9 + /// </summary>
10 + public sealed class WixSimpleReferenceRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a WixSimpleReferenceRow that belongs to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="table">Table this row belongs to and should get its column definitions from.</param>
17 + public WixSimpleReferenceRow(SourceLineNumber sourceLineNumbers, Table table)
18 + : base(sourceLineNumbers, table)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Creates a WixSimpleReferenceRow that belongs to a table.
24 + /// </summary>
25 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
26 + /// <param name="tableDefinitions">Table definitions for this row.</param>
27 + public WixSimpleReferenceRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinitions)
28 + : base(sourceLineNumbers, tableDefinitions)
29 + {
30 + }
31 +
32 + /// <summary>
33 + /// Gets or sets the primary keys of the simple reference.
34 + /// </summary>
35 + /// <value>The primary keys of the simple reference.</value>
36 + public string PrimaryKeys
37 + {
38 + get { return (string)this.Fields[1].Data; }
39 + set { this.Fields[1].Data = value; }
40 + }
41 +
42 + /// <summary>
43 + /// Gets the symbolic name.
44 + /// </summary>
45 + /// <value>Symbolic name.</value>
46 + public string SymbolicName
47 + {
48 + get { return String.Concat(this.TableName, ":", this.PrimaryKeys); }
49 + }
50 +
51 + /// <summary>
52 + /// Gets or sets the table name of the simple reference.
53 + /// </summary>
54 + /// <value>The table name of the simple reference.</value>
55 + public string TableName
56 + {
57 + get { return (string)this.Fields[0].Data; }
58 + set { this.Fields[0].Data = value; }
59 + }
60 + }
61 +}
src/WixToolset.Data/WindowsInstaller/Rows/WixUpdateRegistrationRow.cs new
+62
@@ -0,0 +1,62 @@
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.Data.WindowsInstaller.Rows
4 +{
5 + using System;
6 +
7 + /// <summary>
8 + /// Update registration information for Binding.
9 + /// </summary>
10 + public class WixUpdateRegistrationRow : Row
11 + {
12 + /// <summary>
13 + /// Creates a WixUpdateRegistrationRow row that does not belong to a table.
14 + /// </summary>
15 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
16 + /// <param name="tableDef">TableDefinition this WixUpdateRegistrationRow row belongs to and should get its column definitions from.</param>
17 + public WixUpdateRegistrationRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDef) :
18 + base(sourceLineNumbers, tableDef)
19 + {
20 + }
21 +
22 + /// <summary>
23 + /// Creates a WixUpdateRegistrationRow row that belongs to a table.
24 + /// </summary>
25 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
26 + /// <param name="table">Table this WixUpdateRegistrationRow row belongs to and should get its column definitions from.</param>
27 + public WixUpdateRegistrationRow(SourceLineNumber sourceLineNumbers, Table table) :
28 + base(sourceLineNumbers, table)
29 + {
30 + }
31 +
32 + public string Manufacturer
33 + {
34 + get { return (string)this.Fields[0].Data; }
35 + set { this.Fields[0].Data = value; }
36 + }
37 +
38 + public string Department
39 + {
40 + get { return (string)this.Fields[1].Data; }
41 + set { this.Fields[1].Data = value; }
42 + }
43 +
44 + public string ProductFamily
45 + {
46 + get { return (string)this.Fields[2].Data; }
47 + set { this.Fields[2].Data = value; }
48 + }
49 +
50 + public string Name
51 + {
52 + get { return (string)this.Fields[3].Data; }
53 + set { this.Fields[3].Data = value; }
54 + }
55 +
56 + public string Classification
57 + {
58 + get { return (string)this.Fields[4].Data; }
59 + set { this.Fields[4].Data = value; }
60 + }
61 + }
62 +}
src/WixToolset.Data/WindowsInstaller/SubStorage.cs new
+109
@@ -0,0 +1,109 @@
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.Data.WindowsInstaller
4 +{
5 + using System.Xml;
6 +
7 + /// <summary>
8 + /// Substorage inside an output.
9 + /// </summary>
10 + public sealed class SubStorage
11 + {
12 + /// <summary>
13 + /// Instantiate a new substorage.
14 + /// </summary>
15 + /// <param name="name">The substorage name.</param>
16 + /// <param name="data">The substorage data.</param>
17 + public SubStorage(string name, Output data)
18 + {
19 + this.Name = name;
20 + this.Data = data;
21 + }
22 +
23 + /// <summary>
24 + /// Gets the substorage name.
25 + /// </summary>
26 + /// <value>The substorage name.</value>
27 + public string Name { get; }
28 +
29 + /// <summary>
30 + /// Gets the substorage data.
31 + /// </summary>
32 + /// <value>The substorage data.</value>
33 + public Output Data { get; }
34 +
35 + /// <summary>
36 + /// Creates a SubStorage from the XmlReader.
37 + /// </summary>
38 + /// <param name="reader">Reader to get data from.</param>
39 + /// <returns>New SubStorage object.</returns>
40 + internal static SubStorage Read(XmlReader reader)
41 + {
42 + if (!reader.LocalName.Equals("subStorage" == reader.LocalName))
43 + {
44 + throw new XmlException();
45 + }
46 +
47 + Output data = null;
48 + bool empty = reader.IsEmptyElement;
49 + string name = null;
50 +
51 + while (reader.MoveToNextAttribute())
52 + {
53 + switch (reader.LocalName)
54 + {
55 + case "name":
56 + name = reader.Value;
57 + break;
58 + }
59 + }
60 +
61 + if (!empty)
62 + {
63 + bool done = false;
64 +
65 + while (!done && reader.Read())
66 + {
67 + switch (reader.NodeType)
68 + {
69 + case XmlNodeType.Element:
70 + switch (reader.LocalName)
71 + {
72 + case "wixOutput":
73 + data = Output.Read(reader, true);
74 + break;
75 + default:
76 + throw new XmlException();
77 + }
78 + break;
79 + case XmlNodeType.EndElement:
80 + done = true;
81 + break;
82 + }
83 + }
84 +
85 + if (!done)
86 + {
87 + throw new XmlException();
88 + }
89 + }
90 +
91 + return new SubStorage(name, data);
92 + }
93 +
94 + /// <summary>
95 + /// Persists a SubStorage in an XML format.
96 + /// </summary>
97 + /// <param name="writer">XmlWriter where the SubStorage should persist itself as XML.</param>
98 + internal void Write(XmlWriter writer)
99 + {
100 + writer.WriteStartElement("subStorage", Output.XmlNamespaceUri);
101 +
102 + writer.WriteAttributeString("name", this.Name);
103 +
104 + this.Data.Write(writer);
105 +
106 + writer.WriteEndElement();
107 + }
108 + }
109 +}
src/WixToolset.Data/WindowsInstaller/Table.cs new
+333
@@ -0,0 +1,333 @@
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.Data.WindowsInstaller
4 +{
5 + using System;
6 + using System.Collections.Generic;
7 + using System.Diagnostics;
8 + using System.Xml;
9 + using WixToolset.Data.WindowsInstaller.Rows;
10 +
11 + /// <summary>
12 + /// Object that represents a table in a database.
13 + /// </summary>
14 + public class Table
15 + {
16 + /// <summary>
17 + /// Creates a table.
18 + /// </summary>
19 + /// <param name="tableDefinition">Definition of the table.</param>
20 + public Table(TableDefinition tableDefinition)
21 + {
22 + this.Definition = tableDefinition;
23 + this.Rows = new List<Row>();
24 + }
25 +
26 + /// <summary>
27 + /// Gets the table definition.
28 + /// </summary>
29 + /// <value>Definition of the table.</value>
30 + public TableDefinition Definition { get; }
31 +
32 + /// <summary>
33 + /// Gets the name of the table.
34 + /// </summary>
35 + /// <value>Name of the table.</value>
36 + public string Name => this.Definition.Name;
37 +
38 + /// <summary>
39 + /// Gets or sets the table transform operation.
40 + /// </summary>
41 + /// <value>The table transform operation.</value>
42 + public TableOperation Operation { get; set; }
43 +
44 + /// <summary>
45 + /// Gets the rows contained in the table.
46 + /// </summary>
47 + /// <value>Rows contained in the table.</value>
48 + public IList<Row> Rows { get; }
49 +
50 + /// <summary>
51 + /// Creates a new row in the table.
52 + /// </summary>
53 + /// <param name="sourceLineNumbers">Original source lines for this row.</param>
54 + /// <param name="add">Specifies whether to only create the row or add it to the table automatically.</param>
55 + /// <returns>Row created in table.</returns>
56 + public Row CreateRow(SourceLineNumber sourceLineNumbers, bool add = true)
57 + {
58 + Row row;
59 +
60 + switch (this.Name)
61 + {
62 + case "BBControl":
63 + row = new BBControlRow(sourceLineNumbers, this);
64 + break;
65 + case "WixBundlePackage":
66 + row = new WixBundlePackageRow(sourceLineNumbers, this);
67 + break;
68 + case "WixBundleExePackage":
69 + row = new WixBundleExePackageRow(sourceLineNumbers, this);
70 + break;
71 + case "WixBundleMsiPackage":
72 + row = new WixBundleMsiPackageRow(sourceLineNumbers, this);
73 + break;
74 + case "WixBundleMspPackage":
75 + row = new WixBundleMspPackageRow(sourceLineNumbers, this);
76 + break;
77 + case "WixBundleMsuPackage":
78 + row = new WixBundleMsuPackageRow(sourceLineNumbers, this);
79 + break;
80 + case "Component":
81 + row = new ComponentRow(sourceLineNumbers, this);
82 + break;
83 + case "WixBundleContainer":
84 + row = new WixBundleContainerRow(sourceLineNumbers, this);
85 + break;
86 + case "Control":
87 + row = new ControlRow(sourceLineNumbers, this);
88 + break;
89 + case "File":
90 + row = new FileRow(sourceLineNumbers, this);
91 + break;
92 + case "WixBundleMsiFeature":
93 + row = new WixBundleMsiFeatureRow(sourceLineNumbers, this);
94 + break;
95 + case "WixBundleMsiProperty":
96 + row = new WixBundleMsiPropertyRow(sourceLineNumbers, this);
97 + break;
98 + case "Media":
99 + row = new MediaRow(sourceLineNumbers, this);
100 + break;
101 + case "WixBundlePayload":
102 + row = new WixBundlePayloadRow(sourceLineNumbers, this);
103 + break;
104 + case "Property":
105 + row = new PropertyRow(sourceLineNumbers, this);
106 + break;
107 + case "WixRelatedBundle":
108 + row = new WixRelatedBundleRow(sourceLineNumbers, this);
109 + break;
110 + case "WixBundleRelatedPackage":
111 + row = new WixBundleRelatedPackageRow(sourceLineNumbers, this);
112 + break;
113 + case "WixBundleRollbackBoundary":
114 + row = new WixBundleRollbackBoundaryRow(sourceLineNumbers, this);
115 + break;
116 + case "Upgrade":
117 + row = new UpgradeRow(sourceLineNumbers, this);
118 + break;
119 + case "WixBundleVariable":
120 + row = new WixBundleVariableRow(sourceLineNumbers, this);
121 + break;
122 + case "WixAction":
123 + row = new WixActionRow(sourceLineNumbers, this);
124 + break;
125 + case "WixApprovedExeForElevation":
126 + row = new WixApprovedExeForElevationRow(sourceLineNumbers, this);
127 + break;
128 + case "WixBundle":
129 + row = new WixBundleRow(sourceLineNumbers, this);
130 + break;
131 + case "WixBundlePackageExitCode":
132 + row = new WixBundlePackageExitCodeRow(sourceLineNumbers, this);
133 + break;
134 + case "WixBundlePatchTargetCode":
135 + row = new WixBundlePatchTargetCodeRow(sourceLineNumbers, this);
136 + break;
137 + case "WixBundleSlipstreamMsp":
138 + row = new WixBundleSlipstreamMspRow(sourceLineNumbers, this);
139 + break;
140 + case "WixBundleUpdate":
141 + row = new WixBundleUpdateRow(sourceLineNumbers, this);
142 + break;
143 + case "WixBundleCatalog":
144 + row = new WixBundleCatalogRow(sourceLineNumbers, this);
145 + break;
146 + case "WixChain":
147 + row = new WixChainRow(sourceLineNumbers, this);
148 + break;
149 + case "WixChainItem":
150 + row = new WixChainItemRow(sourceLineNumbers, this);
151 + break;
152 + case "WixBundlePackageCommandLine":
153 + row = new WixBundlePackageCommandLineRow(sourceLineNumbers, this);
154 + break;
155 + case "WixComplexReference":
156 + row = new WixComplexReferenceRow(sourceLineNumbers, this);
157 + break;
158 + case "WixDeltaPatchFile":
159 + row = new WixDeltaPatchFileRow(sourceLineNumbers, this);
160 + break;
161 + case "WixDeltaPatchSymbolPaths":
162 + row = new WixDeltaPatchSymbolPathsRow(sourceLineNumbers, this);
163 + break;
164 + case "WixFile":
165 + row = new WixFileRow(sourceLineNumbers, this);
166 + break;
167 + case "WixGroup":
168 + row = new WixGroupRow(sourceLineNumbers, this);
169 + break;
170 + case "WixMedia":
171 + row = new WixMediaRow(sourceLineNumbers, this);
172 + break;
173 + case "WixMediaTemplate":
174 + row = new WixMediaTemplateRow(sourceLineNumbers, this);
175 + break;
176 + case "WixMerge":
177 + row = new WixMergeRow(sourceLineNumbers, this);
178 + break;
179 + case "WixPayloadProperties":
180 + row = new WixPayloadPropertiesRow(sourceLineNumbers, this);
181 + break;
182 + case "WixProperty":
183 + row = new WixPropertyRow(sourceLineNumbers, this);
184 + break;
185 + case "WixSimpleReference":
186 + row = new WixSimpleReferenceRow(sourceLineNumbers, this);
187 + break;
188 + case "WixUpdateRegistration":
189 + row = new WixUpdateRegistrationRow(sourceLineNumbers, this);
190 + break;
191 +
192 + default:
193 + row = new Row(sourceLineNumbers, this);
194 + break;
195 + }
196 +
197 + if (add)
198 + {
199 + this.Rows.Add(row);
200 + }
201 +
202 + return row;
203 + }
204 +
205 + /// <summary>
206 + /// Parse a table from the xml.
207 + /// </summary>
208 + /// <param name="reader">XmlReader where the intermediate is persisted.</param>
209 + /// <param name="tableDefinitions">TableDefinitions to use in the intermediate.</param>
210 + /// <returns>The parsed table.</returns>
211 + internal static Table Read(XmlReader reader, TableDefinitionCollection tableDefinitions)
212 + {
213 + Debug.Assert("table" == reader.LocalName);
214 +
215 + bool empty = reader.IsEmptyElement;
216 + TableOperation operation = TableOperation.None;
217 + string name = null;
218 +
219 + while (reader.MoveToNextAttribute())
220 + {
221 + switch (reader.LocalName)
222 + {
223 + case "name":
224 + name = reader.Value;
225 + break;
226 + case "op":
227 + switch (reader.Value)
228 + {
229 + case "add":
230 + operation = TableOperation.Add;
231 + break;
232 + case "drop":
233 + operation = TableOperation.Drop;
234 + break;
235 + default:
236 + throw new XmlException();
237 + }
238 + break;
239 + }
240 + }
241 +
242 + if (null == name)
243 + {
244 + throw new XmlException();
245 + }
246 +
247 + TableDefinition tableDefinition = tableDefinitions[name];
248 + Table table = new Table(tableDefinition);
249 + table.Operation = operation;
250 +
251 + if (!empty)
252 + {
253 + bool done = false;
254 +
255 + // loop through all the rows in a table
256 + while (!done && reader.Read())
257 + {
258 + switch (reader.NodeType)
259 + {
260 + case XmlNodeType.Element:
261 + switch (reader.LocalName)
262 + {
263 + case "row":
264 + Row.Read(reader, table);
265 + break;
266 + default:
267 + throw new XmlException();
268 + }
269 + break;
270 + case XmlNodeType.EndElement:
271 + done = true;
272 + break;
273 + }
274 + }
275 +
276 + if (!done)
277 + {
278 + throw new XmlException();
279 + }
280 + }
281 +
282 + return table;
283 + }
284 +
285 + /// <summary>
286 + /// Persists a row in an XML format.
287 + /// </summary>
288 + /// <param name="writer">XmlWriter where the Row should persist itself as XML.</param>
289 + internal void Write(XmlWriter writer)
290 + {
291 + if (null == writer)
292 + {
293 + throw new ArgumentNullException("writer");
294 + }
295 +
296 + writer.WriteStartElement("table", Intermediate.XmlNamespaceUri);
297 + writer.WriteAttributeString("name", this.Name);
298 +
299 + if (TableOperation.None != this.Operation)
300 + {
301 + writer.WriteAttributeString("op", this.Operation.ToString().ToLowerInvariant());
302 + }
303 +
304 + foreach (var row in this.Rows)
305 + {
306 + row.Write(writer);
307 + }
308 +
309 + writer.WriteEndElement();
310 + }
311 +
312 + /// <summary>
313 + /// Validates the rows of this OutputTable and throws if it collides on
314 + /// primary keys.
315 + /// </summary>
316 + public void ValidateRows()
317 + {
318 + var primaryKeys = new Dictionary<string, SourceLineNumber>();
319 +
320 + foreach (var row in this.Rows)
321 + {
322 + var primaryKey = row.GetPrimaryKey();
323 +
324 + if (primaryKeys.TryGetValue(primaryKey, out var collisionSourceLineNumber))
325 + {
326 + throw new WixException(WixDataErrors.DuplicatePrimaryKey(collisionSourceLineNumber, primaryKey, this.Definition.Name));
327 + }
328 +
329 + primaryKeys.Add(primaryKey, row.SourceLineNumbers);
330 + }
331 + }
332 + }
333 +}
src/WixToolset.Data/WindowsInstaller/TableDefinition.cs new
+218
@@ -0,0 +1,218 @@
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.Data.WindowsInstaller
4 +{
5 + using System;
6 + using System.Collections.Generic;
7 + using System.Collections.ObjectModel;
8 + using System.Xml;
9 +
10 + /// <summary>
11 + /// Definition of a table in a database.
12 + /// </summary>
13 + public sealed class TableDefinition : IComparable<TableDefinition>
14 + {
15 + /// <summary>
16 + /// Tracks the maximum number of columns supported in a real table.
17 + /// This is a Windows Installer limitation.
18 + /// </summary>
19 + public const int MaxColumnsInRealTable = 32;
20 +
21 + /// <summary>
22 + /// Creates a table definition.
23 + /// </summary>
24 + /// <param name="name">Name of table to create.</param>
25 + /// <param name="columns">Column definitions for the table.</param>
26 + /// <param name="unreal">Flag if table is unreal.</param>
27 + /// <param name="bootstrapperApplicationData">Flag if table is part of UX Manifest.</param>
28 + public TableDefinition(string name, IList<ColumnDefinition> columns, bool unreal = false, bool bootstrapperApplicationData = false)
29 + {
30 + this.Name = name;
31 + this.Unreal = unreal;
32 + this.BootstrapperApplicationData = bootstrapperApplicationData;
33 +
34 + this.Columns = new ReadOnlyCollection<ColumnDefinition>(columns);
35 + }
36 +
37 + /// <summary>
38 + /// Gets the name of the table.
39 + /// </summary>
40 + /// <value>Name of the table.</value>
41 + public string Name { get; private set; }
42 +
43 + /// <summary>
44 + /// Gets if the table is unreal.
45 + /// </summary>
46 + /// <value>Flag if table is unreal.</value>
47 + public bool Unreal { get; private set; }
48 +
49 + /// <summary>
50 + /// Gets if the table is a part of the bootstrapper application data manifest.
51 + /// </summary>
52 + /// <value>Flag if table is a part of the bootstrapper application data manifest.</value>
53 + public bool BootstrapperApplicationData { get; private set; }
54 +
55 + /// <summary>
56 + /// Gets the collection of column definitions for this table.
57 + /// </summary>
58 + /// <value>Collection of column definitions for this table.</value>
59 + public IList<ColumnDefinition> Columns { get; private set; }
60 +
61 + /// <summary>
62 + /// Gets the column definition in the table by index.
63 + /// </summary>
64 + /// <param name="columnIndex">Index of column to locate.</param>
65 + /// <value>Column definition in the table by index.</value>
66 + public ColumnDefinition this[int columnIndex]
67 + {
68 + get { return this.Columns[columnIndex]; }
69 + }
70 +
71 + /// <summary>
72 + /// Compares this table definition to another table definition.
73 + /// </summary>
74 + /// <remarks>
75 + /// Only Windows Installer traits are compared, allowing for updates to WiX-specific table definitions.
76 + /// </remarks>
77 + /// <param name="updated">The updated <see cref="TableDefinition"/> to compare with this target definition.</param>
78 + /// <returns>0 if the tables' core properties are the same; otherwise, non-0.</returns>
79 + public int CompareTo(TableDefinition updated)
80 + {
81 + // by definition, this object is greater than null
82 + if (null == updated)
83 + {
84 + return 1;
85 + }
86 +
87 + // compare the table names
88 + int ret = String.Compare(this.Name, updated.Name, StringComparison.Ordinal);
89 +
90 + // compare the column count
91 + if (0 == ret)
92 + {
93 + // transforms can only add columns
94 + ret = Math.Min(0, updated.Columns.Count - this.Columns.Count);
95 +
96 + // compare name, type, and length of each column
97 + for (int i = 0; 0 == ret && this.Columns.Count > i; i++)
98 + {
99 + ColumnDefinition thisColumnDef = this.Columns[i];
100 + ColumnDefinition updatedColumnDef = updated.Columns[i];
101 +
102 + ret = thisColumnDef.CompareTo(updatedColumnDef);
103 + }
104 + }
105 +
106 + return ret;
107 + }
108 +
109 + /// <summary>
110 + /// Parses table definition from xml reader.
111 + /// </summary>
112 + /// <param name="reader">Reader to get data from.</param>
113 + /// <returns>The TableDefintion represented by the Xml.</returns>
114 + internal static TableDefinition Read(XmlReader reader)
115 + {
116 + bool empty = reader.IsEmptyElement;
117 + string name = null;
118 + bool unreal = false;
119 + bool bootstrapperApplicationData = false;
120 +
121 + while (reader.MoveToNextAttribute())
122 + {
123 + switch (reader.LocalName)
124 + {
125 + case "name":
126 + name = reader.Value;
127 + break;
128 + case "unreal":
129 + unreal = reader.Value.Equals("yes");
130 + break;
131 + case "bootstrapperApplicationData":
132 + bootstrapperApplicationData = reader.Value.Equals("yes");
133 + break;
134 + }
135 + }
136 +
137 + if (null == name)
138 + {
139 + throw new XmlException();
140 + }
141 +
142 + List<ColumnDefinition> columns = new List<ColumnDefinition>();
143 + bool hasPrimaryKeyColumn = false;
144 +
145 + // parse the child elements
146 + if (!empty)
147 + {
148 + bool done = false;
149 +
150 + while (!done && reader.Read())
151 + {
152 + switch (reader.NodeType)
153 + {
154 + case XmlNodeType.Element:
155 + switch (reader.LocalName)
156 + {
157 + case "columnDefinition":
158 + ColumnDefinition columnDefinition = ColumnDefinition.Read(reader);
159 + columns.Add(columnDefinition);
160 +
161 + if (columnDefinition.PrimaryKey)
162 + {
163 + hasPrimaryKeyColumn = true;
164 + }
165 + break;
166 + default:
167 + throw new XmlException();
168 + }
169 + break;
170 + case XmlNodeType.EndElement:
171 + done = true;
172 + break;
173 + }
174 + }
175 +
176 + if (!unreal && !bootstrapperApplicationData && !hasPrimaryKeyColumn)
177 + {
178 + throw new WixException(WixDataErrors.RealTableMissingPrimaryKeyColumn(SourceLineNumber.CreateFromUri(reader.BaseURI), name));
179 + }
180 +
181 + if (!done)
182 + {
183 + throw new XmlException();
184 + }
185 + }
186 +
187 + return new TableDefinition(name, columns, unreal, bootstrapperApplicationData);
188 + }
189 +
190 + /// <summary>
191 + /// Persists an output in an XML format.
192 + /// </summary>
193 + /// <param name="writer">XmlWriter where the Output should persist itself as XML.</param>
194 + internal void Write(XmlWriter writer)
195 + {
196 + writer.WriteStartElement("tableDefinition", TableDefinitionCollection.XmlNamespaceUri);
197 +
198 + writer.WriteAttributeString("name", this.Name);
199 +
200 + if (this.Unreal)
201 + {
202 + writer.WriteAttributeString("unreal", "yes");
203 + }
204 +
205 + if (this.BootstrapperApplicationData)
206 + {
207 + writer.WriteAttributeString("bootstrapperApplicationData", "yes");
208 + }
209 +
210 + foreach (ColumnDefinition columnDefinition in this.Columns)
211 + {
212 + columnDefinition.Write(writer);
213 + }
214 +
215 + writer.WriteEndElement();
216 + }
217 + }
218 +}
src/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs new
+238
@@ -0,0 +1,238 @@
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.Data.WindowsInstaller
4 +{
5 + using System.Collections;
6 + using System.Collections.Generic;
7 + using System.Linq;
8 + using System.Xml;
9 +
10 + /// <summary>
11 + /// Collection for table definitions indexed by table name.
12 + /// </summary>
13 + public sealed class TableDefinitionCollection : ICollection<TableDefinition>
14 + {
15 + public const string XmlNamespaceUri = "http://wixtoolset.org/schemas/v4/wi/tables";
16 +
17 + private Dictionary<string, TableDefinition> collection;
18 +
19 + /// <summary>
20 + /// Instantiate a new TableDefinitionCollection class.
21 + /// </summary>
22 + public TableDefinitionCollection()
23 + {
24 + this.collection = new Dictionary<string, TableDefinition>();
25 + }
26 +
27 + /// <summary>
28 + /// Creates a shallow copy of the provided table definition collection.
29 + /// </summary>
30 + public TableDefinitionCollection(TableDefinitionCollection tableDefinitions)
31 + {
32 + this.collection = new Dictionary<string, TableDefinition>(tableDefinitions.collection);
33 + }
34 +
35 + /// <summary>
36 + /// Gets the number of items in the collection.
37 + /// </summary>
38 + /// <value>Number of items in collection.</value>
39 + public int Count
40 + {
41 + get { return this.collection.Count; }
42 + }
43 +
44 + /// <summary>
45 + /// Table definition collections are never read-only.
46 + /// </summary>
47 + public bool IsReadOnly
48 + {
49 + get { return false; }
50 + }
51 +
52 + /// <summary>
53 + /// Gets a table definition by name.
54 + /// </summary>
55 + /// <param name="tableName">Name of table to locate.</param>
56 + public TableDefinition this[string tableName]
57 + {
58 + get
59 + {
60 + if (!this.collection.TryGetValue(tableName, out var table))
61 + {
62 + throw new WixMissingTableDefinitionException(WixDataErrors.MissingTableDefinition(tableName));
63 + }
64 +
65 + return table;
66 + }
67 + }
68 +
69 + /// <summary>
70 + /// Tries to get a table definition by name.
71 + /// </summary>
72 + /// <param name="tableName">Name of table to locate.</param>
73 + /// <param name="table">Table definition if found.</param>
74 + /// <returns>True if table definition was found otherwise false.</returns>
75 + public bool TryGet(string tableName, out TableDefinition table)
76 + {
77 + return this.collection.TryGetValue(tableName, out table);
78 + }
79 +
80 + /// <summary>
81 + /// Load a table definition collection from an XmlReader.
82 + /// </summary>
83 + /// <param name="reader">Reader to get data from.</param>
84 + /// <param name="suppressSchema">Suppress xml schema validation while loading.</param>
85 + /// <returns>The TableDefinitionCollection represented by the xml.</returns>
86 + public static TableDefinitionCollection Load(XmlReader reader)
87 + {
88 + reader.MoveToContent();
89 +
90 + return Read(reader);
91 + }
92 +
93 + /// <summary>
94 + /// Adds a table definition to the collection.
95 + /// </summary>
96 + /// <param name="tableDefinition">Table definition to add to the collection.</param>
97 + /// <value>Indexes by table definition name.</value>
98 + public void Add(TableDefinition tableDefinition)
99 + {
100 + this.collection.Add(tableDefinition.Name, tableDefinition);
101 + }
102 +
103 + /// <summary>
104 + /// Removes all table definitions from the collection.
105 + /// </summary>
106 + public void Clear()
107 + {
108 + this.collection.Clear();
109 + }
110 +
111 + /// <summary>
112 + /// Checks if the collection contains a table name.
113 + /// </summary>
114 + /// <param name="tableName">The table to check in the collection.</param>
115 + /// <returns>True if collection contains the table.</returns>
116 + public bool Contains(string tableName)
117 + {
118 + return this.collection.ContainsKey(tableName);
119 + }
120 +
121 + /// <summary>
122 + /// Checks if the collection contains a table.
123 + /// </summary>
124 + /// <param name="table">The table to check in the collection.</param>
125 + /// <returns>True if collection contains the table.</returns>
126 + public bool Contains(TableDefinition table)
127 + {
128 + return this.collection.ContainsKey(table.Name);
129 + }
130 +
131 + /// <summary>
132 + /// Copies table definitions to an arry.
133 + /// </summary>
134 + /// <param name="array">Array to copy the table definitions to.</param>
135 + /// <param name="index">Index in the array to start copying at.</param>
136 + public void CopyTo(TableDefinition[] array, int index)
137 + {
138 + this.collection.Values.CopyTo(array, index);
139 + }
140 +
141 + /// <summary>
142 + /// Removes a table definition from the collection.
143 + /// </summary>
144 + /// <param name="table">Table to remove from the collection.</param>
145 + /// <returns>True if the table definition existed in the collection and was removed.</returns>
146 + public bool Remove(TableDefinition table)
147 + {
148 + return this.collection.Remove(table.Name);
149 + }
150 +
151 + /// <summary>
152 + /// Gets enumerator for the collection.
153 + /// </summary>
154 + /// <returns>Enumerator for the collection.</returns>
155 + public IEnumerator<TableDefinition> GetEnumerator()
156 + {
157 + return this.collection.Values.GetEnumerator();
158 + }
159 +
160 + /// <summary>
161 + /// Gets the untyped enumerator for the collection.
162 + /// </summary>
163 + /// <returns>Untyped enumerator for the collection.</returns>
164 + IEnumerator IEnumerable.GetEnumerator()
165 + {
166 + return this.collection.Values.GetEnumerator();
167 + }
168 +
169 + /// <summary>
170 + /// Loads a collection of table definitions from a XmlReader in memory.
171 + /// </summary>
172 + /// <param name="reader">Reader to get data from.</param>
173 + /// <returns>The TableDefinitionCollection represented by the xml.</returns>
174 + internal static TableDefinitionCollection Read(XmlReader reader)
175 + {
176 + if ("tableDefinitions" != reader.LocalName)
177 + {
178 + throw new XmlException();
179 + }
180 +
181 + bool empty = reader.IsEmptyElement;
182 + TableDefinitionCollection tableDefinitionCollection = new TableDefinitionCollection();
183 +
184 + while (reader.MoveToNextAttribute())
185 + {
186 + }
187 +
188 + // parse the child elements
189 + if (!empty)
190 + {
191 + bool done = false;
192 +
193 + while (!done && reader.Read())
194 + {
195 + switch (reader.NodeType)
196 + {
197 + case XmlNodeType.Element:
198 + switch (reader.LocalName)
199 + {
200 + case "tableDefinition":
201 + tableDefinitionCollection.Add(TableDefinition.Read(reader));
202 + break;
203 + default:
204 + throw new XmlException();
205 + }
206 + break;
207 + case XmlNodeType.EndElement:
208 + done = true;
209 + break;
210 + }
211 + }
212 +
213 + if (!done)
214 + {
215 + throw new XmlException();
216 + }
217 + }
218 +
219 + return tableDefinitionCollection;
220 + }
221 +
222 + /// <summary>
223 + /// Persists a TableDefinitionCollection in an XML format.
224 + /// </summary>
225 + /// <param name="writer">XmlWriter where the TableDefinitionCollection should persist itself as XML.</param>
226 + internal void Write(XmlWriter writer)
227 + {
228 + writer.WriteStartElement("tableDefinitions", XmlNamespaceUri);
229 +
230 + foreach (TableDefinition tableDefinition in this.collection.Values.OrderBy(t => t.Name))
231 + {
232 + tableDefinition.Write(writer);
233 + }
234 +
235 + writer.WriteEndElement();
236 + }
237 + }
238 +}
src/WixToolset.Data/WindowsInstaller/TableIndexedCollection.cs new
+143
@@ -0,0 +1,143 @@
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.Data.WindowsInstaller
4 +{
5 + using System.Collections.Generic;
6 + using System.Linq;
7 +
8 + /// <summary>
9 + /// Collection for tables.
10 + /// </summary>
11 + public sealed class TableIndexedCollection : ICollection<Table>
12 + {
13 + private Dictionary<string, Table> collection;
14 +
15 + /// <summary>
16 + /// Instantiate a new empty collection.
17 + /// </summary>
18 + public TableIndexedCollection()
19 + {
20 + this.collection = new Dictionary<string,Table>();
21 + }
22 +
23 + /// <summary>
24 + /// Instantiate a new collection populated with a set of tables.
25 + /// </summary>
26 + /// <param name="tables">Set of tables.</param>
27 + public TableIndexedCollection(IEnumerable<Table> tables)
28 + {
29 + this.collection = tables.ToDictionary(t => t.Name);
30 + }
31 +
32 + /// <summary>
33 + /// Gets the number of items in the collection.
34 + /// </summary>
35 + /// <value>Number of items in collection.</value>
36 + public int Count => this.collection.Count;
37 +
38 + /// <summary>
39 + /// Table indexed collection is never read only.
40 + /// </summary>
41 + public bool IsReadOnly => false;
42 +
43 + /// <summary>
44 + /// Adds a table to the collection.
45 + /// </summary>
46 + /// <param name="table">Table to add to the collection.</param>
47 + /// <remarks>Indexes the table by name.</remarks>
48 + public void Add(Table table)
49 + {
50 + this.collection.Add(table.Name, table);
51 + }
52 +
53 + /// <summary>
54 + /// Clear the tables from the collection.
55 + /// </summary>
56 + public void Clear()
57 + {
58 + this.collection.Clear();
59 + }
60 +
61 + /// <summary>
62 + /// Determines if a table is in the collection.
63 + /// </summary>
64 + /// <param name="table">Table to check if it is in the collection.</param>
65 + /// <returns>True if the table name is in the collection, otherwise false.</returns>
66 + public bool Contains(Table table) => this.collection.ContainsKey(table.Name);
67 +
68 + /// <summary>
69 + /// Copies the collection into an array.
70 + /// </summary>
71 + /// <param name="array">Array to copy the collection into.</param>
72 + /// <param name="arrayIndex">Index to start copying from.</param>
73 + public void CopyTo(Table[] array, int arrayIndex)
74 + {
75 + this.collection.Values.CopyTo(array, arrayIndex);
76 + }
77 +
78 + /// <summary>
79 + /// Remove a table from the collection by name.
80 + /// </summary>
81 + /// <param name="tableName">Table name to remove from the collection.</param>
82 + public void Remove(string tableName)
83 + {
84 + this.collection.Remove(tableName);
85 + }
86 +
87 + /// <summary>
88 + /// Remove a table from the collection.
89 + /// </summary>
90 + /// <param name="table">Table with matching name to remove from the collection.</param>
91 + public bool Remove(Table table)
92 + {
93 + return this.collection.Remove(table.Name);
94 + }
95 +
96 + /// <summary>
97 + /// Gets an enumerator over the whole collection.
98 + /// </summary>
99 + /// <returns>Collection enumerator.</returns>
100 + public IEnumerator<Table> GetEnumerator()
101 + {
102 + return this.collection.Values.GetEnumerator();
103 + }
104 +
105 + /// <summary>
106 + /// Gets an untyped enumerator over the whole collection.
107 + /// </summary>
108 + /// <returns>Untyped collection enumerator.</returns>
109 + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
110 + {
111 + return this.collection.Values.GetEnumerator();
112 + }
113 +
114 + /// <summary>
115 + /// Gets a table by name.
116 + /// </summary>
117 + /// <param name="tableName">Name of table to locate.</param>
118 + public Table this[string tableName]
119 + {
120 + get
121 + {
122 + Table table;
123 + return this.collection.TryGetValue(tableName, out table) ? table : null;
124 + }
125 +
126 + set
127 + {
128 + this.collection[tableName] = value;
129 + }
130 + }
131 +
132 + /// <summary>
133 + /// Tries to find a table by name.
134 + /// </summary>
135 + /// <param name="tableName">Table name to locate.</param>
136 + /// <param name="table">Found table.</param>
137 + /// <returns>True if table with table name was found, otherwise false.</returns>
138 + public bool TryGetTable(string tableName, out Table table)
139 + {
140 + return this.collection.TryGetValue(tableName, out table);
141 + }
142 + }
143 +}
src/WixToolset.Data/WindowsInstaller/TableOperation.cs new
+25
@@ -0,0 +1,25 @@
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.Data.WindowsInstaller
4 +{
5 + /// <summary>
6 + /// The table transform operations.
7 + /// </summary>
8 + public enum TableOperation
9 + {
10 + /// <summary>
11 + /// No operation.
12 + /// </summary>
13 + None,
14 +
15 + /// <summary>
16 + /// Added table.
17 + /// </summary>
18 + Add,
19 +
20 + /// <summary>
21 + /// Dropped table.
22 + /// </summary>
23 + Drop,
24 + }
25 +}
src/WixToolset.Data/WindowsInstaller/WixMissingTableDefinitionException.cs new
+22
@@ -0,0 +1,22 @@
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.Data.WindowsInstaller
4 +{
5 + using System;
6 +
7 + /// <summary>
8 + /// Exception thrown when a table definition is missing.
9 + /// </summary>
10 + [Serializable]
11 + public class WixMissingTableDefinitionException : WixException
12 + {
13 + /// <summary>
14 + /// Instantiate new WixMissingTableDefinitionException.
15 + /// </summary>
16 + /// <param name="error">Localized error information.</param>
17 + public WixMissingTableDefinitionException(MessageEventArgs error)
18 + : base(error)
19 + {
20 + }
21 + }
22 +}