Пример #1
0
        /// <summary>
        /// Get the reader help section about the document being examined.
        /// </summary>
        private void RetrieveReaderHelp() {
            List<string> helpTitleNameList = null;
            List<string> helpTextNameList = null;

            var helpTitles = page.DocumentNode.SelectNodes("//span[@class='AyudaLector_Titulo']");
            if (helpTitles != null) {
                helpTitleNameList = new List<string>();
                foreach (var ht in helpTitles) {
                    helpTitleNameList.Add(ht.InnerHtml);
                }
            }

            var helpTexts = page.DocumentNode.SelectNodes("//span[@class='AyudaLector_Texto']");
            if (helpTexts != null) {
                helpTextNameList = new List<string>();
                foreach (var htxt in helpTexts) {
                    helpTextNameList.Add(htxt.InnerHtml);
                }
            }

            // It is required that both helpTitleNameList and helpTextNameList
            // both contain the same number of elements
            if (helpTitleNameList != null && helpTextNameList != null) {
                if (helpTitleNameList.Count == helpTextNameList.Count) {
                    useTemplateTypeInstead = TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_001;
                    for (int i = 0; i < helpTitleNameList.Count; i++) {
                        ReaderHelp rh = new ReaderHelp();

                        rh.NameTitle = MetadataName.OldDocReaderHelpTitleName;
                        rh.NameTitleContent = helpTitleNameList[i];
                        rh.NameText = MetadataName.OldDocReaderHelpTextName;
                        rh.NameTextContent = helpTextNameList[i];
                        examinedDoc.ReaderHelp.Add(rh);
                    }
                }
            }
        }
Пример #2
0
 /// <summary>
 /// If parameters match then try to get ReaderHelp contents if found.
 /// </summary>
 /// <param name="status">Document Status</param>
 /// <param name="templateType">Template used</param>
 private void CheckReaderHelpFor(int status, int templateType) {
     if (status == MigrateStatusCode.OLD_DOC_STATUS_CODE_SUCCESS && templateType == TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_004) {
         if (examinedDoc.ReaderHelp.Count == 0) {
             var text = page.DocumentNode.SelectSingleNode("//*[@id='lEditor3']");
             var textTitle = page.DocumentNode.SelectSingleNode("//*[@class='Titulo_Contexto']");
             if (text != null) {
                 var textInfo = text.InnerHtml;
                 string textTitleInfo = "";
                 if (textTitle != null) {
                     textTitleInfo = textTitle.InnerHtml;
                 }
                 ReaderHelp rh = new ReaderHelp();
                 rh.NameTitle = MetadataName.OldDocReaderHelpTitleName;
                 rh.NameTitleContent = textTitleInfo;
                 rh.NameText = MetadataName.OldDocReaderHelpTextName;
                 rh.NameTextContent = textInfo;
                 examinedDoc.ReaderHelp.Add(rh);
             }
         }
     }
 }