public List <string> GetHrefsByTagAndAttributeName(string pageSrcHtml, string TagName, string className)
        {
            List <string> lstData = new List <string>();

            try
            {
                bool   success = false;
                string xHtml   = string.Empty;

                Chilkat.HtmlToXml htmlToXml = new Chilkat.HtmlToXml();

                //*** Check DLL working or not **********************
                success = htmlToXml.UnlockComponent("THEBACHtmlToXml_7WY3A57sZH3O");
                if ((success != true))
                {
                    Console.WriteLine(htmlToXml.LastErrorText);
                    return(null);
                }

                htmlToXml.Html = pageSrcHtml;

                //** Convert Data Html to XML *******************************************
                xHtml = htmlToXml.ToXml();

                //******************************************
                Chilkat.Xml xNode             = default(Chilkat.Xml);
                Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml);
                Chilkat.Xml xml = new Chilkat.Xml();
                xml.LoadXml(xHtml);

                #region Data Save in list From using XML Tag and Attribut
                string DescriptionMain = string.Empty;
                string dataDescription = string.Empty;

                xBeginSearchAfter = null;

                xNode = xml.SearchForAttribute(xBeginSearchAfter, TagName, "class", className);
                while ((xNode != null))
                {
                    //** Get Data Under Tag only Text Value**********************************
                    dataDescription = xNode.GetXml();//.AccumulateTagContent("text", "script|style");

                    List <string> lstHrefs = GetHrefFromString(dataDescription);

                    lstData.AddRange(lstHrefs);//lstData.Add(dataDescription);

                    //** Get Data Under Tag All  Html value * *********************************
                    //dataDescription = xNode.GetXml();

                    xBeginSearchAfter = xNode;
                    xNode             = xml.SearchForAttribute(xBeginSearchAfter, TagName, "class", className);
                }
                #endregion
                return(lstData);
            }
            catch (Exception)
            {
                return(lstData = null);
            }
        }
        // Returns a new XML object that is a copy of the XML for this entry.
        // The CkXml pointer returned is the root of it's own tree.
        protected Chilkat.Xml cloneEntryXml()
        {
            if (m_xml == null)
            {
                return(null);
            }

            Chilkat.Xml x = new Chilkat.Xml();
            x.LoadXml(m_xml.GetXml());
            return(x);
        }
        // Called for copying <links2> from commonLinks.xml to a method or property.
        public void CopyLinks(Chilkat.Xml xLinks)
        {
            if (m_xml == null)
            {
                return;
            }

            m_xml.RemoveChild("links2");

            Chilkat.Xml xCopy = new Chilkat.Xml();
            xCopy.LoadXml(xLinks.GetXml());

            m_xml.AddChildTree(xCopy);
            return;
        }
        public List <string> GetDataTagDirectTagData(string pageSrcHtml, string TagName)
        {
            bool          success = false;
            string        xHtml   = string.Empty;
            List <string> list    = new List <string>();



            Chilkat.HtmlToXml htmlToXml = new Chilkat.HtmlToXml();
            success = htmlToXml.UnlockComponent("THEBACHtmlToXml_7WY3A57sZH3O");
            if ((success != true))
            {
                Console.WriteLine(htmlToXml.LastErrorText);
                return(null);
            }

            htmlToXml.Html = pageSrcHtml;

            //xHtml contain xml data
            xHtml = htmlToXml.ToXml();

            //******************************************
            Chilkat.Xml xNode             = default(Chilkat.Xml);
            Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml);
            Chilkat.Xml xml = new Chilkat.Xml();
            xml.LoadXml(xHtml);

            xBeginSearchAfter = null;
            xNode             = xml.SearchForTag(xBeginSearchAfter, TagName);
            while ((xNode != null))
            {
                string TagText = xNode.GetXml();

                list.Add(TagText);

                xBeginSearchAfter = xNode;
                xNode             = xml.SearchForTag(xBeginSearchAfter, TagName);
            }
            //xHtml.
            return(list);
        }
        public string GetDataWithTagValueByTagAndAttributeNameWithId(string pageSrcHtml, string TagName, string AttributeName)
        {
            string dataDescription = string.Empty;

            try
            {
                bool   success = false;
                string xHtml   = string.Empty;

                Chilkat.HtmlToXml htmlToXml = new Chilkat.HtmlToXml();

                //*** Check DLL working or not **********************
                success = htmlToXml.UnlockComponent("THEBACHtmlToXml_7WY3A57sZH3O");
                if ((success != true))
                {
                    Console.WriteLine(htmlToXml.LastErrorText);
                    return(null);
                }

                htmlToXml.Html = pageSrcHtml;

                //** Convert Data Html to XML *******************************************
                xHtml = htmlToXml.ToXml();

                //******************************************
                Chilkat.Xml xNode             = default(Chilkat.Xml);
                Chilkat.Xml xBeginSearchAfter = default(Chilkat.Xml);
                Chilkat.Xml xml = new Chilkat.Xml();
                xml.LoadXml(xHtml);

                #region Data Save in list From using XML Tag and Attribut
                string DescriptionMain = string.Empty;

                string dataDescriptionValue = string.Empty;


                xBeginSearchAfter = null;

                xNode = xml.SearchForAttribute(xBeginSearchAfter, TagName, "id", AttributeName);
                while ((xNode != null))
                {
                    //** Get Data Under Tag only Text Value**********************************



                    dataDescription = xNode.GetXml();//.AccumulateTagContent("text", "script|style");

                    dataDescriptionValue = dataDescriptionValue + dataDescription;
                    //    string text = xNode.AccumulateTagContent("text", "script|style");
                    //    lstData.Add(text);

                    //    //** Get Data Under Tag All  Html value * *********************************
                    //    //dataDescription = xNode.GetXml();

                    xBeginSearchAfter = xNode;
                    xNode             = xml.SearchForAttribute(xBeginSearchAfter, TagName, "id", AttributeName);
                    //if (dataDescription.Length > 500)
                    //{
                    //    break;
                    //}
                }
                #endregion
                return(dataDescriptionValue);
            }
            catch (Exception)
            {
                return(dataDescription = null);
            }
        }
        /// <summary>
        /// converte file tsr in formato tsd (RFC 5544)
        /// </summary>
        /// <param name="pathFileTsr">file tsr</param>
        /// <param name="pathFileSign">file firmato</param>
        /// <param name="pathFileTsd">file tsd creato</param>
        /// <param name="lastError">ultimo errore della funzionalità</param>
        /// <returns>true se la funzionalità ha avuto successo</returns>
        public static bool CreaTsd(string pathFileTsr, string pathFileSign, out string pathFileTsd, ref string lastError)
        {
            bool success = false;

            pathFileTsd = null;
            try
            {
                if (Utilities.glob.UnlockStatus == 0)
                {
                    lastError = "Licenza bloccata";
                    return(success);
                }


                Chilkat.BinData bdTsr = new Chilkat.BinData();
                success = bdTsr.LoadFile(pathFileTsr);
                if (!success)
                {
                    lastError = "Errore nel caricare il file tsr!";
                    return(success);
                }

                // Carico il tsr in un oggetto ASN.1
                Chilkat.Asn asnTsr = new Chilkat.Asn();
                success = asnTsr.LoadEncoded(bdTsr.GetEncoded("base64"), "base64");
                if (!success)
                {
                    lastError = asnTsr.LastErrorText;
                    return(success);
                }

                // Prendo il timestamp nell'xml
                Chilkat.Xml xmlTsr = new Chilkat.Xml();
                xmlTsr.LoadXml(asnTsr.AsnToXml());

                // Il timestamp inizia in questo modo
                // Rimuovo la prima sub-tree

                //     <?xml version="1.0" encoding="utf-8"?>
                //     <sequence>
                //         <sequence>       <---- Remove this sub-tree.
                //             <int>00</int>
                //             <sequence>
                //                 <utf8>Operation Okay</utf8>
                //             </sequence>
                //         </sequence>
                //         <sequence>
                //             <oid>1.2.840.113549.1.7.2</oid>
                //             <contextSpecific tag="0" constructed="1">
                //             ...

                // Rimuovo la prima sub-tree..
                xmlTsr.RemoveChildByIndex(0);

                // Combiniamo il timestamp e il .p7m in un timestampData
                Chilkat.BinData bdContent = new Chilkat.BinData();
                success = bdContent.LoadFile(pathFileSign);
                if (!success)
                {
                    lastError = "Errore nel caricare il file p7m!";
                    return(success);
                }

                // Costruisco il TimeStampData.
                // Lo costruisco in XML e poi lo converto in ASN.1
                Chilkat.Xml xml = new Chilkat.Xml();
                xml.Tag = "sequence";
                xml.UpdateChildContent("oid", "1.2.840.113549.1.9.16.1.31");
                xml.UpdateAttrAt("contextSpecific", true, "tag", "0");
                xml.UpdateAttrAt("contextSpecific", true, "constructed", "1");
                xml.UpdateChildContent("contextSpecific|sequence|int", "01");
                xml.UpdateChildContent("contextSpecific|sequence|octets", bdContent.GetEncoded("base64"));
                xml.UpdateAttrAt("contextSpecific|sequence|contextSpecific", true, "tag", "0");
                xml.UpdateAttrAt("contextSpecific|sequence|contextSpecific", true, "constructed", "1");

                Chilkat.Xml xContext = xml.GetChildWithTag("contextSpecific|sequence|contextSpecific");
                xContext.AddChildTree(xmlTsr);

                // Converto il file XML in ASN.1
                Chilkat.Asn tsd = new Chilkat.Asn();
                tsd.LoadAsnXml(xml.GetXml());

                // scrivo il timestamped
                success = tsd.WriteBinaryDer(pathFileTsd);
            }
            catch
            {
                throw;
            }

            return(success);
        }