public override Guild GetGuild(Server server, string guildName, bool isDetailed)
        {
            OnStarted();
            Guild guild = new Guild()
            {
                Server     = server,
                IsDetailed = isDetailed
            };
            HtmlDocument doc = new HtmlDocument();

            OnStatusChanged(DMODownloadStatusCode.GETTING_GUILD, guildName, 0, 50);
            try {
                string html = DownloadContent(string.Format(STR_URL_GUILD_RANK, guildName, server.Identifier));
                doc.LoadHtml(html);

                bool     isFound = false;
                HtmlNode ranking = doc.DocumentNode;

                string guildMaster = null;

                try {
                    ranking     = doc.DocumentNode.SelectNodes("//div[@id='body']//table[@class='forum_list'][1]//tbody//tr[not(@onmouseover)]")[4];
                    guild.Rank  = CheckRankNode(ranking.SelectSingleNode(".//td[1]"));
                    guild.Name  = ClearStr(ranking.SelectSingleNode(".//td[2]").InnerText);
                    guild.Rep   = Convert.ToInt32(ClearStr(ranking.SelectSingleNode(".//td[4]").InnerText));
                    guildMaster = ClearStr(ranking.SelectSingleNode(".//td[5]").InnerText);

                    Regex  r1   = new Regex(STR_GUILD_ID_REGEX, RegexOptions.IgnoreCase | RegexOptions.Singleline);
                    string link = ranking.SelectSingleNode(".//td[7]").InnerHtml;
                    Match  m1   = r1.Match(link);
                    if (m1.Success)
                    {
                        guild.Identifier = Convert.ToInt32(m1.Groups[4].ToString());
                        isFound          = true;
                    }
                } catch {
                    isFound = false;
                }

                if (!isFound)
                {
                    OnCompleted(DMODownloadResultCode.NOT_FOUND, guild); // guild not found
                    return(guild);
                }

                List <DigimonType> types = GetDigimonTypes();
                using (IDatabaseContext context = DatabaseManager.CreateContext()) {
                    foreach (DigimonType type in types)
                    {
                        context.AddOrUpdateDigimonType(type, true);
                    }
                    context.SaveChanges();
                }

                if (GetGuildInfo(ref guild, isDetailed))
                {
                    guild.Tamers.First(t => t.Name == guildMaster).IsMaster = true;
                    guild.UpdateTime = DateTime.Now;
                    OnCompleted(DMODownloadResultCode.OK, guild);
                    return(guild);
                }
                else
                {
                    OnCompleted(DMODownloadResultCode.CANT_GET, guild); // can't get guild info
                    return(guild);
                }
            } catch (WebException) {
                OnCompleted(DMODownloadResultCode.WEB_ACCESS_ERROR, guild);
                return(guild);
            }
        }
        public override Guild GetGuild(Server server, string guildName, bool isDetailed)
        {
            OnStarted();
            Guild guild = new Guild()
            {
                Server     = server,
                IsDetailed = isDetailed
            };

            OnStatusChanged(DMODownloadStatusCode.GETTING_GUILD, guildName, 0, 50);
            try {
                HtmlNode           ranking = tryLoadNode(string.Format(STR_URL_GUILD_RANK, guildName, "srv" + server.Identifier), STR_RANKING_NODE);
                HtmlNodeCollection tlist   = ranking.SelectNodes("//tr/td[@class='guild']");
                bool isFound = false;
                if (tlist != null)
                {
                    List <DigimonType> types = GetDigimonTypes();
                    using (IDatabaseContext context = DatabaseManager.CreateContext()) {
                        foreach (DigimonType type in types)
                        {
                            context.AddOrUpdateDigimonType(type, false);
                        }
                        context.SaveChanges();
                    }

                    HtmlNode e           = null;
                    string   guildMaster = null;
                    for (int i = 0; i < tlist.Count - 1; i++)
                    {
                        try {
                            e = ranking.SelectNodes("//td[@class='guild']")[i];
                        } catch {
                        };
                        if (e != null)
                        {
                            if (ClearStr(e.InnerText) == guildName)
                            {
                                Regex r = new Regex(STR_GUILD_ID_REGEX, RegexOptions.IgnoreCase | RegexOptions.Singleline);
                                Match m = r.Match(ranking.SelectNodes("//td[@class='detail']")[i].InnerHtml);
                                if (m.Success)
                                {
                                    guild.Identifier = Convert.ToInt32(m.Groups[2].ToString());
                                    guildMaster      = ranking.SelectNodes("//td[@class='master']")[i].InnerText;
                                    guildMaster      = guildMaster.Substring(0, guildMaster.IndexOf(' '));
                                    guild.Name       = guildName;
                                    guild.Rank       = Convert.ToInt32(ClearStr(ranking.SelectNodes("//td[@class='ranking']")[i].InnerText));
                                    guild.Rep        = Convert.ToInt32(ClearStr(ranking.SelectNodes("//td[@class='reputation']")[i].InnerText));
                                    isFound          = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (!isFound)
                    {
                        OnCompleted(DMODownloadResultCode.NOT_FOUND, guild); // guild not found
                        return(guild);
                    }

                    if (GetGuildInfo(ref guild, isDetailed))
                    {
                        guild.Tamers.First(t => t.Name == guildMaster).IsMaster = true;
                        guild.UpdateTime = DateTime.Now;
                        OnCompleted(DMODownloadResultCode.OK, guild);
                        return(guild);
                    }
                    else
                    {
                        OnCompleted(DMODownloadResultCode.CANT_GET, guild); // can't get guild info
                        return(guild);
                    }
                }
                else
                {
                    OnCompleted(DMODownloadResultCode.NOT_FOUND, guild);//wrong web page
                    return(guild);
                }
            } catch (Exception e) {
                if (LogManager != null)
                {
                    LogManager.Error("An error occured while guild info receiving", e);
                }
                OnCompleted(DMODownloadResultCode.WEB_ACCESS_ERROR, guild);
                return(guild);
            }
        }