Exemplo n.º 1
0
        void DisassembleRecord(BamlContext ctx, AttributeInfoRecord record)
        {
            WriteText("AttributeId=");
            WriteHexNumber(record.AttributeId);

            WriteText(", OwnerTypeId=");
            WriteTypeId(ctx, record.OwnerTypeId);

            WriteText(", AttributeUsage=");
            WriteHexNumber(record.AttributeUsage);

            string declType;

            if (record.OwnerTypeId > 0x7fff)
            {
                declType = ctx.KnownThings.Types((KnownTypes)(-record.OwnerTypeId)).FullName;
            }
            else if (ctx.TypeIdMap.ContainsKey(record.OwnerTypeId))
            {
                declType = ctx.TypeIdMap[record.OwnerTypeId].TypeFullName;
            }
            else
            {
                declType = $"(0x{record.OwnerTypeId:x4})";
            }
            var def = $"{IdentifierEscaper.Escape(declType)}::{IdentifierEscaper.Escape(record.Name)}";

            WriteText(", Name=");
            WriteDefinition(record.Name, def);
        }
Exemplo n.º 2
0
        private static bool IsMergedDictionaryAttribute(BamlRecord record)
        {
            AttributeInfoRecord attributeRecord = record as AttributeInfoRecord;

            if (attributeRecord == null)
            {
                return(false);
            }

            return(attributeRecord.Name.Equals("MergedDictionaries") &&
                   attributeRecord.OwnerTypeId == ResourceDictionaryTypeId);
        }
Exemplo n.º 3
0
        private void HandleMergedDictionary(
            BamlDocument document,
            IEnumerable <string> importedFiles,
            AttributeInfoRecord mergedDictionariesRecord)
        {
            int indexStart = document.FindIndex(
                r => r is PropertyListStartRecord &&
                ((PropertyListStartRecord)r).AttributeId == mergedDictionariesRecord.AttributeId);

            int insertIndex = indexStart + 1;

            if (document[insertIndex] is LineNumberAndPositionRecord)
            {
                insertIndex++;
            }

            List <string> existingUris = document.Skip(indexStart)
                                         .TakeWhile(r => !(r is PropertyListEndRecord))
                                         .OfType <PropertyWithConverterRecord>()
                                         .Select(GetFileNameFromPropertyRecord)
                                         .ToList();

            document.InsertRange(insertIndex, GetImportRecords(importedFiles.Except(existingUris)));
        }
 public BAMLAttributeReference(IDnlibDef member, AttributeInfoRecord rec)
 {
     this.member = member;
     attrRec     = rec;
 }
Exemplo n.º 5
0
 public BamlAttributeReference(AttributeInfoRecord attrRec)
 {
     this.attrRec = attrRec;
 }
Exemplo n.º 6
0
 public BamlAttributeReference(AttributeInfoRecord attrRec)
 {
     this.attrRec = attrRec;
 }