private void saveBtn_Click(object sender, EventArgs e) { if (_Data != null && _CurrentVolumeEntry.sampleName != null) { try { Cursor = Cursors.WaitCursor; _CurrentVolumeEntry.inVolume = float.Parse(inVolumeTxt.Text); _CurrentVolumeEntry.outVolume = float.Parse(outVolumeTxt.Text); _Data.SetVolumeForSample(_CurrentVolumeEntry); _Data.Save(); _UpdateXmbInfo(); MsgBoxHelper.Instance.Info(this, "Changes were applied succesfully."); } catch (FormatException ex) { MsgBoxHelper.Instance.AdditionalMessageOnError = "Make sure entered values are valid numbers."; MsgBoxHelper.Instance.Error(this, ex); } catch (Exception ex) { MsgBoxHelper.Instance.AdditionalMessageOnError = "Make sure current Xmb file is not write protected."; MsgBoxHelper.Instance.Error(this, ex); } finally { Cursor = Cursors.Default; } } }
private void Export(string input, string output) { if (IsVerbose) { Console.WriteLine(input); } XDocument doc; using (var stream = File.OpenRead(input)) { doc = new Xmb(new BinaryReader(stream)).Document; } using (var stream = File.Create(output)) { doc.Save(stream); } }