BF2Statistics.MedalData.ObjectStat.ToTree C# (CSharp) Method

ToTree() public method

Covnerts the conditions into a TreeNode
public ToTree ( ) : TreeNode
return System.Windows.Forms.TreeNode
        public override TreeNode ToTree()
        {
            string Name = "IAR: ";
            string Param = "";
            string AsOrWith = "with ";
            string[] parts = Params[3].Split('_');

            // If we have a 5th param, convert it to a timestamp for a round time request
            if (Params.Count == 5)
            {
                Name += (Params[2] == "rtime")
                    ? Condition.Sec2hms(Int32.Parse(Params[4])) + " "
                    : String.Format("{0:N0}", Int32.Parse(Params[4])) + " ";
            }

            // Get human readable version of object names
            switch (parts[0])
            {
                case "WEAPON":
                    Param = Bf2Constants.WeaponTypes[Params[3]];
                    break;
                case "VEHICLE":
                    Param = Bf2Constants.VehicleTypes[Params[3]];
                    break;
                case "KIT":
                    Param = Bf2Constants.KitTypes[Params[3]];
                    AsOrWith = "as ";
                    break;
            }

            // Get human readable version of decription
            switch (Params[2])
            {
                case "kills":
                    Name += "Kills " + AsOrWith + Param;
                    break;
                case "rtime":
                    Name += AsOrWith + Param;
                    break;
                case "roadKills":
                    Name += "RoadKills " + AsOrWith + Param;
                    break;
                case "deployed":
                    Name += "Deploys with " + Param;
                    break;
            }

            TreeNode Me = new TreeNode(Name);
            Me.Tag = this;
            return Me;
        }