示例#1
0
        /// <summary>
        /// Convert KeyValue Pairs into a Dictionary
        /// </summary>
        /// <param name="allKeyValue"></param>
        /// <returns></returns>
        public static Dictionary <string, string> ConvertToDictionary(string[] allKeyValue)
        {
            var results = new Dictionary <string, string>();

            foreach (var Key_Value in allKeyValue)
            {
                var keyValue = Key_Value.Split('=');
                var key      = keyValue[0];
                var value    = keyValue[1];
                results[key] = value;
            }
            return(results);
        }
 public static Dictionary <string, string> ReadInfoIniFile(string path, string section)
 {
     warnmsg.Clear();
     string[] allKeys = ReadIniAllKeys(section, path);
     foreach (string Key_Value in allKeys)
     {
         string[] _Key_Value = Key_Value.Split('=');
         string   key        = _Key_Value[0];
         string   value      = _Key_Value[1];
         warnmsg[key] = value;
     }
     return(warnmsg);
 }
示例#3
0
 /// <summary>
 /// Read PLC Address
 /// </summary>
 /// <param name="path"></param>
 public static void ReadAddrIniFile(string path)
 {
     try
     {
         string[] sections = INIGetAllSectionNames(path);
         foreach (string section in sections)
         {
             string[] allKeys = ReadIniAllKeys(section, path);
             foreach (string Key_Value in allKeys)
             {
                 string[] _Key_Value = Key_Value.Split('=');
                 string   key        = _Key_Value[0];
                 string   value      = _Key_Value[1];
                 addr[key] = value;
             }
         }
     }
     catch
     { Trace.Write("配置文件读取失败!"); }
 }
示例#4
0
 public void ReadInfoIniFile(string path)
 {
     try
     {
         var sections = IniGetAllSectionNames(path);
         foreach (var section in sections)
         {
             var allKeys = IniGetAllItems(path, section);
             foreach (var Key_Value in allKeys)
             {
                 var keyValue = Key_Value.Split('=');
                 var key      = keyValue[0];
                 var value    = keyValue[1];
                 warnmsg[key] = value;
             }
         }
     }
     catch
     {
         Trace.Write("配置文件读取失败!");
     }
 }
示例#5
0
 public void ReadAddrIniFile(string path)
 {
     try
     {
         var sections = IniGetAllSectionNames(path);
         foreach (var section in sections)
         {
             var allKeys = IniGetAllItems(path, section);
             foreach (var Key_Value in allKeys)
             {
                 var _Key_Value = Key_Value.Split('=');
                 var key        = _Key_Value[0];
                 var value      = _Key_Value[1];
                 addr[key] = Convert.ToInt32(value);
             }
         }
     }
     catch
     {
         Trace.Write("配置文件读取失败!");
     }
 }