예제 #1
0
        public XMLParser.ARCHETYPE GetCanonicalArchetype()
        {
            System.Diagnostics.Debug.Assert(_archetype != null, "archetype must not be null");

            XMLParser.ARCHETYPE canonicalArchetype = ArchetypeModelBuilder.CanonicalArchetype(_archetype);

            return(canonicalArchetype);
        }
예제 #2
0
        void SetArchetypeDigest()
        {
            System.Diagnostics.Debug.Assert(_archetype != null, "archetype must not be null");
            System.Diagnostics.Debug.Assert(_archetype.description != null, "archetype description must not be null");

            XMLParser.ARCHETYPE canonicalArchetype = ArchetypeModelBuilder.CanonicalArchetype(_archetype);

            string archetypDigest = ArchetypeModelBuilder.ArchetypeDigest(canonicalArchetype);

            Dictionary <string, StringDictionaryItem> otherDetails = new Dictionary <string, StringDictionaryItem>();

            if (_archetype.description.other_details != null)
            {
                foreach (StringDictionaryItem item in _archetype.description.other_details)
                {
                    otherDetails.Add(item.id, item);
                }
            }
            if (!otherDetails.ContainsKey(ArchetypeModelBuilder.ARCHETYPE_DIGEST_ID))
            {
                StringDictionaryItem item = new StringDictionaryItem();
                item.id    = ArchetypeModelBuilder.ARCHETYPE_DIGEST_ID;
                item.Value = archetypDigest;

                otherDetails.Add(ArchetypeModelBuilder.ARCHETYPE_DIGEST_ID, item);
            }
            else
            {
                StringDictionaryItem item = otherDetails[ArchetypeModelBuilder.ARCHETYPE_DIGEST_ID];
                item.Value = archetypDigest;
            }

            StringDictionaryItem[] sortedResult = new StringDictionaryItem[otherDetails.Count];
            otherDetails.Values.CopyTo(sortedResult, 0);

            _archetype.description.other_details = sortedResult;
        }