/// <summary> /// Locate the key name (if found) /// </summary> private void FindKeyName() { MXFShortKey skey = this.GetShortKey(); if (knownKeys.ContainsKey(skey)) { this.Name = knownKeys[skey].Name; IsKnown = true; } else { IsKnown = false; } }
/// <summary> /// Locate the key name (if found) /// </summary> private void FindKeyName() { MXFShortKey skey = this.ShortKey; if (m_ULDescriptions.ContainsKey(skey)) { this.Name = m_ULDescriptions[skey][0]; this.m_fIsUID = false; } else { this.Name = "UID"; // Not in the global UL list, probably an unique ID this.m_fIsUID = true; } }
static MXFKey() { m_ULDescriptions = new Dictionary <MXFShortKey, string[]>(); //Parse SMPTE Labels register XElement regEntries; XNamespace ns = "http://www.smpte-ra.org/schemas/400/2012"; regEntries = XElement.Parse(MXF.Properties.Resources.Labels); foreach (var el in regEntries.Element(ns + "Entries").Elements(ns + "Entry")) { UInt64 value1 = 0; UInt64 value2 = 0; string UL_string = ""; string name_string = ""; string definition_string = ""; string defining_document_string = ""; var x = el.Element(ns + "UL"); if (x != null) { UL_string = x.Value.Replace("urn:smpte:ul:", "").Replace(".", ""); } else { continue; // No UL --> ignore this entry } //Debug.WriteLine(UL_string); value1 = Convert.ToUInt64(UL_string.Substring(0, 16), 16); value2 = Convert.ToUInt64(UL_string.Substring(16, 16), 16); MXFShortKey shortKey = new MXFShortKey(value1, value2); x = el.Element(ns + "Name"); if (x != null) { name_string = x.Value; } x = el.Element(ns + "Definition"); if (x != null) { definition_string = x.Value; } x = el.Element(ns + "DefiningDocument"); if (x != null) { defining_document_string = x.Value; } //Debug.WriteLine(shortKey.ToString() + name_string + definition_string + defining_document_string); m_ULDescriptions.Add(shortKey, new string[] { name_string, definition_string, defining_document_string }); } // Parse SMPTE Elements register ns = "http://www.smpte-ra.org/schemas/335/2012"; regEntries = XElement.Parse(MXF.Properties.Resources.Elements); foreach (var el in regEntries.Element(ns + "Entries").Elements(ns + "Entry")) { UInt64 value1 = 0; UInt64 value2 = 0; string UL_string = ""; string name_string = ""; string definition_string = ""; string defining_document_string = ""; var x = el.Element(ns + "UL"); if (x != null) { UL_string = x.Value.Replace("urn:smpte:ul:", "").Replace(".", ""); } else { continue; // No UL --> ignore this entry } //Debug.WriteLine(UL_string); value1 = Convert.ToUInt64(UL_string.Substring(0, 16), 16); value2 = Convert.ToUInt64(UL_string.Substring(16, 16), 16); MXFShortKey shortKey = new MXFShortKey(value1, value2); x = el.Element(ns + "Name"); if (x != null) { name_string = x.Value; } x = el.Element(ns + "Definition"); if (x != null) { definition_string = x.Value; } x = el.Element(ns + "DefiningDocument"); if (x != null) { defining_document_string = x.Value; } //Debug.WriteLine(shortKey.ToString() + name_string + definition_string + defining_document_string); m_ULDescriptions.Add(shortKey, new string[] { name_string, definition_string, defining_document_string }); } //Parse SMPTE Groups register ns = "http://www.smpte-ra.org/ns/395/2016"; regEntries = XElement.Parse(MXF.Properties.Resources.Groups); foreach (var el in regEntries.Element(ns + "Entries").Elements(ns + "Entry")) { UInt64 value1 = 0; UInt64 value2 = 0; string UL_string = ""; string name_string = ""; string definition_string = ""; string notes_string = ""; var x = el.Element(ns + "UL"); if (x != null) { UL_string = x.Value.Replace("urn:smpte:ul:", "").Replace(".", ""); } else { continue; // No UL --> ignore this entry } //Debug.WriteLine(UL_string); value1 = Convert.ToUInt64(UL_string.Substring(0, 16), 16); value2 = Convert.ToUInt64(UL_string.Substring(16, 16), 16); MXFShortKey shortKey = new MXFShortKey(value1, value2); x = el.Element(ns + "Name"); if (x != null) { name_string = x.Value; } x = el.Element(ns + "Definition"); if (x != null) { definition_string = x.Value; } x = el.Element(ns + "Notes"); if (x != null) { notes_string = x.Value; } //Debug.WriteLine(shortKey.ToString() + name_string + definition_string + defining_document_string); m_ULDescriptions.Add(shortKey, new string[] { name_string + " - " + definition_string, "", notes_string }); } }