From cad632ba6fa3236c057ce6e9bdea0f5eea1664f3 Mon Sep 17 00:00:00 2001 From: dexy Date: Thu, 16 Jan 2020 02:27:16 +1100 Subject: [PATCH] Enabled onim export function on YcdForm --- Forms/YcdForm.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Forms/YcdForm.cs b/Forms/YcdForm.cs index e92bc70..bb6331a 100644 --- a/Forms/YcdForm.cs +++ b/Forms/YcdForm.cs @@ -46,7 +46,30 @@ namespace CodeWalker.Forms private void ExportOnim_Click(object sender, EventArgs e) { + if (MainListView.SelectedItems[0].Tag is Animation anim) + { + var saveFileDialog = new SaveFileDialog(); + string newfn = $"{Path.GetFileNameWithoutExtension(Ycd.Name)}_{MainListView.SelectedItems[0].Text}.onim"; + + saveFileDialog.FileName = newfn; + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + string path = saveFileDialog.FileName; + + try + { + using (var file = File.OpenWrite(path)) + { + Ycd.SaveOpenFormatsAnimation(anim, file); + } + } + catch (Exception ex) + { + MessageBox.Show("Error saving file " + path + ":\n" + ex.ToString()); + } + } + } } private void UpdateFormTitle()