You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
2.0 KiB
56 lines
2.0 KiB
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); |
|
} |
|
} |
|
} |
|
|
|
}
|
|
|