private void MenuOpen_Click(object sender, RoutedEventArgs e) { _listview.Clear(); DataListBox.Items.Clear(); OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.DefaultExt = "*.bin"; fileDialog.Filter = "Yugang Data Binary|*.bin"; Nullable <bool> result = fileDialog.ShowDialog(); if (result == true) { string filename = fileDialog.FileName; var templates = SpawnBuilder.GetSpawnTemplates(filename); foreach (var temp in templates) { _listview.Add(new ListViewTemplate() { Name = GetNpcName(temp.NpcId), Data = temp }); } RefreshListBox(); } }
private void MenuSave_Click(object sender, RoutedEventArgs e) { SaveFileDialog fileDialog = new SaveFileDialog(); fileDialog.DefaultExt = "*.bin"; fileDialog.Filter = "Yugang Data Binary|*.bin"; Nullable <bool> result = fileDialog.ShowDialog(); if (result == true) { string filename = fileDialog.FileName; SpawnBuilder.SaveToBin(filename, _listview.Select(v => v.Data).ToList()); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { Names = SpawnBuilder.GetNames(); }