public void ReadIniFile() { this.iniFile = new InIFile(Environment.CurrentDirectory + "\\spoilstatus.ini"); this.MainFormOpacity = iniFile.GetAsInt("MainFormOpacity", 75); this.MuteSounds = iniFile.GetAsBool("MuteSounds", false); this.EnableFishingHelper = iniFile.GetAsBool("EnableFishingHelper", true); this.EnableFishbot = iniFile.GetAsBool("EnableFishbot", false); this.UseFishingshots = iniFile.GetAsBool("UseFishingshots", false); this.PumpKey = (Keys)iniFile.GetAsInt("PumpKey", (int)Keys.F2); this.ReelKey = (Keys)iniFile.GetAsInt("ReelKey", (int)Keys.F3); this.FishshotKey = (Keys)iniFile.GetAsInt("FishshotKey", (int)Keys.F4); this.FishingSkillReuseTime = iniFile.GetAsInt("FishingSkillReuseTime", 1100); this.UsePromiscuousMode = iniFile.GetAsBool("UsePromiscuousMode", false); this.Lineage2FilePath = iniFile.GetAsString("Lineage2FilePath", string.Empty); this.AutoReset = iniFile.GetAsBool("AutoReset", false); }
private void Formsetup_Load(object sender, EventArgs e) { runParh = Directory.GetCurrentDirectory(); savedata = MainForm.savedata; String saveSay = savedata.Read("SaveSay", "key", "0"); if (saveSay == "0") { RadioBtn1.Select(); PathText.Text = runParh; Selectpath.Enabled = false; } else if (saveSay == "1") { RadioBtn2.Select(); PathText.Text = savedata.Read("SavePath", "key", runParh); Selectpath.Enabled = true; } }
//检测配置配置文件 public static void CheckDeploy() { if (Directory.Exists(BakcupPath) || check_old_config()) { if (File.Exists(BakcupPath + @"\BackupMap.ini") || check_old_config()) { // TODO 读取配置文件并载入 // TODO 循环备份的时间 ms 小于一分钟就抛出异常 ini = new InIFile(BakcupPath + @"\BackupMap.ini"); try { Profile.TickTime = Int32.Parse(ini.Read("Tick", "TickTime", "0")); if (Profile.TickTime < 1000 * 60) { Console.WriteLine("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " Error]Tick时间必须大于一分钟"); return; } TimerTick.Interval = Profile.TickTime; } catch (Exception e) { Console.WriteLine("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " Error]配置文件中Tick循环时间项出错:" + e.ToString()); } // TODO 保存的总文件夹 Profile.HomeDire = ini.Read("SaveMap", "SavePath", MapPath); // TODO 阙值 Profile.EnabledThreshold = ini.Read("Threshold", "Enabled", "0") != "0"; if (Profile.EnabledThreshold) { Profile.Threshold = int.Parse(ini.Read("Threshold", "Threshold", "0")); } // TODO 备份的相同文件夹名称的存档是否覆盖或跳过 Profile.Isleapfrog = ini.Read("SaveMap", "Leapfrog", "0") != "0"; // TODO 是否只在有玩家玩过服务器的情况下备份存档 Profile.NeedPlayerBakcup = ini.Read("SaveMap", "NeedPlayer", "0") != "0"; //备份时是否压缩存档到ZIP文件 Profile.Zip = ini.Read("SaveMap", "Zip", "0") != "0"; //备份完成之后要打开的文件或脚本或程序(附带参数) Profile.run = ini.Read("Cmd", "Run", "0"); TimerTick.Enabled = true; TimerTick.Start(); return; } } else { Directory.CreateDirectory(BakcupPath); } //显示窗口 new Thread(() => { System.Windows.Forms.Application.Run(new Form1()); }).Start(); }
private void Form1_Load(object sender, EventArgs e) { ini = new InIFile(AutoBackup.BakcupPath + @"\BackupMap.ini"); }