Exemple #1
0
        //--------------------------------------------------------------------------
        //Read/Write Para.
        public void  Load(bool IsLoad, int Act, string Path)
        {
            //Local Var.
            string sName = string.Format("ACTUATOR({0,3:000})", Act + 1);

            if (IsLoad)
            {
                m_xfwdId = 0;
                m_xbwdId = 0;
                m_yfwdId = 0;
                m_ybwdId = 0;

                Name                 = UserINI.fn_Load("Name", sName, sName, Path);
                Comt                 = UserINI.fn_Load("Comment", sName, Comt, Path);
                m_xfwdId             = UserINI.fn_Load("xFwdID", sName, m_xfwdId, Path);
                m_xbwdId             = UserINI.fn_Load("xBwdID", sName, m_xbwdId, Path);
                m_yfwdId             = UserINI.fn_Load("yFwdID", sName, m_yfwdId, Path);
                m_ybwdId             = UserINI.fn_Load("yBwdID", sName, m_ybwdId, Path);
                ApplyTimeout         = UserINI.fn_Load("ApplyTimeout", sName, false, Path);
                nFwdTimeOutDelayTime = UserINI.fn_Load("FwdTimeOutDelayTime", sName, 0, Path);
                nBwdTimeOutDelayTime = UserINI.fn_Load("BwdTimeOutDelayTime", sName, 0, Path);
                nFwdOnDelayTime      = UserINI.fn_Load("FwdOnDelayTime", sName, 0, Path);
                nBwdOnDelayTime      = UserINI.fn_Load("BwdOnDelayTime", sName, 0, Path);

                ThreadApplyTime  = UserINI.fn_Load("ThreadApplyTime", sName, 0, Path);
                ApplyOutComplete = UserINI.fn_Load("ApplyOutComplete", sName, false, Path);
                iInv             = UserINI.fn_Load("Inv", sName, 0, Path);

                SetxfwdId(m_xfwdId);
                SetxbwdId(m_xbwdId);
                SetyfwdId(m_yfwdId);
                SetybwdId(m_ybwdId);
            }
            else
            {
                UserINI.fn_Save("Name", sName, Name, Path);
                UserINI.fn_Save("Comment", sName, Comt, Path);
                UserINI.fn_Save("xFwdID", sName, m_xfwdId, Path);
                UserINI.fn_Save("xBwdID", sName, m_xbwdId, Path);
                UserINI.fn_Save("yFwdID", sName, m_yfwdId, Path);
                UserINI.fn_Save("yBwdID", sName, m_ybwdId, Path);
                UserINI.fn_Save("ApplyTimeout", sName, ApplyTimeout, Path);
                UserINI.fn_Save("FwdTimeOutDelayTime", sName, nFwdTimeOutDelayTime, Path);
                UserINI.fn_Save("BwdTimeOutDelayTime", sName, nBwdTimeOutDelayTime, Path);
                UserINI.fn_Save("FwdOnDelayTime", sName, nFwdOnDelayTime, Path);
                UserINI.fn_Save("BwdOnDelayTime", sName, nBwdOnDelayTime, Path);

                UserINI.fn_Save("ThreadApplyTime", sName, ThreadApplyTime, Path);
                UserINI.fn_Save("ApplyOutComplete", sName, ApplyOutComplete, Path);
                UserINI.fn_Save("Inv", sName, iInv, Path);

                SetxfwdId(m_xfwdId);
                SetxbwdId(m_xbwdId);
                SetyfwdId(m_yfwdId);
                SetybwdId(m_ybwdId);
            }
        }
Exemple #2
0
        //--------------------------------------------------------------------------
        //Loading Para.
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        public void fn_Load(bool bload)
        {
            //Local Var
            string sIniPath, sSection, m_strPath;

            m_strPath = fn_GetExePath();

            //File Path
            sIniPath = m_strPath + "SYSTEM\\LampBuzz.ini";

            m_bDrngSave = true;
            if (bload)
            {
                if (!fn_CheckFileExist(sIniPath))
                {
                    m_bDrngSave = false;
                    return;
                }

                for (int i = 0; i < UserConst.MAX_LAMP_KIND; i++)
                {
                    sSection            = string.Format($"LAMP_BUZZ_{i:D2}");
                    m_LampInfo[i].iRed  = UserINI.fn_Load(sSection, "Red", m_LampInfo[i].iRed, sIniPath);
                    m_LampInfo[i].iYel  = UserINI.fn_Load(sSection, "Yellow", m_LampInfo[i].iYel, sIniPath);
                    m_LampInfo[i].iGrn  = UserINI.fn_Load(sSection, "Green", m_LampInfo[i].iGrn, sIniPath);
                    m_LampInfo[i].iBuzz = UserINI.fn_Load(sSection, "Buzzer", m_LampInfo[i].iBuzz, sIniPath);
                }
            }
            else
            {
                for (int i = 0; i < UserConst.MAX_LAMP_KIND; i++)
                {
                    sSection = string.Format($"LAMP_BUZZ_{i:D2}");
                    UserINI.fn_Save(sSection, "KIND", ((EN_SEQ_STATE)i).ToString(), sIniPath);
                    UserINI.fn_Save(sSection, "Red", m_LampInfo[i].iRed, sIniPath);
                    UserINI.fn_Save(sSection, "Yellow", m_LampInfo[i].iYel, sIniPath);
                    UserINI.fn_Save(sSection, "Green", m_LampInfo[i].iGrn, sIniPath);
                    UserINI.fn_Save(sSection, "Buzzer", m_LampInfo[i].iBuzz, sIniPath);
                }
            }
        }