Пример #1
0
        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();
            }
        }
Пример #2
0
        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());
            }
        }
Пример #3
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     Names = SpawnBuilder.GetNames();
 }