public override object Clone()
        {
            AlphabeticIDIndexSettings cln = new AlphabeticIDIndexSettings();

            if (this.TopIndex != null)
            {
                cln.TopIndex = this.TopIndex;
            }
            return(cln);
        }
        protected override AlphabeticIDIndexResult ConvertResult(YahooManaged.Base.ConnectionInfo connInfo, System.IO.Stream stream, YahooManaged.Base.SettingsBase settings)
        {
            AlphabeticIDIndexSettings s = (AlphabeticIDIndexSettings)settings;

            System.Globalization.CultureInfo convCulture = new System.Globalization.CultureInfo("en-US");
            XDocument doc = MyHelper.ParseXmlDocument(stream);

            XElement[] resultsNodes = null;

            switch (s.Type)
            {
            case AlphabeticalIndexDownloadType.TopIndex:
                resultsNodes = XPath.GetElements("//results", doc);
                List <AlphabeticalTopIndex> lstTopIndex = new List <AlphabeticalTopIndex>();

                if (resultsNodes.Length > 0)
                {
                    XElement resultNode = resultsNodes[0];

                    foreach (XElement tdNode in resultNode.Elements())
                    {
                        foreach (XElement aNode in tdNode.Elements())
                        {
                            if (aNode.Name.LocalName == "a")
                            {
                                string att = MyHelper.GetXmlAttributeValue(aNode, "href");
                                if (att != string.Empty)
                                {
                                    lstTopIndex.Add(new AlphabeticalTopIndex(aNode.Value, "http://biz.yahoo.com" + att));
                                }
                            }
                        }
                    }
                }

                return(new AlphabeticIDIndexResult(lstTopIndex.ToArray()));



            case AlphabeticalIndexDownloadType.Index:
                resultsNodes = XPath.GetElements("//results", doc);
                List <AlphabeticalIndex> lstIndex = new List <AlphabeticalIndex>();

                if (resultsNodes.Length > 0)
                {
                    XElement resultNode = resultsNodes[0];

                    foreach (XElement tdNode in resultNode.Elements())
                    {
                        foreach (XElement tableNode in tdNode.Elements())
                        {
                            if (tableNode.Name.LocalName == "table")
                            {
                                XElement[] chdLst = MyHelper.EnumToArray(MyHelper.EnumToArray(tableNode.Elements())[0].Elements());
                                if (chdLst.Length >= 3)
                                {
                                    lstIndex.Add(new AlphabeticalIndex(chdLst[1].Value, s.TopIndex.URL));
                                    if (chdLst.Length > 3)
                                    {
                                        for (int i = 3; i <= chdLst.Length - 1; i++)
                                        {
                                            XElement   tdTbNode = chdLst[i];
                                            XElement[] enm      = MyHelper.EnumToArray(tdTbNode.Elements());
                                            if (enm.Length > 0 && enm[0].Name.LocalName == "a")
                                            {
                                                string name = enm[0].Value.Replace("\n", "").Replace(" ", "").Trim();
                                                string url  = string.Empty;
                                                string att  = MyHelper.GetXmlAttributeValue(enm[0], "href");
                                                if (att != string.Empty)
                                                {
                                                    url = "http://biz.yahoo.com" + att.Trim();
                                                }
                                                if (url != string.Empty & name != string.Empty)
                                                {
                                                    lstIndex.Add(new AlphabeticalIndex(name, url));
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                s.TopIndex.SetIndices(lstIndex.ToArray());
                return(new AlphabeticIDIndexResult(s.TopIndex.SubIndices));

            default:
                return(null);
            }
        }
 public void DownloadAsync(AlphabeticIDIndexSettings settings, object userArgs)
 {
     base.DownloadAsync(settings, userArgs);
 }
 public AlphabeticIDIndexDownload()
 {
     this.Settings = new AlphabeticIDIndexSettings();
 }