void DisassembleRecord(BamlContext ctx, PropertyWithConverterRecord record) { DisassembleRecord(ctx, (PropertyRecord)record); WriteText(", ConverterTypeId="); WriteTypeId(ctx, record.ConverterTypeId); }
// Token: 0x06000014 RID: 20 RVA: 0x000029FC File Offset: 0x00000BFC private void AnalyzeBAMLElement(BAMLAnalyzer analyzer, BamlElement elem) { foreach (BamlRecord rec in elem.Body) { PropertyWithConverterRecord prop = rec as PropertyWithConverterRecord; if (prop != null) { Tuple <IDnlibDef, AttributeInfoRecord, TypeDef> attr = analyzer.ResolveAttribute(prop.AttributeId); string attrName = null; if (attr.Item2 != null) { attrName = attr.Item2.Name; } else if (attr.Item1 != null) { attrName = attr.Item1.Name; } if (attrName == "Attach") { this.AnalyzeMessageAttach(analyzer, attr, prop.Value); } if (attrName == "Name") { this.AnalyzeAutoBind(analyzer, attr, prop.Value); } if (attrName == "MethodName") { this.AnalyzeActionMessage(analyzer, attr, prop.Value); } } } }
private static string GetFileNameFromPropertyRecord(PropertyWithConverterRecord record) { int fileNameStartIndex = record.Value.IndexOf(ComponentString, StringComparison.Ordinal) + ComponentString.Length; return(record.Value.Substring(fileNameStartIndex)); }
private void ProcessRecord(PropertyWithConverterRecord record, AssemblyDefinition containingAssembly) { record.Value = XamlResourcePathPatcherStep.PatchPath( record.Value, _mainAssembly, containingAssembly, _otherAssemblies); }
public BamlTypeExtReference(PropertyWithConverterRecord rec, BamlDocument doc, string assembly) { this.rec = rec; this.doc = doc; this.assembly = assembly; }
private void WalkBaml(ResourcePart part) { Dictionary <string, string> namespaces = new Dictionary <string, string>(); foreach (BamlRecord record in part.Baml) { if (record.Type == BamlRecordType.TypeInfo) { TypeInfoRecord typeInfo = (TypeInfoRecord)record; TypeDefinition type; if (typesMap.TryGetValue(typeInfo.TypeFullName, out type)) { AddUsedType(type); } continue; } if (record.Type == BamlRecordType.XmlnsProperty) { XmlnsPropertyRecord ns = (XmlnsPropertyRecord)record; const string CLR_NAMESPACE = "clr-namespace:"; if (ns.XmlNamespace.StartsWith(CLR_NAMESPACE)) { namespaces.Add(ns.Prefix, ns.XmlNamespace.Substring(CLR_NAMESPACE.Length)); } continue; } if (record.Type == BamlRecordType.Text) { TextRecord textRecord = (TextRecord)record; int index = textRecord.Value.IndexOf(':'); if (index == -1) { continue; // not ns reference } string name; if (!namespaces.TryGetValue(textRecord.Value.Substring(0, index), out name)) { continue; } name += "." + textRecord.Value.Substring(index + 1); TypeDefinition type; // type as string? if (typesMap.TryGetValue(name, out type)) { AddUsedType(type); continue; } index = name.LastIndexOf(".", StringComparison.InvariantCulture); // member? if (typesMap.TryGetValue(name.Substring(0, index), out type)) { AddUsedType(type); } continue; } if (record.Type == BamlRecordType.PropertyWithConverter) { PropertyWithConverterRecord propertyInfo = (PropertyWithConverterRecord)record; string resourceName = propertyInfo.Value; if (resourceName.StartsWith(wpfPathPrefix)) { resourceName = resourceName.Substring(wpfPathPrefix.Length, resourceName.Length - wpfPathPrefix.Length); } if (resourceName.EndsWith(".xaml", StringComparison.InvariantCultureIgnoreCase)) { resourceName = resourceName.Substring(0, resourceName.Length - 4) + "baml"; } resourceName = resourceName.ToLower(); ResourcePart resourcePart; if (!wpfRootParts.TryGetValue(resourceName, out resourcePart)) { continue; } if (resourcePart.Baml != null) { AddUsedBaml(resourcePart); } else { Log($"WPF resource used: {resourceName}"); usedWpfResources.Add(resourceName); } } } }
private void ProcessRecord(PropertyWithConverterRecord record) { record.Value = PatchPath(record.Value); }