コード例 #1
0
        public static void UpdateKeyValues(ContentProfile profile)
        {
            Assert.ArgumentNotNull(profile, "profile");
            Assert.IsFalse(profile.ProfileID == ID.Null, "profile ID");
            if (profile.Presets == null || profile.Presets.Count == 0)
            {
                return;
            }
            Item profileItem = profile.GetProfileItem();

            if (profileItem == null)
            {
                return;
            }
            Item presetsFolder = ProfileUtil.GetPresetsFolder(profileItem);

            if (presetsFolder == null)
            {
                return;
            }
            SimpleProfileKeyCalculator profileKeyCalculator = null;
            string strA = presetsFolder["Authoring Selection"];

            if (string.Compare(strA, "{C4960DD5-8B07-4025-8E48-57C3BC578CE1}", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                profileKeyCalculator = new SimpleProfileKeyCalculator(profile);
            }
            else if (string.Compare(strA, "{DF9486E3-C239-406E-83DD-7A30BEF2599D}", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                profileKeyCalculator = new MultipleProfileKeyCalculator(profile);
            }
            else if (string.Compare(strA, "{2DE135D7-FB39-42B2-B10A-13CB4285E5C5}", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                profileKeyCalculator = new MultipleWithPercentageProfileKeyCalculator(profile);
            }
            if (profileKeyCalculator == null)
            {
                return;
            }
            profileKeyCalculator.Calculate();
        }