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

◆ GenerateTableErrors()

void System.Data.NewDiffgramGen.GenerateTableErrors ( DataTable table)
inlineprivate

Definition at line 177 of file NewDiffgramGen.cs.

178 {
179 int count = table.Rows.Count;
180 int count2 = table.Columns.Count;
181 if (count <= 0)
182 {
183 return;
184 }
185 for (int i = 0; i < count; i++)
186 {
187 bool flag = false;
188 DataRow dataRow = table.Rows[i];
189 string prefix = ((table.Namespace.Length != 0) ? table.Prefix : string.Empty);
190 if (dataRow.HasErrors && dataRow.RowError.Length > 0)
191 {
192 if (!_fErrors)
193 {
194 _xmlw.WriteStartElement("diffgr", "errors", "urn:schemas-microsoft-com:xml-diffgram-v1");
195 _fErrors = true;
196 }
197 _xmlw.WriteStartElement(prefix, dataRow.Table.EncodedTableName, dataRow.Table.Namespace);
198 _xmlw.WriteAttributeString("diffgr", "id", "urn:schemas-microsoft-com:xml-diffgram-v1", dataRow.Table.TableName + dataRow.rowID.ToString(CultureInfo.InvariantCulture));
199 _xmlw.WriteAttributeString("diffgr", "Error", "urn:schemas-microsoft-com:xml-diffgram-v1", dataRow.RowError);
200 flag = true;
201 }
202 if (count2 <= 0)
203 {
204 continue;
205 }
206 for (int j = 0; j < count2; j++)
207 {
208 DataColumn dataColumn = table.Columns[j];
209 string columnError = dataRow.GetColumnError(dataColumn);
210 string prefix2 = ((dataColumn.Namespace.Length != 0) ? dataColumn.Prefix : string.Empty);
211 if (columnError == null || columnError.Length == 0)
212 {
213 continue;
214 }
215 if (!flag)
216 {
217 if (!_fErrors)
218 {
219 _xmlw.WriteStartElement("diffgr", "errors", "urn:schemas-microsoft-com:xml-diffgram-v1");
220 _fErrors = true;
221 }
222 _xmlw.WriteStartElement(prefix, dataRow.Table.EncodedTableName, dataRow.Table.Namespace);
223 _xmlw.WriteAttributeString("diffgr", "id", "urn:schemas-microsoft-com:xml-diffgram-v1", dataRow.Table.TableName + dataRow.rowID.ToString(CultureInfo.InvariantCulture));
224 flag = true;
225 }
226 _xmlw.WriteStartElement(prefix2, dataColumn.EncodedColumnName, dataColumn.Namespace);
227 _xmlw.WriteAttributeString("diffgr", "Error", "urn:schemas-microsoft-com:xml-diffgram-v1", columnError);
229 }
230 if (flag)
231 {
233 }
234 }
235 }
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._fErrors, System.Data.NewDiffgramGen._xmlw, System.Data.DataTable.Columns, System.Data.DataRowCollection.Count, System.Data.InternalDataCollectionBase.Count, System.count, System.Xml.Dictionary, System.Globalization.CultureInfo.InvariantCulture, System.Data.DataTable.Prefix, System.prefix, System.Data.DataTable.Rows, System.Xml.XmlWriter.WriteAttributeString(), System.Xml.XmlWriter.WriteEndElement(), and System.Xml.XmlWriter.WriteStartElement().

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