public XmlMetaProvider(IEnumerable <Stream> streams) { foreach (Stream stream in streams) { XmlSerializer xmlSeliz = new XmlSerializer(typeof(XmlMetaModel)); try { XmlMetaModel model = (XmlMetaModel)xmlSeliz.Deserialize(stream); var assembly = model.Assembly; if (assembly != null) { if (assembly.Namespaces != null) { foreach (var namespaceModel in assembly.Namespaces) { LoadNamespace(namespaceModel); } } if (assembly.Classes != null) { LoadType(string.Empty, assembly.Classes); } } } catch (Exception e) { throw new Exception($"load xml file wrong {0}", e); } } }
public XmlMetaProvider(IEnumerable <string> files) { foreach (string file in files) { XmlSerializer xmlSeliz = new XmlSerializer(typeof(XmlMetaModel)); try { using (Stream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read)) { XmlMetaModel model = (XmlMetaModel)xmlSeliz.Deserialize(stream); var assembly = model.Assembly; if (assembly != null) { if (assembly.Namespaces != null) { foreach (var namespaceModel in assembly.Namespaces) { LoadNamespace(namespaceModel); } } if (assembly.Classes != null) { LoadType(string.Empty, assembly.Classes); } } } } catch (Exception e) { throw new Exception($"load xml file wrong at {file}", e); } } }
public XmlMetaProvider(IEnumerable <string> files) { foreach (string file in files) { XmlSerializer xmlSeliz = new XmlSerializer(typeof(XmlMetaModel)); try { using (Stream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read)) { XmlMetaModel model = (XmlMetaModel)xmlSeliz.Deserialize(stream); var assembly = model.Assembly; if (assembly != null) { if (assembly.Namespaces != null) { foreach (var namespaceModel in assembly.Namespaces) { LoadNamespace(namespaceModel); } } if (assembly.Classes != null) { LoadType(string.Empty, assembly.Classes); } } var export = model.Export; if (export != null) { if (export.Attributes != null) { foreach (var attribute in export.Attributes) { if (string.IsNullOrEmpty(attribute.Name)) { throw new ArgumentException("attribute's name is empty"); } exportAttributes_.Add(attribute.Name); } } } } } catch (Exception e) { throw new Exception($"load xml file wrong at {file}", e); } } }