Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GenerateRow()

void System.Data.NewDiffgramGen.GenerateRow ( DataRow row)
inlineprivate

Definition at line 238 of file NewDiffgramGen.cs.

239 {
240 DataRowState rowState = row.RowState;
241 if (rowState == DataRowState.Unchanged || rowState == DataRowState.Added)
242 {
243 return;
244 }
245 if (!_fBefore)
246 {
247 _xmlw.WriteStartElement("diffgr", "before", "urn:schemas-microsoft-com:xml-diffgram-v1");
248 _fBefore = true;
249 }
250 DataTable table = row.Table;
251 int count = table.Columns.Count;
252 string value = table.TableName + row.rowID.ToString(CultureInfo.InvariantCulture);
253 string text = null;
254 if (rowState == DataRowState.Deleted && row.Table.NestedParentRelations.Length != 0)
255 {
256 DataRow nestedParentRow = row.GetNestedParentRow(DataRowVersion.Original);
257 if (nestedParentRow != null)
258 {
260 }
261 }
262 string prefix = ((table.Namespace.Length != 0) ? table.Prefix : string.Empty);
263 _xmlw.WriteStartElement(prefix, row.Table.EncodedTableName, row.Table.Namespace);
264 _xmlw.WriteAttributeString("diffgr", "id", "urn:schemas-microsoft-com:xml-diffgram-v1", value);
265 if (rowState == DataRowState.Deleted && XmlDataTreeWriter.RowHasErrors(row))
266 {
267 _xmlw.WriteAttributeString("diffgr", "hasErrors", "urn:schemas-microsoft-com:xml-diffgram-v1", "true");
268 }
269 if (text != null)
270 {
271 _xmlw.WriteAttributeString("diffgr", "parentId", "urn:schemas-microsoft-com:xml-diffgram-v1", text);
272 }
273 _xmlw.WriteAttributeString("msdata", "rowOrder", "urn:schemas-microsoft-com:xml-msdata", _rowsOrder[row].ToString());
274 for (int i = 0; i < count; i++)
275 {
276 if (row.Table.Columns[i].ColumnMapping == MappingType.Attribute || row.Table.Columns[i].ColumnMapping == MappingType.Hidden)
277 {
278 GenerateColumn(row, row.Table.Columns[i], DataRowVersion.Original);
279 }
280 }
281 for (int j = 0; j < count; j++)
282 {
283 if (row.Table.Columns[j].ColumnMapping == MappingType.Element || row.Table.Columns[j].ColumnMapping == MappingType.SimpleContent)
284 {
285 GenerateColumn(row, row.Table.Columns[j], DataRowVersion.Original);
286 }
287 }
289 }
void GenerateColumn(DataRow row, DataColumn col, DataRowVersion version)
static CultureInfo InvariantCulture
void WriteAttributeString(string localName, string? ns, string? value)
Definition XmlWriter.cs:46
void WriteStartElement(string localName, string? ns)
Definition XmlWriter.cs:30

References System.Data.NewDiffgramGen._fBefore, System.Data.NewDiffgramGen._rowsOrder, System.Data.NewDiffgramGen._xmlw, System.Data.DataTable.Columns, System.Data.InternalDataCollectionBase.Count, System.count, System.Xml.Dictionary, System.Data.NewDiffgramGen.GenerateColumn(), System.Data.DataRow.GetNestedParentRow(), System.Globalization.CultureInfo.InvariantCulture, System.Data.DataTable.Prefix, System.prefix, System.Data.XmlDataTreeWriter.RowHasErrors(), System.Data.DataRow.rowID, System.text, System.ToString, System.value, System.Xml.XmlWriter.WriteAttributeString(), System.Xml.XmlWriter.WriteEndElement(), and System.Xml.XmlWriter.WriteStartElement().

Referenced by System.Data.NewDiffgramGen.GenerateTable().