Esempio n. 1
0
        private MarketShareEngine()
        {
            try
            {
                string      xmlFolder          = Utility.ComponentBaseFolder + "\\Xml";
                XmlDocument _marketAnalysisXML = new XmlDocument();
                _marketAnalysisXML.Load(Path.Combine(xmlFolder, "MarketAnalysis.xml"));
                _maxPageByteSize = XMLUtility.GetNodeFromXml(_marketAnalysisXML, "MarketAnalysis/PageByteLimit").InnerText.ConvertStringToInt(1048576);

                _sitebuilderRulesXML.Load(Path.Combine(xmlFolder, "SiteBuilderRules.xml"));
                _shoppingcartRulesXML.Load(Path.Combine(xmlFolder, "ShoppingCartRules.xml"));

                XmlDocument ruleTypes = new XmlDocument();
                ruleTypes.Load(Path.Combine(xmlFolder, "RuleTypes.xml"));

                Assembly assembly = Assembly.GetExecutingAssembly();
                foreach (XmlNode ruleNode in ruleTypes.SelectNodes("//Rule"))
                {
                    Type type = assembly.GetType(String.Format("{0}.{1}", typeof(MarketShareEngine).Namespace, ruleNode.InnerText));
                    if (!Object.Equals(null, type))
                    {
                        IProcessor proc = Activator.CreateInstance(type) as IProcessor;
                        if (!Object.Equals(null, proc))
                        {
                            _processors.Add(ruleNode.InnerText.ToLower(), proc);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                ExceptionExtensions.LogError(e, "API.MarketAnalysis.MarketShareEngine Constructor");
            }
        }
Esempio n. 2
0
        private Collection <string> GetAllSquatterVideoIds()
        {
            Collection <string> ids = new Collection <string>();

            foreach (XmlNode node in XMLUtility.GetNodeFromXml(Xml, "accounts/account/squatters").ChildNodes)
            {
                ids.Add(node.InnerText);
            }

            return(ids);
        }
Esempio n. 3
0
        public string GetRegistrar(string domainName)
        {
            string results        = string.Empty;
            string _regServiceURL = _regServiceURLs[++i % _regServiceURLs.Count];
            string registrar      = "N/A";

            try
            {
                results = Request.ExecuteWebRequest(string.Format(_regServiceURL, domainName), 10000);

                if (results.Contains("failed") || results.Contains("unavailable"))
                {
                    _regServiceURL = _regServiceURLs[++i % _regServiceURLs.Count];
                    results        = Request.ExecuteWebRequest(string.Format(_regServiceURL, domainName), 5000);
                }

                if (!string.IsNullOrEmpty(results))
                {
                    results = results.Replace("<pre>", string.Empty).Replace("</pre>", string.Empty).Replace("<br>", string.Empty);
                }

                if (!string.IsNullOrEmpty(results) && !results.Contains("failed"))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(results);
                    //if (_regServiceURL.Contains("whois.godaddy.com"))
                    //{
                    //    results = XMLUtility.GetNodeFromXml(doc, "WHOIS/RESPONSE/DOMAIN/REGISTRAR").InnerText;
                    //}
                    //else
                    //{
                    results = XMLUtility.GetNodeFromXml(doc, "WHOIS/WHOISINFOSTRUCT/REGISTRAR").InnerText;
                    //}

                    if (!string.IsNullOrEmpty(results))
                    {
                        registrar = results;
                    }
                }
            }
            catch (Exception)
            {
                Utility.WriteToLogFile(String.Format("Dig_WhoIsFailure_{0:M_d_yyyy}", DateTime.Today) + ".log", "Domain: " + domainName);
            }

            return(registrar);
        }