Exemple #1
0
        public static S_ConfigInfo ReadConfigInfo()
        {
            S_ConfigInfo s_ConfigInfo = new S_ConfigInfo();

            StringBuilder sb = new StringBuilder(255);

            GetPrivateProfileString("ConfigNum", "SoundAlert", "", sb, sb.Capacity, Consts.ConfigPath);
            s_ConfigInfo.SoundAlert = sb.ToString();



            GetPrivateProfileString("ConfigNum", "SConfigInfoNum", "", sb, sb.Capacity, Consts.ConfigPath);
            int sNum = 0;

            if (int.TryParse(sb.ToString(), out sNum))
            {
                s_ConfigInfo.SConfigInfoNum = sNum;
            }

            GetPrivateProfileString("ConfigNum", "Show", "", sb, sb.Capacity, Consts.ConfigPath);
            bool show = true;

            if (bool.TryParse(sb.ToString(), out show))
            {
                s_ConfigInfo.Show = show;
            }


            for (int i = 1; i <= sNum; i++)
            {
                ConfigInfo configInfo = new ConfigInfo();
                //name
                configInfo.SMonitorName = ReadIniCN("Config", "SMonitorName" + i, Consts.ConfigPath);

                //ip
                GetPrivateProfileString("Config", "Ip" + i, "", sb, sb.Capacity, Consts.ConfigPath);
                configInfo.Ip = sb.ToString();
                //port
                GetPrivateProfileString("Config", "Port" + i, "", sb, sb.Capacity, Consts.ConfigPath);
                int portNm = 19990;
                int.TryParse(sb.ToString(), out portNm);
                configInfo.Port = portNm;
                s_ConfigInfo.ConfigInfo.Add(configInfo);
            }
            return(s_ConfigInfo);
        }
Exemple #2
0
 public SPlugin()
 {
     configInfo = IniConfigHelper.ReadConfigInfo();
 }