|
|
|
|
using KGIS.Framework.Maps;
|
|
|
|
|
using KGIS.Framework.Utils;
|
|
|
|
|
using Kingo.PluginServiceInterface;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
using System.Xml.Serialization;
|
|
|
|
|
//using static Kingo.PluginServiceInterface.Model.SystemConfig;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.BGSetting.Service
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
[XmlRoot("config")]
|
|
|
|
|
public class SystCfgClass : ISystemCfg
|
|
|
|
|
{
|
|
|
|
|
public SystemConfig2 SysCfg { get; set; }
|
|
|
|
|
public SystemConfig2 Load()
|
|
|
|
|
{
|
|
|
|
|
string BaseLoadCfg = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "SystemCfg.xml");
|
|
|
|
|
if (System.IO.File.Exists(BaseLoadCfg))
|
|
|
|
|
{
|
|
|
|
|
SystemConfig2 cfg = SerializeAPI.DeserializeToObject2<SystemConfig2>(BaseLoadCfg);
|
|
|
|
|
return cfg;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Save()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//string BaseLoadCfg = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "SystemCfg.xml");
|
|
|
|
|
//if (System.IO.File.Exists(BaseLoadCfg))
|
|
|
|
|
//{
|
|
|
|
|
// string cfg = SerializeAPI.SerializeToXML<SystemConfig2>(this);
|
|
|
|
|
//}
|
|
|
|
|
//SystCfgClass cfg_SystemSetting = new SystCfgClass();
|
|
|
|
|
//cfg_SystemSetting.BaseLoadCfg = this.BaseLoadCfg;
|
|
|
|
|
//cfg_SystemSetting.JZCGCfg = this.JZCGCfg;
|
|
|
|
|
//string cfg = SerializeAPI.SerializeToXML<SystCfgClass>(cfg_SystemSetting);
|
|
|
|
|
//string newSavePath = System.IO.Path.Combine((MapsManager.Instance.CurrProjectInfo as ProjectInfo).ProjDir, "SystemSettingConfig.xml");
|
|
|
|
|
//XmlDocument xmlDoc = new XmlDocument();
|
|
|
|
|
//xmlDoc.LoadXml(cfg);
|
|
|
|
|
//xmlDoc.Save(newSavePath);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("保存系统配置文件失败:" + ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|