示例#1
0
        public void Berecne()
        {
            if (null == Htmlstr)
            {
                return;
            }

            HtmlstrSictHtmlNode = HtmlAgilityPack.HtmlNode.CreateNode(Htmlstr);

            if (null == HtmlstrSictHtmlNode)
            {
                return;
            }

            HtmlHtmlNode = HtmlstrSictHtmlNode.SelectSingleNode("/html");

            if (null == HtmlHtmlNode)
            {
                return;
            }

            var ListeNodeSpanSuuce = HtmlHtmlNode.SelectNodes("//span");

            /*
             * 2014.00.09	Beobactung:
             * In mance Variante kome kaine span vor.
             *
             * if(null	== ListeNodeSpanSuuce)
             * {
             *      return;
             * }
             * */

            var ListeNodeSpan = (null == ListeNodeSpanSuuce) ? null : ListeNodeSpanSuuce.ToArray();

            HtmlNodeMissionBriefingTitel =
                (null == ListeNodeSpan) ? null :
                ListeNodeSpan.FirstOrDefault((Kandidaat) => Regex.Match(Kandidaat.InnerText ?? "", "Mission briefing", RegexOptions.IgnoreCase).Success);

            if (null != HtmlNodeMissionBriefingTitel)
            {
                HtmlNodeMissionBriefingText = Optimat.Glob.SelectSingleNodeNaacNode(
                    HtmlHtmlNode,
                    "//div",
                    HtmlNodeMissionBriefingTitel);
            }

            if (VarianteAgentConvLeftPane)
            {
                //	Hiir mus noc geändert were, diise Annaame füürt dazu das der MissionBriefing Text anders ausfält als aus dem AgentBrowser Window
                HtmlNodeMissionBriefingText = HtmlHtmlNode.SelectSingleNode("//body");

                AgentConvPortraitImgHtmlNode = HtmlHtmlNode.SelectSingleNode("//img[starts-with(@src, 'portrait')]");

                if (null != AgentConvPortraitImgHtmlNode)
                {
                    AgentConvPortraitTdHtmlNode = AgentConvPortraitImgHtmlNode.ParentNode;
                }

                if (null != AgentConvPortraitTdHtmlNode)
                {
                    AgentConvLocationTdHtmlNode = Optimat.Glob.SelectSingleNodeNaacNode(AgentConvPortraitTdHtmlNode.ParentNode, "/td", AgentConvPortraitTdHtmlNode);
                }

                if (null != AgentConvLocationTdHtmlNode)
                {
                    AgentConvAgentNameHtmlNode = Optimat.Glob.SelectSingleNodeNaacNodeMitZuusazFilter(
                        AgentConvLocationTdHtmlNode,
                        "/font", null, (KandidaatNode) => (KandidaatNode.GetAttributeValue("color", "") ?? "").Length < 4);
                }

                if (null != AgentConvAgentNameHtmlNode)
                {
                    var AgentConvAgentShowInfoHtmlNode =
                        Optimat.Glob.SelectSingleNodeNaacNodeMitZuusazFilter(
                            AgentConvLocationTdHtmlNode, "/a", AgentConvAgentNameHtmlNode,
                            (KandidaatNode) => !Optimat.Glob.SelectNodesPerXPath(KandidaatNode, "/img").IsNullOrEmpty());

                    AgentConvLocationMengeHtmlNode =
                        Optimat.Glob.SelectNodesNaacNode(AgentConvLocationTdHtmlNode, "/*", AgentConvAgentShowInfoHtmlNode);
                }

                if (null != AgentConvLocationMengeHtmlNode)
                {
                    var AgentLocationAuswert = new SictAuswertGbsMissionLocationAusHtmlNodeUndSiblings(AgentConvLocationMengeHtmlNode);
                    AgentLocationAuswert.Berecne();

                    AgentLocation = AgentLocationAuswert.Ergeebnis;
                }
            }

            if (null != HtmlNodeMissionBriefingText)
            {
                MissionBriefingText = HtmlNodeMissionBriefingText.InnerText;
            }

            {
                /*
                 * 2013.09.01
                 * Ersaz Suuce HtmlNodeTitelObjective:
                 * Suuce sol sowool fer HtmlStr aus Agent Conversation als auc HtmlStr aus Read Details funktioniire:
                 *
                 * 2013.09.01 Bsp aus Agent Conversation:
                 * "<span id=subheader><font>The Missing Convoy Objectives</font></span><br>"
                 *
                 * 2013.09.01 Bsp aus Read Details:
                 * "<span id=Span2><font>The Missing Convoy Objectives</font></span><br>"
                 *
                 * HtmlNodeTitelObjective = HtmlstrSictHtmlNode.SelectSingleNode("//span[@id='subheader']");
                 *
                 * if (null != HtmlNodeTitelObjective)
                 * {
                 *      TitelObjectiveText = HtmlNodeTitelObjective.InnerText;
                 * }
                 *
                 * */

                if (null != ListeNodeSpan)
                {
                    foreach (var NodeSpan in ListeNodeSpan)
                    {
                        var NodeSpanInnerText = NodeSpan.InnerText;

                        if (null == NodeSpanInnerText)
                        {
                            continue;
                        }

                        var TitelObjectiveMatch = Regex.Match(NodeSpanInnerText, TitelObjectiveRegexPattern);

                        if (!TitelObjectiveMatch.Success)
                        {
                            continue;
                        }

                        HtmlNodeTitelObjective = NodeSpan;

                        TitelObjectiveText = NodeSpanInnerText;

                        MissionTitel = TitelObjectiveMatch.Groups[1].Value.Trim();

                        TitelObjectiveTextTailNaacObjective = TitelObjectiveText.Substring(TitelObjectiveMatch.Index + TitelObjectiveMatch.Length);

                        Complete = Regex.Match(TitelObjectiveTextTailNaacObjective, "complete", RegexOptions.IgnoreCase).Success;

                        break;
                    }
                }
            }

            if (null != TitelObjectiveText)
            {
                MengeObjectiveKandidaatCaptionHtmlNode =
                    Optimat.Glob.SelectNodesNaacNode(
                        HtmlHtmlNode,
                        "//span[@id='caption' and contains(text(), 'Objective')]",
                        HtmlNodeTitelObjective);

                if (null != MengeObjectiveKandidaatCaptionHtmlNode)
                {
                    MengeObjectiveAuswert =
                        MengeObjectiveKandidaatCaptionHtmlNode
                        .Select((Node) =>
                    {
                        var Auswert = new SictAuswertGbsAgentDialogueMissionObjectiveAusHtmlNodeCaption(Node);
                        Auswert.Berecne();
                        return(Auswert);
                    }).ToArray();
                }
            }

            if (null != HtmlNodeTitelObjective)
            {
                HtmlNodeTitelReward =
                    Optimat.Glob.SelectSingleNodeNaacNodeMitZuusazFilter(
                        HtmlHtmlNode,
                        "//span",
                        HtmlNodeTitelObjective,
                        (Node) => Regex.Match(Node.InnerText, "Rewards", RegexOptions.IgnoreCase).Success);

                if (null != HtmlNodeTitelReward)
                {
                    var RewardIskBetraagStringNodeUndMatch =
                        Optimat.Glob.SelectSingleNodeNaacNodeMitInnerTextRegexPattern(
                            HtmlHtmlNode,
                            "//td",
                            HtmlNodeTitelReward,
                            RewardIskRegexPattern,
                            RegexOptions.IgnoreCase);

                    var RewardLpBetraagStringNodeUndMatch =
                        Optimat.Glob.SelectSingleNodeNaacNodeMitInnerTextRegexPattern(
                            HtmlHtmlNode,
                            "//td",
                            HtmlNodeTitelReward,
                            RewardLpRegexPattern,
                            RegexOptions.IgnoreCase);

                    if (null != RewardIskBetraagStringNodeUndMatch.Value)
                    {
                        RewardIskBetraagString = RewardIskBetraagStringNodeUndMatch.Value.Groups[1].Value;
                    }

                    if (null != RewardLpBetraagStringNodeUndMatch.Value)
                    {
                        RewardLpBetraagString = RewardLpBetraagStringNodeUndMatch.Value.Groups[1].Value;
                    }

                    HtmlNodeTitelBonusReward =
                        Optimat.Glob.SelectSingleNodeNaacNodeMitZuusazFilter(
                            HtmlHtmlNode,
                            "//span",
                            HtmlNodeTitelObjective,
                            (Node) => Regex.Match(Node.InnerText, "Bonus.*Rewards", RegexOptions.IgnoreCase).Success);

                    if (null != HtmlNodeTitelBonusReward)
                    {
                        var BonusRewardIskBetraagStringNodeUndMatch =
                            Optimat.Glob.SelectSingleNodeNaacNodeMitInnerTextRegexPattern(
                                HtmlHtmlNode,
                                "//td",
                                HtmlNodeTitelBonusReward,
                                RewardIskRegexPattern,
                                RegexOptions.IgnoreCase);

                        if (null != BonusRewardIskBetraagStringNodeUndMatch.Value)
                        {
                            BonusRewardIskBetraagString = BonusRewardIskBetraagStringNodeUndMatch.Value.Groups[1].Value;
                        }
                    }
                }
            }

            /*
             * 2015.02.07
             *
             * Ergeebnis.Htmlstr = Htmlstr;
             *
             * Ergeebnis.MissionTitel = MissionTitel;
             * Ergeebnis.Complete = Complete;
             *
             * Ergeebnis.RewardIskAnzaal = (int?)AuswertGbs.Glob.SctandardNumberFormatZaalBetraag(RewardIskBetraagString);
             * Ergeebnis.RewardLpAnzaal = (int?)AuswertGbs.Glob.SctandardNumberFormatZaalBetraag(RewardLpBetraagString);
             * Ergeebnis.BonusRewardIskAnzaal	 = (int?)AuswertGbs.Glob.SctandardNumberFormatZaalBetraag(BonusRewardIskBetraagString);
             * */

            var RewardIskAnzaal      = (int?)TempAuswertGbs.Extension.SctandardNumberFormatZaalBetraag(RewardIskBetraagString);
            var RewardLpAnzaal       = (int?)TempAuswertGbs.Extension.SctandardNumberFormatZaalBetraag(RewardLpBetraagString);
            var BonusRewardIskAnzaal = (int?)TempAuswertGbs.Extension.SctandardNumberFormatZaalBetraag(BonusRewardIskBetraagString);

            if (RewardIskAnzaal.HasValue)
            {
                if (!BonusRewardIskAnzaal.HasValue)
                {
                    BonusRewardIskAnzaal = 0;
                }

                if (!RewardLpAnzaal.HasValue)
                {
                    RewardLpAnzaal = 0;
                }
            }

            WindowAgentMissionObjectiveObjective Objective = null;

            if (null != MengeObjectiveAuswert)
            {
                var MengeObjective = MengeObjectiveAuswert.Select((Auswert) => Auswert.Ergeebnis).ToArray();

                var SecurityLevelMinimumMili =
                    Optimat.EveOnline.Extension.SecurityLevelMinimumMiliBerecne(MengeObjective);

                Objective =
                    new WindowAgentMissionObjectiveObjective(
                        MengeObjective: MengeObjective,
                        AgregatioonComplete: Optimat.EveOnline.Extension.MissionObjectiveCompleteBerecne(MengeObjective, Complete),
                        SecurityLevelMinimumMili: SecurityLevelMinimumMili);
            }

            var MengeFaction = MengeFactionBerecneAusHtml(Htmlstr);

            var Ergeebnis = new WindowAgentMissionInfo(
                MissionTitel,
                Objective,
                MengeFaction,
                Complete,
                RewardIskAnzaal,
                RewardLpAnzaal,
                BonusRewardIskAnzaal
                //	2015.02.13	,MissionBriefingText
                );

            this.Ergeebnis = Ergeebnis;
        }
示例#2
0
        public void Berecne()
        {
            var HtmlNodeTr = this.HtmlNodeTr;

            if (null == HtmlNodeTr)
            {
                return;
            }

            HtmlNodeSctaatusIcon = HtmlNodeTr.SelectSingleNode(".//img[starts-with(@src, 'icon:')]");

            if (null != HtmlNodeSctaatusIcon)
            {
                var SctaatusIconTypMatch = Regex.Match(HtmlNodeSctaatusIcon.GetAttributeValue("src", ""), "icon:([\\d\\w" + Regex.Escape("_") + "]+)", RegexOptions.IgnoreCase);

                if (SctaatusIconTypMatch.Success)
                {
                    SctaatusIconTyp = SctaatusIconTypMatch.Groups[1].Value;
                }
            }

            {
                var ListeHtmlNodeTd = HtmlNodeTr.SelectNodes("./td");

                if (null != ListeHtmlNodeTd)
                {
                    this.ListeHtmlNodeTd = ListeHtmlNodeTd.ToArray();
                }
            }

            {
                if (null == ListeHtmlNodeTd)
                {
                    return;
                }

                if (ListeHtmlNodeTd.Length < 2)
                {
                    return;
                }

                HtmlNodeTyp =
                    ListeHtmlNodeTd.Reversed().ElementAtOrDefault(1);

                var ZaileLezteNode = ListeHtmlNodeTd.LastOrDefault();

                ZaileLezteInnerText = (null == ZaileLezteNode) ? null : ZaileLezteNode.InnerText;

                Complete = string.Equals(SctaatusIconTyp, AnnaameIconTypComplete, StringComparison.InvariantCultureIgnoreCase);

                string ObjectiveTypString = null;

                if (null != HtmlNodeTyp)
                {
                    ObjectiveTypString = HtmlNodeTyp.InnerText.Trim();
                }

                ObjectiveTyp = MengeTypTitel.FirstOrDefault((Kandidaat) => string.Equals(Kandidaat.Key, ObjectiveTypString, StringComparison.InvariantCultureIgnoreCase)).Value;

                if (SictMissionObjectiveObjectiveElementTyp.Item == ObjectiveTyp &&
                    null != ZaileLezteInnerText)
                {
                    var Match = Regex.Match(ZaileLezteInnerText, TypItemTailAnzaalUndItemNameRegexPattern, RegexOptions.IgnoreCase);

                    if (Match.Success)
                    {
                        ItemName = ExtractFromOldAssembly.Bib3.Glob.TrimNullable(Match.Groups[2].Value);
                    }
                }

                if (SictMissionObjectiveObjectiveElementTyp.Location == ObjectiveTyp ||
                    SictMissionObjectiveObjectiveElementTyp.LocationDropOff == ObjectiveTyp ||
                    SictMissionObjectiveObjectiveElementTyp.LocationPickUp == ObjectiveTyp)
                {
                    if (null != ZaileLezteNode)
                    {
                        LocationMengeHtmlNode = ZaileLezteNode.ChildNodes.ToArray();

                        LocationAuswert = new SictAuswertGbsMissionLocationAusHtmlNodeUndSiblings(LocationMengeHtmlNode);
                        LocationAuswert.Berecne();
                    }
                }

                var Location = (null == LocationAuswert) ? null : LocationAuswert.Ergeebnis;

                int?SecurityLevelMinimumMili = null;

                if (null != Location)
                {
                    SecurityLevelMinimumMili = Location.LocationSecurityLevelMili ?? 0;
                }

                var Ergeebnis = new WindowAgentMissionObjectiveObjective(
                    Complete,
                    ObjectiveTyp,
                    Location,
                    ItemName,
                    null,
                    //	2015.02.20	ObjectiveTypString,
                    AgregatioonComplete: Complete,
                    SecurityLevelMinimumMili: SecurityLevelMinimumMili);

                this.Ergeebnis = Ergeebnis;
            }
        }