public void LoadToneFile(string toneSavePath, bool verbose = true) { try { switch (CurrentGameVersion) { case GameVersion.RS2012: toneControl.Tone = Tone.LoadFromXmlTemplateFile(toneSavePath); break; case GameVersion.RS2014: toneControl.Tone = Tone2014.LoadFromXmlTemplateFile(toneSavePath); break; } } catch (Exception ex) { toneControl.Tone = null; MessageBox.Show("Can't load saved tone. \n" + ex.Message, DLCPackageCreator.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (verbose) { MessageBox.Show("Tone was loaded.", DLCPackageCreator.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void loadButton_Click(object sender, EventArgs e) { string toneSavePath; using (var ofd = new OpenFileDialog()) { ofd.Filter = CurrentOFDFilter; if (ofd.ShowDialog() != DialogResult.OK) { return; } toneSavePath = ofd.FileName; } dynamic tone = null; try { switch (CurrentGameVersion) { case GameVersion.RS2012: tone = Tone.LoadFromXmlTemplateFile(toneSavePath); break; case GameVersion.RS2014: tone = Tone2014.LoadFromXmlTemplateFile(toneSavePath); break; } } catch (Exception ex) { MessageBox.Show("Can't load saved tone. \n" + ex.Message, DLCPackageCreator.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } toneControl1.Tone = tone; MessageBox.Show("Tone was loaded.", DLCPackageCreator.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); }