private void applyButton_Click(object sender, RoutedEventArgs e) { if (Common.ModSelectedfiles.Count == 0) { MessageBox.Show("请选择MOD"); return; } Cmd cmd = new Cmd(); foreach (var path in Common.ModSelectedfiles) { FastZip fz = new FastZip(); fz.ExtractZip(path.Key, AppDomain.CurrentDomain.BaseDirectory + "~temp", ""); } File.Delete(AppDomain.CurrentDomain.BaseDirectory + "~temp\\config.json"); DirectoryInfo di = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "~temp"); var dics = di.GetDirectories(); foreach (var item in dics) { cmd.RunProgram(Common.RQToolPath, "master\\" + item.Name + ".dat -r"); } BackupFiles(); CopyDirectory(AppDomain.CurrentDomain.BaseDirectory + "~temp", Common.MasterDicPath); Directory.Delete(AppDomain.CurrentDomain.BaseDirectory + "~temp", true); foreach (var item in dics) { cmd.RunProgram(Common.RQToolPath, "master\\" + item.Name + ".inf -r"); Directory.Delete(Common.MasterDicPath + item.Name, true); File.Delete(Common.MasterDicPath + item.Name + ".inf"); } MessageBox.Show("MOD成功"); }
private void clearbutton_Click(object sender, RoutedEventArgs e) { Cmd cmd = new Cmd(); DirectoryInfo di = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "backups"); var dics = di.GetDirectories(); foreach (var item in dics) { cmd.RunProgram(Common.RQToolPath, "master\\" + item.Name + ".dat -r"); } CopyDirectory(AppDomain.CurrentDomain.BaseDirectory + "backups", Common.MasterDicPath); foreach (var item in dics) { cmd.RunProgram(Common.RQToolPath, "master\\" + item.Name + ".inf -r"); Directory.Delete(Common.MasterDicPath + item.Name, true); File.Delete(Common.MasterDicPath + item.Name + ".inf"); } MessageBox.Show("还原成功"); }
private void applyButton_Click(object sender, RoutedEventArgs e) { if (Common.ModSelectedfiles.Count==0) { MessageBox.Show("请选择MOD"); return; } Cmd cmd = new Cmd(); foreach (var path in Common.ModSelectedfiles) { FastZip fz = new FastZip(); fz.ExtractZip(path.Key, AppDomain.CurrentDomain.BaseDirectory + "~temp",""); } File.Delete(AppDomain.CurrentDomain.BaseDirectory + "~temp\\config.json"); DirectoryInfo di = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "~temp"); var dics=di.GetDirectories(); foreach(var item in dics) { cmd.RunProgram(Common.RQToolPath, "master\\"+item.Name + ".dat -r"); } BackupFiles(); CopyDirectory(AppDomain.CurrentDomain.BaseDirectory + "~temp",Common.MasterDicPath); Directory.Delete(AppDomain.CurrentDomain.BaseDirectory + "~temp",true); foreach (var item in dics) { cmd.RunProgram(Common.RQToolPath, "master\\" + item.Name + ".inf -r"); Directory.Delete(Common.MasterDicPath + item.Name, true); File.Delete(Common.MasterDicPath + item.Name + ".inf"); } MessageBox.Show("MOD成功"); }