Atomia.Web.Plugin.PublicOrder.Helpers.GeneralHelper.GetUnavailableDomainsHelper C# (CSharp) Метод

GetUnavailableDomainsHelper() публичный статический Метод

Gets the unavailable domains.
public static GetUnavailableDomainsHelper ( Controller controller, string domains ) : string
controller Controller The controller.
domains string The domains.
Результат string
        public static string GetUnavailableDomainsHelper(Controller controller, string[] domains)
        {
            string result = string.Empty;
            try
            {
                var service = GetPublicOrderService(controller.HttpContext.ApplicationInstance.Context);
                AttributeData[] checkedDomains = service.CheckDomains(domains);

                List<string> tldBasedRegexesStrings = DomainSearch.Helpers.DomainSearchHelper.GetTLDBasedRegexes(ResellerHelper.GetResellerId());

                for (int i = 0; i < checkedDomains.Length; i++)
                {
                    if (checkedDomains[i].Value.ToLower() == "taken")
                    {
                        result += checkedDomains[i].Name + "|TAKEN ";
                    }
                    else
                    {
                        bool passed = false;
                        // if there are no tld-special regexes disregard and continue
                        if (tldBasedRegexesStrings.Count > 0)
                        {
                            List<Regex> tldBasedRegexes = new List<Regex>();
                            for (int j = 0; j < tldBasedRegexesStrings.Count; j++)
                            {
                                tldBasedRegexes.Add(new Regex(tldBasedRegexesStrings[j]));
                            }

                            string tmpStr = SimpleDnsPlus.IDNLib.Decode(checkedDomains[i].Name.Trim());
                            for (var g = 0; g < tldBasedRegexes.Count; g++)
                            {
                                if (tldBasedRegexes[g].IsMatch(tmpStr))
                                {
                                    passed = true;
                                }
                            }

                            if (!passed)
                            {
                                result += checkedDomains[i].Name + "|SPECIAL ";
                            }
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                OrderPageLogger.LogOrderPageException(ex);
                throw;
            }

            return result.TrimEnd(' ');
        }