private void GenerateRow(DataRow row)
{
DataRowState rowState = row.RowState;
switch (rowState)
{
case DataRowState.Unchanged:
case DataRowState.Added:
return;
}
if (!this.fBefore)
{
this._xmlw.WriteStartElement("diffgr", "before", "urn:schemas-microsoft-com:xml-diffgram-v1");
this.fBefore = true;
}
DataTable table = row.Table;
int count = table.Columns.Count;
string str3 = table.TableName + row.rowID.ToString(CultureInfo.InvariantCulture);
string str = null;
if ((rowState == DataRowState.Deleted) && (row.Table.NestedParentRelations.Length != 0))
{
DataRow nestedParentRow = row.GetNestedParentRow(DataRowVersion.Original);
if (nestedParentRow != null)
{
str = nestedParentRow.Table.TableName + nestedParentRow.rowID.ToString(CultureInfo.InvariantCulture);
}
}
string prefix = (table.Namespace.Length != 0) ? table.Prefix : string.Empty;
if (table.XmlText != null)
{
object obj1 = row[table.XmlText, DataRowVersion.Original];
}
this._xmlw.WriteStartElement(prefix, row.Table.EncodedTableName, row.Table.Namespace);
this._xmlw.WriteAttributeString("diffgr", "id", "urn:schemas-microsoft-com:xml-diffgram-v1", str3);
if ((rowState == DataRowState.Deleted) && XmlDataTreeWriter.RowHasErrors(row))
{
this._xmlw.WriteAttributeString("diffgr", "hasErrors", "urn:schemas-microsoft-com:xml-diffgram-v1", "true");
}
if (str != null)
{
this._xmlw.WriteAttributeString("diffgr", "parentId", "urn:schemas-microsoft-com:xml-diffgram-v1", str);
}
this._xmlw.WriteAttributeString("msdata", "rowOrder", "urn:schemas-microsoft-com:xml-msdata", this.rowsOrder[row].ToString());
for (int i = 0; i < count; i++)
{
if ((row.Table.Columns[i].ColumnMapping == MappingType.Attribute) || (row.Table.Columns[i].ColumnMapping == MappingType.Hidden))
{
this.GenerateColumn(row, row.Table.Columns[i], DataRowVersion.Original);
}
}
for (int j = 0; j < count; j++)
{
if ((row.Table.Columns[j].ColumnMapping == MappingType.Element) || (row.Table.Columns[j].ColumnMapping == MappingType.SimpleContent))
{
this.GenerateColumn(row, row.Table.Columns[j], DataRowVersion.Original);
}
}
this._xmlw.WriteEndElement();
}