|
|
@ -57,13 +57,15 @@ namespace ILSpy.BamlDecompiler.Rewrite |
|
|
|
foreach (var annotation in element.Annotations<BamlConnectionId>()) |
|
|
|
foreach (var annotation in element.Annotations<BamlConnectionId>()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int index; |
|
|
|
int index; |
|
|
|
|
|
|
|
bool found = false; |
|
|
|
if ((index = fieldAssignments.FindIndex(item => item.key.Contains(annotation.Id))) > -1) |
|
|
|
if ((index = fieldAssignments.FindIndex(item => item.key.Contains(annotation.Id))) > -1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var xName = ctx.GetKnownNamespace("Name", XamlContext.KnownNamespace_Xaml, element); |
|
|
|
var xName = ctx.GetKnownNamespace("Name", XamlContext.KnownNamespace_Xaml, element); |
|
|
|
if (element.Attribute("Name") is null && element.Attribute(xName) is null) |
|
|
|
if (element.Attribute("Name") is null && element.Attribute(xName) is null) |
|
|
|
element.Add(new XAttribute(xName, fieldAssignments[index].value.FieldName)); |
|
|
|
element.Add(new XAttribute(xName, fieldAssignments[index].value.FieldName)); |
|
|
|
|
|
|
|
found = true; |
|
|
|
} |
|
|
|
} |
|
|
|
else if ((index = eventMappings.FindIndex(item => item.key.Contains(annotation.Id))) > -1) |
|
|
|
if ((index = eventMappings.FindIndex(item => item.key.Contains(annotation.Id))) > -1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach (var entry in eventMappings[index].value) |
|
|
|
foreach (var entry in eventMappings[index].value) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -80,8 +82,9 @@ namespace ILSpy.BamlDecompiler.Rewrite |
|
|
|
element.Add(new XAttribute(xmlns + entry.EventName, entry.MethodName)); |
|
|
|
element.Add(new XAttribute(xmlns + entry.EventName, entry.MethodName)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
found = true; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
if (!found) |
|
|
|
{ |
|
|
|
{ |
|
|
|
element.Add(new XComment($"Unknown connection ID: {annotation.Id}")); |
|
|
|
element.Add(new XComment($"Unknown connection ID: {annotation.Id}")); |
|
|
|
} |
|
|
|
} |
|
|
@ -164,8 +167,6 @@ namespace ILSpy.BamlDecompiler.Rewrite |
|
|
|
{ |
|
|
|
{ |
|
|
|
fieldAssignments.Add((section.Labels, field)); |
|
|
|
fieldAssignments.Add((section.Labels, field)); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
events.Clear(); |
|
|
|
events.Clear(); |
|
|
|
FindEvents(section.Body, events); |
|
|
|
FindEvents(section.Body, events); |
|
|
|
if (events.Count > 0) |
|
|
|
if (events.Count > 0) |
|
|
@ -174,7 +175,6 @@ namespace ILSpy.BamlDecompiler.Rewrite |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach (var ifInst in function.Descendants.OfType<IfInstruction>()) |
|
|
|
foreach (var ifInst in function.Descendants.OfType<IfInstruction>()) |
|
|
@ -194,8 +194,6 @@ namespace ILSpy.BamlDecompiler.Rewrite |
|
|
|
{ |
|
|
|
{ |
|
|
|
fieldAssignments.Add((new LongSet(id), field)); |
|
|
|
fieldAssignments.Add((new LongSet(id), field)); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
events.Clear(); |
|
|
|
events.Clear(); |
|
|
|
FindEvents(inst, events); |
|
|
|
FindEvents(inst, events); |
|
|
|
if (events.Count > 0) |
|
|
|
if (events.Count > 0) |
|
|
@ -205,7 +203,6 @@ namespace ILSpy.BamlDecompiler.Rewrite |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FieldAssignment FindField(ILInstruction inst) |
|
|
|
FieldAssignment FindField(ILInstruction inst) |
|
|
|
{ |
|
|
|
{ |
|
|
|