using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; using KGIS.Framework.Utils; using Kingo.Plugin.EngineEditor.Model; using Kingo.Plugin.EngineEditor.Unit; namespace Kingo.Plugin.EngineEditor.helper { public class ConfigHelper { public static List GetResultsCatalog(CheckTypeEnum typeEnum) { List result = new List(); try { XmlDocument doc = new XmlDocument(); string strPath = SysAppPath.GetGeoCheckCfgPath(); doc.Load(strPath); XmlNode nodeDataCatalog = doc.SelectSingleNode("Infornation"); if (nodeDataCatalog == null) return result; switch(typeEnum) { case CheckTypeEnum.GeoOverInfor: result.AddRange(GetInfor("图斑压盖", nodeDataCatalog)); break; case CheckTypeEnum.GeoCheckInfor: result.AddRange(GetInfor("图形规范性", nodeDataCatalog)); break; default:break; } return result; } catch (Exception ex) { LogAPI.Debug(ex); throw; } } private static List GetInfor(string Title, XmlNode nodeDataCatalog) { List Columns = new List(); foreach (XmlNode item in nodeDataCatalog.ChildNodes) { if (item.Attributes["Name"].Value.ToString() == Title) { foreach (XmlNode col in item.ChildNodes) { Columns.Add(col.Attributes["Name"].Value == null ? "" : col.Attributes["Name"].Value); } } } return Columns; } public static List GetInfor(string NodeName) { List Columns = new List(); try { XmlDocument doc = new XmlDocument(); string strPath = SysAppPath.GetGeoCheckCfgPath(); doc.Load(strPath); XmlNode nodeDataCatalog = doc.SelectSingleNode(NodeName); if (nodeDataCatalog == null) return Columns; foreach (XmlNode item in nodeDataCatalog.ChildNodes) { Columns.Add(item.Attributes["Name"].Value == null ? "" : item.Attributes["Name"].Value); } return Columns; } catch (Exception ex) { LogAPI.Debug(ex); return Columns; } } public static Dictionary GetColumnsInFor { get { Dictionary pairs = new Dictionary(); try { XmlDocument doc = new XmlDocument(); string strPath = SysAppPath.GetGeoCheckCfgPath(); doc.Load(strPath); XmlNode nodeDataCatalog = doc.SelectSingleNode("Infornation"); if (nodeDataCatalog == null) return null; foreach (XmlNode item in nodeDataCatalog.ChildNodes) { foreach (XmlNode col in item.ChildNodes) { pairs.Add(col.Attributes["Name"].Value, col.Attributes["displayName"].Value); } } return pairs; } catch (Exception ex) { LogAPI.Debug(ex); return null; } } } } }