using KGIS.Framework.Utils; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; namespace Kingo.Plugin.EngineEditor.helper { public class AreaConfigHelper { /// /// 获取对应图层需要修改的面积字段名称 /// /// /// public static string GetAreaPropertyByLayerName(string layername) { var areapath = SysAppPath.GetAreaUpdateConfigPath(); //解析xml XElement rootelement = XElement.Load(areapath); var layerelment = rootelement.Element("Layers"); foreach (var sub in rootelement.Descendants()) { Console.WriteLine(sub.Name); if (sub.Attribute("Name").Value == layername) { var areaProperty = ""; areaProperty = sub.Attribute("AreaProperty").Value; return areaProperty; } } return ""; } } }