using MaterialTraceability.Common;
using MaterialTraceability.Entity.Config;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MaterialTraceability.Entity.DTO
{
    public sealed class AppConfigDto
    {
        private static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/App.InI");

        private static readonly Lazy<AppConfigDto> lazy = new Lazy<AppConfigDto>(() => new AppConfigDto());

        public static AppConfigDto Instance
        {
            get
            {
                return lazy.Value;
            }
        }

        private AppConfigDto() { }

        public int readTime = StringChange.ParseToInt(iNIFile.IniReadValue("SystemConfig", "readTime"));

        public int machineId = StringChange.ParseToInt(iNIFile.IniReadValue("SystemConfig", "machineId"));

        public string processId = iNIFile.IniReadValue("SystemConfig", "processId");

        public string resource = iNIFile.IniReadValue("SystemConfig", "resource");

        public int plcSingalReadTime = StringChange.ParseToInt(iNIFile.IniReadValue("SystemConfig", "plcSingalReadTime"));

        public string plcAddress = iNIFile.IniReadValue("SystemConfig", "plcAddress");

        public int plcPort = StringChange.ParseToInt(iNIFile.IniReadValue("SystemConfig", "plcPort"));

        public int isMesFlag = StringChange.ParseToInt(iNIFile.IniReadValue("SystemConfig", "isMesFlag"));

        public string operation = iNIFile.IniReadValue("SystemConfig", "operation");

        public string operationByA = iNIFile.IniReadValue("SystemConfig", "operationByA");

        public string operationByB = iNIFile.IniReadValue("SystemConfig", "operationByB");

        public string MesWebServiceTimeOut = iNIFile.IniReadValue("SystemConfig", "MesWebServiceTimeOut");

        public TbAddress TbAddress = TbAddress.Instance;

        public LyAddress LyAddress = LyAddress.Instance;

        public MqAddress mqAddress = MqAddress.Instance;
    }
}