BF2Statistics.MedalData.MedalDataEditor.ValidateConditions C# (CSharp) Method

ValidateConditions() private method

This method is used to highlight the invalid condition nodes in the conditions treeview, as to let the user know that the conditions selected wont work properly when loaded by the server
Applies highlighting from the Root Nodes => to => The Award Nodes
private ValidateConditions ( ) : void
return void
        private void ValidateConditions()
        {
            // Apply highlighting of badges
            TreeNode BadgeNode = AwardTree.Nodes[0];
            for (int i = 0; i < BadgeNode.Nodes.Count; i++)
            {
                int j = 0;
                foreach (TreeNode N in BadgeNode.Nodes[i].Nodes)
                {
                    // Fetch the award and its condition
                    Condition Cond = AwardCache.GetAward(N.Name).GetCondition();
                    if (Cond is ConditionList)
                    {
                        ConditionList Clist = Cond as ConditionList;
                        if (Clist.HasConditionErrors)
                        {
                            // Top level node
                            BadgeNode.ForeColor = Color.Red;
                            // Badge Node
                            BadgeNode.Nodes[i].ForeColor = Color.Red;
                            // Badege Level Node
                            BadgeNode.Nodes[i].Nodes[j].ForeColor = Color.Red;
                        }
                    }
                    // Make sure that this condition returns a bool
                    else if (Cond.Returns() != ReturnType.Bool)
                    {
                        // Top level node
                        BadgeNode.ForeColor = Color.Red;
                        // Badge Node
                        BadgeNode.Nodes[i].ForeColor = Color.Red;
                        // Badege Level Node
                        BadgeNode.Nodes[i].Nodes[j].ForeColor = Color.Red;
                    }
                    j++;
                }
            }

            // Apply highlighting for the rest of the awards
            for (int i = 1; i < 4; i++)
            {
                int j = 0;
                foreach (TreeNode N in AwardTree.Nodes[i].Nodes)
                {
                    // Fetch the award and its condition
                    Condition Cond = AwardCache.GetAward(N.Name).GetCondition();
                    if (Cond is ConditionList)
                    {
                        ConditionList Clist = Cond as ConditionList;
                        if (Clist.HasConditionErrors)
                        {
                            // Top level Node
                            AwardTree.Nodes[i].ForeColor = Color.Red;
                            // Award Node
                            AwardTree.Nodes[i].Nodes[j].ForeColor = Color.Red;
                        }
                    }
                    // Make sure that this condition returns a bool
                    else if (Cond.Returns() != ReturnType.Bool)
                    {
                        // Top level Node
                        AwardTree.Nodes[i].ForeColor = Color.Red;
                        // Award Node
                        AwardTree.Nodes[i].Nodes[j].ForeColor = Color.Red;
                    }
                    j++;
                }
            }
        }

Same methods

MedalDataEditor::ValidateConditions ( TreeNode AwardNode, Condition Con ) : void