mirror of
https://github.com/9ParsonsB/Pulsar.git
synced 2025-07-01 16:33:43 -04:00
observatory herald (#30)
* WIP: initial commit for observatory herald * Plugin error handling refactor * make error window non-modal * tidy up plugin error handling * first pass for basic herald functionality * corrections for linux env * Use FNV hash directly instead of managing through dictionary/index file * resolve audio queuing issue, switch to personal NetCoreAudio fork * merge cleanup * add enable setting, populate defaults * framework xml doc update * Adjust settings, add style selection, replace locale with demonym in dropdown list. * Test is position is on screen before saving/loading. * use a default that's actually in the list
This commit is contained in:
@ -85,36 +85,12 @@ namespace Observatory.NativeNotification
|
||||
XmlNamespaceManager ssmlNs = new(ssmlDoc.NameTable);
|
||||
ssmlNs.AddNamespace("ssml", ssmlNamespace);
|
||||
|
||||
//If the SSML already has a voice element leave it alone.
|
||||
if (ssmlDoc.SelectSingleNode("/ssml:speak/ssml:voice", ssmlNs) == null)
|
||||
{
|
||||
//Preserve existing content to place it in new voice element
|
||||
string speakContent = ssmlDoc.DocumentElement.InnerXml;
|
||||
speakContent = speakContent.Replace($"xmlns=\"{ssmlNs.LookupNamespace("ssml")}\"", string.Empty);
|
||||
|
||||
//Crete new voice element and name attribute objects
|
||||
var voiceElement = ssmlDoc.CreateElement("voice", ssmlNs.LookupNamespace("ssml"));
|
||||
var voiceAttribute = ssmlDoc.CreateAttribute("name");
|
||||
var voiceNode = ssmlDoc.SelectSingleNode("/ssml:speak/ssml:voice", ssmlNs);
|
||||
|
||||
//Update content of new element
|
||||
voiceAttribute.Value = voiceName;
|
||||
voiceElement.Attributes.Append(voiceAttribute);
|
||||
voiceElement.InnerXml = speakContent;
|
||||
|
||||
//Clear existing content and insert new element
|
||||
ssmlDoc.DocumentElement.InnerText = string.Empty;
|
||||
ssmlDoc.DocumentElement.AppendChild(voiceElement);
|
||||
voiceNode.Attributes.GetNamedItem("name").Value = voiceName;
|
||||
|
||||
ssml = ssmlDoc.OuterXml;
|
||||
}
|
||||
|
||||
//If I leave the namespace in speakContent above it's left behind as a redundant
|
||||
//attribute which breaks the speech generation.
|
||||
//If I remove it then the XmlDoc explicitly adds an empty namespace which *also*
|
||||
//breaks speech generation.
|
||||
//The empty one is easier to remove later, so that's what I'm doing, but if someone
|
||||
//has a better suggestion I'm all for it.
|
||||
return ssml.Replace("xmlns=\"\"", string.Empty);
|
||||
return ssmlDoc.OuterXml;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user