aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Data/WindowsInstaller/Rows/WixComplexReferenceRow.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2020-06-04 10:19:31 -0700
committerRob Mensching <rob@firegiant.com>2020-06-04 10:21:25 -0700
commit021565eca7be6c3307821bd9d4500a73a5c1c68f (patch)
tree01cff651cb4a487c42b8d7635aaf332e1287ed7d /src/WixToolset.Data/WindowsInstaller/Rows/WixComplexReferenceRow.cs
parent58791d3dbffce2a96280e08fc2d36ab69571d02c (diff)
downloadwix-021565eca7be6c3307821bd9d4500a73a5c1c68f.tar.gz
wix-021565eca7be6c3307821bd9d4500a73a5c1c68f.tar.bz2
wix-021565eca7be6c3307821bd9d4500a73a5c1c68f.zip
Remove obsolete rows
Diffstat (limited to 'src/WixToolset.Data/WindowsInstaller/Rows/WixComplexReferenceRow.cs')
-rw-r--r--src/WixToolset.Data/WindowsInstaller/Rows/WixComplexReferenceRow.cs207
1 files changed, 0 insertions, 207 deletions
diff --git a/src/WixToolset.Data/WindowsInstaller/Rows/WixComplexReferenceRow.cs b/src/WixToolset.Data/WindowsInstaller/Rows/WixComplexReferenceRow.cs
deleted file mode 100644
index 0e942724..00000000
--- a/src/WixToolset.Data/WindowsInstaller/Rows/WixComplexReferenceRow.cs
+++ /dev/null
@@ -1,207 +0,0 @@
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
3namespace 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 public WixComplexReferenceRow(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition)
24 : base(sourceLineNumbers, tableDefinition)
25 {
26 }
27
28 /// <summary>
29 /// Gets the parent type of the complex reference.
30 /// </summary>
31 /// <value>Parent type of the complex reference.</value>
32 public ComplexReferenceParentType ParentType
33 {
34 get { return (ComplexReferenceParentType)Enum.ToObject(typeof(ComplexReferenceParentType), (int)this.Fields[1].Data); }
35 set { this.Fields[1].Data = (int)value; }
36 }
37
38 /// <summary>
39 /// Gets or sets the parent identifier of the complex reference.
40 /// </summary>
41 /// <value>Parent identifier of the complex reference.</value>
42 public string ParentId
43 {
44 get { return (string)this.Fields[0].Data; }
45 set { this.Fields[0].Data = value; }
46 }
47
48 /// <summary>
49 /// Gets the parent language of the complex reference.
50 /// </summary>
51 /// <value>Parent language of the complex reference.</value>
52 public string ParentLanguage
53 {
54 get { return (string)this.Fields[2].Data; }
55 set { this.Fields[2].Data = value; }
56 }
57
58 /// <summary>
59 /// Gets the child type of the complex reference.
60 /// </summary>
61 /// <value>Child type of the complex reference.</value>
62 public ComplexReferenceChildType ChildType
63 {
64 get { return (ComplexReferenceChildType)Enum.ToObject(typeof(ComplexReferenceChildType), (int)this.Fields[4].Data); }
65 set { this.Fields[4].Data = (int)value; }
66 }
67
68 /// <summary>
69 /// Gets the child identifier of the complex reference.
70 /// </summary>
71 /// <value>Child identifier of the complex reference.</value>
72 public string ChildId
73 {
74 get { return (string)this.Fields[3].Data; }
75 set { this.Fields[3].Data = value; }
76 }
77
78 /// <summary>
79 /// Gets if this is the primary complex reference.
80 /// </summary>
81 /// <value>true if primary complex reference.</value>
82 public bool IsPrimary
83 {
84 get
85 {
86 return (0x1 == ((int)this.Fields[5].Data & 0x1));
87 }
88
89 set
90 {
91 if (null == this.Fields[5].Data)
92 {
93 this.Fields[5].Data = 0;
94 }
95
96 if (value)
97 {
98 this.Fields[5].Data = (int)this.Fields[5].Data | 0x1;
99 }
100 else
101 {
102 this.Fields[5].Data = (int)this.Fields[5].Data & ~0x1;
103 }
104 }
105 }
106
107 /// <summary>
108 /// Determines if two complex references are equivalent.
109 /// </summary>
110 /// <param name="obj">Complex reference to compare.</param>
111 /// <returns>True if complex references are equivalent.</returns>
112 public override bool Equals(object obj)
113 {
114 return 0 == this.CompareTo(obj);
115 }
116
117 /// <summary>
118 /// Gets the hash code for the complex reference.
119 /// </summary>
120 /// <returns>Hash code for the complex reference.</returns>
121 public override int GetHashCode()
122 {
123 return this.ChildType.GetHashCode() ^ this.ChildId.GetHashCode() ^ this.ParentType.GetHashCode() ^ this.ParentLanguage.GetHashCode() ^ this.ParentId.GetHashCode() ^ this.IsPrimary.GetHashCode();
124 }
125
126 /// <summary>
127 /// Compares two complex references.
128 /// </summary>
129 /// <param name="obj">Complex reference to compare to.</param>
130 /// <returns>Zero if the objects are equivalent, negative number if the provided object is less, positive if greater.</returns>
131 public int CompareTo(object obj)
132 {
133 int comparison = this.CompareToWithoutConsideringPrimary(obj);
134 if (0 == comparison)
135 {
136 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"
137 }
138 return comparison;
139 }
140
141 /// <summary>
142 /// Compares two complex references without considering the primary bit.
143 /// </summary>
144 /// <param name="obj">Complex reference to compare to.</param>
145 /// <returns>Zero if the objects are equivalent, negative number if the provided object is less, positive if greater.</returns>
146 [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.ArgumentException.#ctor(System.String,System.String)")]
147 public int CompareToWithoutConsideringPrimary(object obj)
148 {
149 var other = obj as WixComplexReferenceRow ?? throw new ArgumentNullException(nameof(obj));
150
151 int comparison = this.ChildType - other.ChildType;
152 if (0 == comparison)
153 {
154 comparison = String.Compare(this.ChildId, other.ChildId, StringComparison.Ordinal);
155 if (0 == comparison)
156 {
157 comparison = this.ParentType - other.ParentType;
158 if (0 == comparison)
159 {
160 string thisParentLanguage = null == this.ParentLanguage ? String.Empty : this.ParentLanguage;
161 string otherParentLanguage = null == other.ParentLanguage ? String.Empty : other.ParentLanguage;
162 comparison = String.Compare(thisParentLanguage, otherParentLanguage, StringComparison.Ordinal);
163 if (0 == comparison)
164 {
165 comparison = String.Compare(this.ParentId, other.ParentId, StringComparison.Ordinal);
166 }
167 }
168 }
169 }
170
171 return comparison;
172 }
173
174 /// <summary>
175 /// Creates a shallow copy of the ComplexReference.
176 /// </summary>
177 /// <returns>A shallow copy of the ComplexReference.</returns>
178 public WixComplexReferenceRow Clone()
179 {
180 WixComplexReferenceRow wixComplexReferenceRow = new WixComplexReferenceRow(this.SourceLineNumbers, this.Table);
181 wixComplexReferenceRow.ParentType = this.ParentType;
182 wixComplexReferenceRow.ParentId = this.ParentId;
183 wixComplexReferenceRow.ParentLanguage = this.ParentLanguage;
184 wixComplexReferenceRow.ChildType = this.ChildType;
185 wixComplexReferenceRow.ChildId = this.ChildId;
186 wixComplexReferenceRow.IsPrimary = this.IsPrimary;
187
188 return wixComplexReferenceRow;
189 }
190
191 /// <summary>
192 /// Changes all of the parent references to point to the passed in parent reference.
193 /// </summary>
194 /// <param name="parent">New parent complex reference.</param>
195 public void Reparent(WixComplexReferenceRow parent)
196 {
197 this.ParentId = parent.ParentId;
198 this.ParentLanguage = parent.ParentLanguage;
199 this.ParentType = parent.ParentType;
200
201 if (!this.IsPrimary)
202 {
203 this.IsPrimary = parent.IsPrimary;
204 }
205 }
206 }
207}