| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 | 
							- using Aitex.Core.RT.Log;
 
- using Caliburn.Micro;
 
- using MECF.Framework.Common.DataCenter;
 
- using MECF.Framework.Common.Equipment;
 
- using OpenSEMI.ClientBase.ServiceProvider;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows;
 
- using System.Xml;
 
- using Venus_Core;
 
- namespace Venus_MainPages.Unity
 
- {
 
-     public class SystemConfigProvider : IProvider
 
-     {
 
-         private static SystemConfigProvider _Instance = null;
 
-         private int _currentChamberNumber = 0;
 
-         //private int? _systemtype = null;
 
-         private string[] _InstalledModules=null;
 
-         private List<string> _modulelist = new List<string>() { "EFEM", "TM", "LLA", "LLB","DETM" ,"SETM", "VCE1","VCEA","VCEB", "PMA", "PMB", "PMC", "PMD", "PME", "PMF" };
 
-         public static SystemConfigProvider Instance
 
-         {
 
-             get
 
-             {
 
-                 if (_Instance == null)
 
-                     _Instance = new SystemConfigProvider();
 
-                 return _Instance;
 
-             }
 
-         }
 
-         public void Create()
 
-         {
 
-         }
 
-         private Dictionary<string, DataType> typeDic = new Dictionary<string, DataType>() {
 
-                 { "String", DataType.String },
 
-                 { "Bool", DataType.Bool },
 
-                 { "Integer", DataType.Int },
 
-                 { "Double", DataType.Double }
 
-         };
 
-         public ConfigNode GetConfig()
 
-         {
 
-             string config = QueryDataClient.Instance.Service.GetConfigFileContent();
 
-             _currentChamberNumber = Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig("System.ChamberSelect"));
 
-             _InstalledModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
 
-             if (string.IsNullOrEmpty(config))
 
-                 return null;
 
-             ConfigNode result = new ConfigNode() { Path = string.Empty };
 
-             try
 
-             {
 
-                 XmlDocument xml = new XmlDocument();
 
-                 xml.LoadXml(config);
 
-                 XmlElement element = xml.SelectSingleNode("root") as XmlElement;
 
-                 BuildTree(element, result);
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 //LOG.Write(ex);
 
-                 LOG.WriteExeption(ex);
 
-             }
 
-             return result;
 
-         }
 
-         public void BuildTree(XmlElement root, ConfigNode item,int chambertype = -1)
 
-         {
 
-             item.Name = root.GetAttribute("name");
 
-             item.SubNodes = new List<ConfigNode>();
 
-             item.Items = new List<ConfigItem>();
 
-             if (_modulelist.Contains(item.Name))
 
-             {
 
-                 if (!_InstalledModules.Contains(item.Name))
 
-                     item.IsShow = false;
 
-                 else
 
-                 {
 
-                     if (Enum.TryParse(item.Name, out ModuleName currentChamber) && ModuleHelper.IsPm(currentChamber))
 
-                         chambertype = Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"{currentChamber}.ChamberType"));
 
-                     else
 
-                         chambertype = -1;
 
-                 }
 
-                 
 
-             }
 
-             XmlNodeList group = root.SelectNodes("configs");
 
-             XmlNodeList single = root.SelectNodes("config");
 
-             if (group != null)
 
-             {
 
-                 foreach (var groupItem in group)
 
-                 {
 
-                     XmlElement element = groupItem as XmlElement;
 
-                     ConfigNode sc = new ConfigNode() { Path = item.Name };
 
-                     string strVisible = element.GetAttribute("visible");
 
-                     bool bVisible;
 
-                     if (!bool.TryParse(strVisible, out bVisible))
 
-                         bVisible = true;
 
-                     if (!bVisible)  //do not show the item if visible field is false
 
-                         continue;
 
-                     BuildTree(element, sc, chambertype);
 
-                     item.SubNodes.Add(sc);
 
-                 }
 
-             }
 
-             if (single != null)
 
-             {
 
-                 foreach (var singleItem in single)
 
-                 {
 
-                     XmlElement element = singleItem as XmlElement;
 
-                     string strVisible = element.GetAttribute("visible");
 
-                     bool bVisible;
 
-                     if (!bool.TryParse(strVisible, out bVisible))
 
-                         bVisible = true;
 
-                     if (!bVisible)  //do not show the item if visible field is false
 
-                         continue;
 
-                     string typeflag = element.GetAttribute("typeflag");
 
-                     if (!string.IsNullOrEmpty(typeflag) && chambertype != -1)
 
-                     {
 
-                         int support = Convert.ToInt32(typeflag);
 
-                         int currentchambertype = -1;
 
-                         for (int i = 0; i < Enum.GetValues(typeof(JetChamber)).Length; i++)
 
-                         {
 
-                             if (i == chambertype)
 
-                             {
 
-                                 currentchambertype = (int)Enum.GetValues(typeof(JetChamber)).GetValue(i);
 
-                                 break;
 
-                             }
 
-                         }
 
-                         if ((support & currentchambertype) != currentchambertype)
 
-                             continue;
 
-                     }
 
-                     ConfigItem config = new ConfigItem()
 
-                     {
 
-                         Name = element.GetAttribute("name"),
 
-                         DefaultValue = element.GetAttribute("default"),
 
-                         Description = element.GetAttribute("description"),
 
-                         Max = ConvertStringToFloat(element.GetAttribute("max")),
 
-                         Min = ConvertStringToFloat(element.GetAttribute("min")),
 
-                         Parameter = element.GetAttribute("paramter"),
 
-                         Unit = element.GetAttribute("unit"),
 
-                         Tag = element.GetAttribute("tag")
 
-                     };
 
-                     string strType = element.GetAttribute("type");
 
-                     config.Type = typeDic.ContainsKey(strType) ? typeDic[strType] : DataType.Unknown;
 
-                     config.Visible = bVisible;
 
-                     item.Items.Add(config);
 
-                 }
 
-             }
 
-         }
 
-         private float ConvertStringToFloat(string value)
 
-         {
 
-             float result;
 
-             if (!float.TryParse(value, out result))
 
-                 result = float.NaN;
 
-             return result;
 
-         }
 
-         public ConfigNode GetConfigTree()
 
-         {
 
-             return GetConfig();
 
-         }
 
-         public List<string> GetValuesByNode(string node)
 
-         {
 
-             List<string> values = new List<string>();
 
-             //interface to get values
 
-             return values;
 
-         }
 
-         public string GetValueByName(string name)
 
-         {
 
-             object result = QueryDataClient.Instance.Service.GetConfig(name);
 
-             if (result != null)
 
-                 return result.ToString();
 
-             else
 
-                 return string.Empty;
 
-         }
 
-     }
 
- }
 
 
  |