BF2Statistics.MedalData.AwardCache.AddDefaultAwardCondition C# (CSharp) Method

AddDefaultAwardCondition() public static method

Used by the Medal data parser to add the original award conditions
public static AddDefaultAwardCondition ( string Id, Condition C ) : void
Id string The Award ID found in the Medal Data file
C Condition The parsed condition to earn the award
return void
        public static void AddDefaultAwardCondition(string Id, Condition C)
        {
            if (!OrigConditions.ContainsKey(Id))
                OrigConditions.Add(Id, C);
        }

Usage Example

Example #1
0
        /// <summary>
        /// Loads the default medal data into the Award Cache
        /// </summary>
        static MedalDataParser()
        {
            // Fill the award cache with the original award conditions
            MatchCollection MedalsMatches, RankMatches;

            ParseMedalData(Program.GetResourceAsString("BF2Statistics.MedalData.PyFiles.medal_data_xpack.py"), out MedalsMatches, out RankMatches);

            // Convert each medal match into an object, and add it to the award cache
            foreach (Match ArrayMatch in MedalsMatches)
            {
                AwardCache.AddDefaultAwardCondition(
                    ArrayMatch.Groups["MedalIntId"].Value,
                    ParseCondition(ArrayMatch.Groups["Conditions"].Value)
                    );
            }

            // Convert ranks into objects, and also add them to the award cache
            foreach (Match ArrayMatch in RankMatches)
            {
                AwardCache.AddDefaultAwardCondition(
                    ArrayMatch.Groups["RankId"].Value,
                    ParseCondition(ArrayMatch.Groups["Conditions"].Value)
                    );
            }
        }