void SaveRolls_Click(object sender, RoutedEventArgs e) { var dlg = new OpenSaveDlg(fSave: true); dlg.Title = "Save Rolls"; if (dlg.ShowDialog() != true) { return; } string k = dlg.selText.Text; if (k.Length == 0) { return; } k = k.Replace("/", "_").Replace(" ", "_"); var savePath = "_gameaid/_savedRolls/" + k; Main.SendHost(String.Format("del {0}", savePath)); Main.SendHost(String.Format("n {0} {1} {2}", savePath, "purpose", "readyrolls")); foreach (var child in mainGrid.Children) { var el = child as Button; if (el == null) { continue; } if (Grid.GetColumn(el) != 0) { continue; } var tag = el.Tag as string; if (tag == null || !tag.StartsWith("\\")) { continue; } Main.SendHost(String.Format("n {0} {1} {2}", savePath, tag, "<eval>")); if (tag.EndsWith("\\attack")) { Main.SendHost(String.Format("n {0} {1} {2}", savePath, tag.Replace("\\attack", "\\dmg"), "<eval>")); Main.SendHost(String.Format("n {0} {1} {2}", savePath, tag.Replace("\\attack", "\\sr"), "<eval>")); } if (tag.EndsWith("\\parry")) { Main.SendHost(String.Format("n {0} {1} {2}", savePath, tag.Replace("\\parry", "\\ap"), "<eval>")); } } }
void LoadRolls_Click(object sender, RoutedEventArgs e) { var dlg = new OpenSaveDlg(fSave: false); dlg.Title = "Load Rolls"; if (dlg.ShowDialog() != true) { return; } string k = dlg.selText.Text; if (k.Length == 0) { return; } k = k.Replace("/", "_").Replace(" ", "_"); var loadPath = "_gameaid/_savedRolls/" + k; Main.SendHost(String.Format("eval {0}", loadPath)); }