public static void init() { if (Measures.Count > 0) { return; } List <Configuration.Mensuration> ms = Session.GetConfiguration().mensurations; foreach (Configuration.Mensuration m in ms) { if (m.typeName == null || m.typeName.Trim() == "") { m.typeName = "NWSELib.MeasureTools"; } Type type = Assembly.GetExecutingAssembly().GetType(m.typeName); if (type == null) { continue; } MeasureTools mt = (MeasureTools)(type.GetConstructor(new Type[] { typeof(Configuration.Mensuration) })).Invoke(new Object[] { m }); if (mt != null) { Measures.Add(mt); } } }
/// <summary> /// 配置 /// </summary> public static Configuration GetConfiguration() { if (config == null) { config = (Configuration) new XmlSerializer(typeof(Configuration)).Deserialize(new FileStream("config.xml", FileMode.Open)); MeasureTools.init(); } return(config); }