wenxiangchao
3 天以前 b544d5cccd76735e034c8055918a50927b437474
HMI.Core/Setting/ParamSetting.cs
@@ -1,17 +1,38 @@
using HMI.Core.Manager;
using HMI.Core.Util;
using System.Collections;
using System.Configuration;
using System.IO;
using System.Runtime.CompilerServices;
namespace HMI.Core.Setting
{
    public class ParamSetting
    {
        private static Hashtable customConfig = (Hashtable)ConfigurationManager.GetSection("TestResultConfig");
        private static string GetValue([CallerMemberName] string propertyName = null)
        {
            return (customConfig != null && customConfig.ContainsKey(propertyName)) ? customConfig[propertyName].ToString() : null;
        }
        /// <summary>
        /// MesAddress
        /// </summary>
        public static string MesAddress { get; private set; } = "127.0.0.1:8080";
        /// <summary>
        /// 老化导出行转列
        /// </summary>
        public static bool ReverseCSV { get; private set; } = false;
        /// <summary>
        /// 客户编码
        /// </summary>
        public static string CustomerCode { get; private set; }
        /// <summary>
        /// 生产数据DB存放目录
        /// </summary>
        public static string DataLogFolder { get; private set; } = null;
@@ -28,15 +49,33 @@
        public static bool ProbeByModel { get; private set; } = false;
        public static int ReverseCSVSkipRow { get; private set; } = 3;
        /// <summary>
        /// 操作是否需要密码
        /// </summary>
        public static bool IsOptRequirePassword { get; private set; } = false;
        /// <summary>
        /// 启用扫码换型
        /// </summary>
        public static bool EnableAutoModel { get; private set; } = false;
        public const string ShareConfigKey = "ShareConfig";
        public static string ShareConfig { get; private set; } = null;
        public static bool ShowBurnInAbort { get; private set; } = true;
        public static string SocketNames { get; private set; } = string.Empty;
        public static string StationName { get; private set; } = string.Empty;
        public static string MainSeqPath { get; private set; } = string.Empty;
        public static string EngineType
        {
            get
            {
                var data = GetValue();
                return data == null ? "TestStand" : data.ToString();
            }
        }
        static ParamSetting()
        {
@@ -154,7 +193,7 @@
            try
            {
                ShareConfig = ParameterManager.GetCommonParameterByName<string>("ShareConfig", null);
                ShareConfig = ParameterManager.GetCommonParameterByName<string>(ShareConfigKey, null);
            }
            catch
            {
@@ -178,6 +217,25 @@
            {
            }
            try
            {
                StationName = ParameterManager.GetCommonParameterByName<string>("StationName", string.Empty);
            }
            catch
            {
            }
            try
            {
                MainSeqPath = ParameterManager.GetCommonParameterByName<string>("BurnInMainSeq", string.Empty);
            }
            catch
            {
            }
        }
    }
}