private void configRead() { try { string filePath = System.IO.Path.GetFullPath(@configIni); IniFiles readIni = new IniFiles(filePath); string value = ""; StringCollection keyList = new StringCollection(); readIni.ReadSection("农场配置", keyList); configDict.Clear(); foreach (string k in keyList) { value = readIni.ReadString("农场配置", k, ""); configDict.Add(k, value); } cId = configDict["自动种植植物ID"]; timeInterval = Convert.ToInt32(configDict["间隔时间"]); _autoUserInfoBool = Convert.ToBoolean(configDict["用户自动更新"]); _userInfoUpTime = Convert.ToInt32(configDict["用户信息刷新间隔"]); timeToWork = Convert.ToInt32(configDict["工作需执行的时间"]); timeToRest = Convert.ToInt32(configDict["休息的时间"]); timeRunFriends = Convert.ToInt32(configDict["扫描好友时间"]); timeGetMature = Convert.ToInt32(configDict["获取成熟列表时间"]); timeGetFriendsFilter = Convert.ToInt32(configDict["获取可操作好友时间间隔"]); _autoWeed = Convert.ToBoolean(configDict["自动除草"]); _autoWorm = Convert.ToBoolean(configDict["自动杀虫"]); _autoWater = Convert.ToBoolean(configDict["自动浇水"]); _autoPlant = Convert.ToBoolean(configDict["自动种植"]); _autoSteal = Convert.ToBoolean(configDict["自动收获"]); _autoScarify = Convert.ToBoolean(configDict["自动翻地"]); _autoSeed = Convert.ToBoolean(configDict["自动购买种子"]); _autoBag = Convert.ToBoolean(configDict["查看背包"]); _autoDog = Convert.ToBoolean(configDict["自动防狗"]); farmKeyEncodeString = configDict["farmKeyEncodeString"]; } catch (Exception except) { throw except; } }
private void readCrop() { try { string filePath = System.IO.Path.GetFullPath(@ncIni); Dictionary<string, Dictionary<string, string>> temp = new Dictionary<string, Dictionary<string, string>>(); IniFiles readIni = new IniFiles(filePath); StringCollection sectionList = new StringCollection(); StringCollection keyList = new StringCollection(); string value = ""; readIni.ReadSections(sectionList); foreach (string s in sectionList) { Dictionary<string, string> tempCrop = new Dictionary<string, string>(); readIni.ReadSection(s, keyList); foreach (string k in keyList) { value = readIni.ReadString(s, k, ""); if (!tempCrop.ContainsKey(k)) { tempCrop.Add(k, value); } } if (!temp.ContainsKey(s)) { temp.Add(s, tempCrop); } } _crop = temp; } catch (Exception except) { throw except; } }