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

◆ HandleDataSet()

void System.Data.XSDSchema.HandleDataSet ( XmlSchemaElement node,
bool isNewDataSet )
inlinepackage

Definition at line 2184 of file XSDSchema.cs.

2185 {
2186 string text = node.Name;
2187 string @namespace = node.QualifiedName.Namespace;
2189 string msdataAttribute = GetMsdataAttribute(node, "Locale");
2190 if (msdataAttribute != null)
2191 {
2192 if (msdataAttribute.Length != 0)
2193 {
2195 }
2196 else
2197 {
2199 }
2200 }
2201 else if (GetBooleanAttribute(node, "UseCurrentLocale", defVal: false))
2202 {
2203 _ds.SetLocaleValue(CultureInfo.CurrentCulture, userSet: false);
2204 }
2205 else
2206 {
2207 _ds.SetLocaleValue(new CultureInfo(1033), userSet: false);
2208 }
2209 msdataAttribute = GetMsdataAttribute(node, "DataSetName");
2210 if (msdataAttribute != null && msdataAttribute.Length != 0)
2211 {
2213 }
2214 msdataAttribute = GetMsdataAttribute(node, "DataSetNamespace");
2215 if (msdataAttribute != null && msdataAttribute.Length != 0)
2216 {
2217 @namespace = msdataAttribute;
2218 }
2219 SetProperties(_ds, node.UnhandledAttributes);
2220 SetExtProperties(_ds, node.UnhandledAttributes);
2221 if (text != null && text.Length != 0)
2222 {
2224 }
2225 _ds.Namespace = @namespace;
2226 if (FromInference)
2227 {
2228 _ds.Prefix = GetPrefix(_ds.Namespace);
2229 }
2231 if (xmlSchemaComplexType.Particle != null)
2232 {
2234 if (particleItems == null)
2235 {
2236 return;
2237 }
2238 foreach (XmlSchemaAnnotated item in particleItems)
2239 {
2240 if (item is XmlSchemaElement)
2241 {
2242 if (((XmlSchemaElement)item).RefName.Name.Length != 0)
2243 {
2244 if (!FromInference)
2245 {
2246 continue;
2247 }
2248 DataTable table = _ds.Tables.GetTable(XmlConvert.DecodeName(GetInstanceName((XmlSchemaElement)item)), node.QualifiedName.Namespace);
2249 if (table != null)
2250 {
2251 list.Add(table);
2252 }
2253 bool flag = false;
2254 if (node.ElementSchemaType != null || !(((XmlSchemaElement)item).SchemaType is XmlSchemaComplexType))
2255 {
2256 flag = true;
2257 }
2258 if (((XmlSchemaElement)item).MaxOccurs != 1m && !flag)
2259 {
2260 continue;
2261 }
2262 }
2263 DataTable dataTable = HandleTable((XmlSchemaElement)item);
2264 if (dataTable != null)
2265 {
2267 }
2268 if (FromInference)
2269 {
2270 list.Add(dataTable);
2271 }
2272 }
2273 else
2274 {
2275 if (!(item is XmlSchemaChoice))
2276 {
2277 continue;
2278 }
2279 XmlSchemaObjectCollection items = ((XmlSchemaChoice)item).Items;
2280 if (items == null)
2281 {
2282 continue;
2283 }
2284 foreach (XmlSchemaAnnotated item2 in items)
2285 {
2286 if (!(item2 is XmlSchemaElement))
2287 {
2288 continue;
2289 }
2291 {
2292 ((XmlSchemaElement)item2).MaxOccurs = ((XmlSchemaParticle)item).MaxOccurs;
2293 }
2294 if (((XmlSchemaElement)item2).RefName.Name.Length == 0 || FromInference || !(((XmlSchemaElement)item2).MaxOccurs != 1m) || ((XmlSchemaElement)item2).SchemaType is XmlSchemaComplexType)
2295 {
2296 DataTable dataTable2 = HandleTable((XmlSchemaElement)item2);
2297 if (FromInference)
2298 {
2299 list.Add(dataTable2);
2300 }
2301 if (dataTable2 != null)
2302 {
2304 }
2305 }
2306 }
2307 }
2308 }
2309 }
2310 if (node.Constraints != null)
2311 {
2312 foreach (XmlSchemaIdentityConstraint constraint in node.Constraints)
2313 {
2314 if (constraint is XmlSchemaKeyref xmlSchemaKeyref && !GetBooleanAttribute(xmlSchemaKeyref, "IsNested", defVal: false))
2315 {
2316 HandleKeyref(xmlSchemaKeyref);
2317 }
2318 }
2319 }
2320 if (!(FromInference && isNewDataSet))
2321 {
2322 return;
2323 }
2324 List<DataTable> tableList = new List<DataTable>(_ds.Tables.Count);
2325 foreach (DataTable item3 in list)
2326 {
2327 AddTablesToList(tableList, item3);
2328 }
2329 _ds.Tables.ReplaceFromInference(tableList);
2330 }
static CultureInfo CurrentCulture
static CultureInfo InvariantCulture
static ? string DecodeName(string? name)
Definition XmlConvert.cs:55

References System.Data.InternalDataCollectionBase.Count, System.Globalization.CultureInfo.CurrentCulture, System.Xml.XmlConvert.DecodeName(), System.Xml.Dictionary, System.Data.DataTableCollection.GetTable(), System.Globalization.CultureInfo.InvariantCulture, System.item, System.list, System.Data.DataSet.Namespace, System.Data.DataTableCollection.ReplaceFromInference(), System.Data.DataSet.SetLocaleValue(), System.Data.DataSet.Tables, and System.text.

Referenced by System.Data.XSDSchema.LoadSchema().