public static void WriteMetaXml(UNIcastMeta meta, string path) { XElement tagsElement = new XElement("Tags"); foreach (string tag in meta.Tags) { tagsElement.Add(new XElement("Tag", tag)); } XElement xml = new XElement("UNIcastMeta", new XElement("DateTime", meta.DateTime.ToString("s")), new XElement("Lecturer", meta.Lecturer), new XElement("Subject", meta.Subject), new XElement("Title", meta.Title), new XElement("Description", meta.Description), tagsElement, new XElement("Privacy", meta.Privacy), new XElement("Media", new XElement("FileName", meta.Media.FileName), new XElement("Format", meta.Media.Format), new XElement("Quality", meta.Media.Quality) )); Debug.WriteLine(xml); try { xml.Save(path); } catch (Exception) { // } }
private void ShowWizard() { wizard = new frmWizard(deviceName, videoFormat); if (wizard.ShowDialog() == DialogResult.OK) { UNIcastMeta meta = wizard.Meta; this.lblLecturer.Text = meta.Lecturer; this.lblSubject.Text = meta.Subject; this.ratings.SelectedItem = meta.Media.Quality; this.bitrate = meta.Media.Quality * 1000; this.lblDate.Text = String.Format("{0} {1}", meta.DateTime.ToShortDateString(), meta.DateTime.ToShortTimeString()); this.shouldRecord = wizard.ShouldRecord; string dateTimeString = meta.DateTime.ToString("yyyyMMddHHmmss", CultureInfo.InvariantCulture); if (shouldRecord) { this.filePath = Path.Combine(wizard.OutputFolder, String.Concat(dateTimeString, ".ts")); Utils.WriteMetaXml(meta, Path.Combine(wizard.OutputFolder, String.Concat(dateTimeString, ".xml"))); } Start(); } else { Application.Exit(); } }