| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 | 
							- using Aitex.Common.Util;
 
- using Aitex.Core.RT.Log;
 
- using Aitex.Core.Util;
 
- using MECF.Framework.Common.Persistent.Prewet;
 
- using MECF.Framework.Common.Persistent.Rinse;
 
- using MECF.Framework.Common.Persistent.SRD;
 
- using MECF.Framework.Common.ToolLayout;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Collections.ObjectModel;
 
- using System.IO;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- namespace MECF.Framework.Common.Persistent.Reservoirs
 
- {
 
-     public class ReservoirsPersistentManager : Singleton<ReservoirsPersistentManager>
 
-     {
 
-         #region 内部变量
 
-         private Dictionary<string, ReservoirsPersistentValue> _persistentValueDic = new Dictionary<string, ReservoirsPersistentValue>();
 
-         private Dictionary<string, string> _persistentValuePathDic = new Dictionary<string, string>();
 
-         #endregion
 
-         /// <summary>
 
-         /// 初始化
 
-         /// </summary>
 
-         public void Initialize()
 
-         {
 
-             try
 
-             {
 
-                 List<string> installedModules= ReservoirItemManager.Instance.InstalledModules;
 
-                 foreach (string module in installedModules)
 
-                 {
 
-                     string foldStr= $"{PathManager.GetCfgDir()}Persistent\\Reservoirs";
 
-                     if(!Directory.Exists(foldStr))
 
-                     {
 
-                         Directory.CreateDirectory(foldStr);
 
-                     }
 
-                     string str = $"{foldStr}\\{module}Persistent.xml";
 
-                     _persistentValuePathDic[module] = str;
 
-                     if (File.Exists(str))
 
-                     {
 
-                         ReservoirsPersistentValue reservoirs1PersistentValue = CustomXmlSerializer.Deserialize<ReservoirsPersistentValue>(new FileInfo(str));
 
-                         if (reservoirs1PersistentValue != null)
 
-                         {
 
-                             _persistentValueDic[module] = reservoirs1PersistentValue;
 
-                         }
 
-                     }
 
-                     else
 
-                     {
 
-                         //File.Create(str);
 
-                         ReservoirsPersistentValue persistentValue = new ReservoirsPersistentValue();
 
-                         persistentValue.Name = module;
 
-                         persistentValue.Recipe = "";
 
-                         persistentValue.OperatingMode = "Manual";
 
-                         persistentValue.RecipeOperatingMode = "Engineering";
 
-                         _persistentValueDic[module] = persistentValue;
 
-                         UpdatePersistentValue(module);
 
-                     }
 
-                 }
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_RESERVOIR, "System", "Load ReservoirsPersistent xml exception");
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 获取Reservoir Persistent数值
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public ReservoirsPersistentValue GetReservoirsPersistentValue(string module)
 
-         {
 
-             if( _persistentValueDic.ContainsKey(module)) 
 
-             { 
 
-                 return _persistentValueDic[module];
 
-             }
 
-             else
 
-             {
 
-                 return null;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 更新PersistentValue
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public void UpdatePersistentValue(string module)
 
-         {
 
-             if (_persistentValueDic.ContainsKey(module))
 
-             {
 
-                 try
 
-                 {
 
-                     CustomXmlSerializer.Serialize(_persistentValueDic[module], _persistentValuePathDic[module]);
 
-                 }
 
-                 catch (Exception ex)
 
-                 {
 
-                     LOG.WriteLog(eEvent.ERR_RESERVOIR, module, "Update ReserviorsPersistent xml file excepetion");
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_RESERVOIR, module, "Update ReserviorsPersistent xml file excepetion");
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |