Beispiel #1
0
 private void buttonGenOptions_Click(object sender, EventArgs e)
 {
     formOptions.IndexerGenerationOptions = optionsVar;
     if (formOptions.ShowDialog() == DialogResult.OK)
     {
         optionsVar = formOptions.IndexerGenerationOptions;
     }
 }
Beispiel #2
0
        public static string LoadAndUpdateIndexerConfiguration(string xmlFileName, string AssetTitle, string AssetDescription, string Language, IndexerOptionsVar optionsVar, string proposedfile = null)
        {
            // Prepare the encryption task template
            XDocument doc = XDocument.Load(xmlFileName);

            var inputxml = doc.Element("configuration").Element("input");

            if (proposedfile != null)
            {
                inputxml.Add(new XAttribute("name", proposedfile));
            }
            if (!string.IsNullOrEmpty(AssetTitle))
            {
                inputxml.Add(new XElement("metadata", new XAttribute("key", "title"), new XAttribute("value", AssetTitle)));
            }
            if (!string.IsNullOrEmpty(AssetDescription))
            {
                inputxml.Add(new XElement("metadata", new XAttribute("key", "description"), new XAttribute("value", AssetDescription)));
            }

            var settings = doc.Element("configuration").Element("features").Element("feature").Element("settings");

            settings.Add(new XElement("add", new XAttribute("key", "Language"), new XAttribute("value", Language)));
            settings.Add(new XElement("add", new XAttribute("key", "GenerateAIB"), new XAttribute("value", optionsVar.AIB.ToString())));
            settings.Add(new XElement("add", new XAttribute("key", "GenerateKeywords"), new XAttribute("value", optionsVar.Keywords.ToString())));
            settings.Add(new XElement("add", new XAttribute("key", "ForceFullCaption"), new XAttribute("value", optionsVar.ForFullCaptions.ToString())));

            string cformats = optionsVar.TTML ? "ttml;" : string.Empty;

            cformats += optionsVar.SAMI ? "sami;" : string.Empty;
            cformats += optionsVar.WebVTT ? "webvtt" : string.Empty;
            settings.Add(new XElement("add", new XAttribute("key", "CaptionFormats"), new XAttribute("value", cformats)));

            return(doc.Declaration.ToString() + Environment.NewLine + doc.ToString());
        }