Esempio n. 1
0
 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;
     }
 }
Esempio n. 2
0
 private void configSave()
 {
     try
     {
         string filePath = System.IO.Path.GetFullPath(@configIni);
         IniFiles saveIni = new IniFiles(filePath);
         /*
          *      timeInterval = Convert.ToInt32(txtTimeInterval.Text.Trim());//间隔时间
                 _autoUserInfoBool = chbUpdata.Checked;//是否用户自动更新
                 _userInfoUpTime = Convert.ToInt32(txtTimeGetUserInfo.Text.Trim());//用户信息刷新间隔
                 timeToWork = Convert.ToInt32(txtTimeWork.Text.Trim()); //工作需执行的时间
                 timeToRest = Convert.ToInt32(txtTimeRest.Text.Trim()); //休息的时间
                 timeRunFriends = Convert.ToInt32(txtTimeFriends.Text.Trim()) * 60;//扫描好友时间
                 timeGetMature = Convert.ToInt32(txtTimeGetMature.Text.Trim());//获取成熟列表时间
                 _autoWeed = chbClearWeed.Checked; //自动除草
                 _autoWorm = chbSpraying.Checked; //自动杀虫
                 _autoWater = chbWater.Checked; //自动浇水
                 _autoPlant = chbPlant.Checked; //自动种植
                 _autoSteal = chbSteal.Checked; //自动收获
                 _autoScarify = chbScarify.Checked; //自动翻地
                 _autoSeed = chbSeed.Checked; //自动购买种子
                 _autoBag = chbBag.Checked; //查看背包
                 _autoDog = chbDog.Checked;//自动防狗
          *
          *
          *
          * */
         configDict.Clear();
         configDict.Add("自动种植植物ID", cId);
         configDict.Add("自动种植植物名称", new CropItem(GetCropModel(cId)).cName);
         configDict.Add("间隔时间", timeInterval.ToString());
         configDict.Add("用户自动更新", _autoUserInfoBool.ToString());
         configDict.Add("用户信息刷新间隔", _userInfoUpTime.ToString());
         configDict.Add("工作需执行的时间", timeToWork.ToString());
         configDict.Add("休息的时间",timeToRest.ToString());
         configDict.Add("扫描好友时间",timeRunFriends.ToString());
         configDict.Add("获取成熟列表时间", timeGetMature.ToString());
         configDict.Add("自动除草", _autoWeed.ToString());
         configDict.Add("自动杀虫", _autoWorm.ToString());
         configDict.Add("自动浇水", _autoWater.ToString());
         configDict.Add("自动种植", _autoPlant.ToString());
         configDict.Add("自动收获", _autoSteal.ToString());
         configDict.Add("自动翻地", _autoScarify.ToString());
         configDict.Add("自动购买种子", _autoSeed.ToString());
         configDict.Add("查看背包", _autoBag.ToString());
         configDict.Add("自动防狗", _autoDog.ToString());
         configDict.Add("farmKeyEncodeString", farmKeyEncodeString);
         configDict.Add("获取可操作好友时间间隔",timeGetFriendsFilter.ToString());
         string value = "";
         foreach (string key in configDict.Keys)
         {
             value = configDict[key];
             saveIni.WriteString("农场配置", key, value);
         }
     }
     catch (Exception)
     { }
 }
Esempio n. 3
0
 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;
     }
 }