Skip to content

Commit

Permalink
ff
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Jan 7, 2021
1 parent cc5a437 commit 6c89991
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected override void Process ()
if (config == null)
return;
foreach(var asm in config.Assemblies) {
if (FindResourceDesigner (asm, isApplication: true, designer: out mainDesigner, designerAttribute: out mainDesignerAttribute)) {
if (FindResourceDesigner (asm, mainApplication: true, designer: out mainDesigner, designerAttribute: out mainDesignerAttribute)) {
mainAssembly = asm;
break;
}
Expand All @@ -51,7 +51,7 @@ protected override void EndProcess ()
}
}

bool FindResourceDesigner (AssemblyDefinition assembly, bool isApplication, out TypeDefinition designer, out CustomAttribute designerAttribute)
bool FindResourceDesigner (AssemblyDefinition assembly, bool mainApplication, out TypeDefinition designer, out CustomAttribute designerAttribute)
{
string designerFullName = null;
designer = null;
Expand All @@ -65,7 +65,7 @@ bool FindResourceDesigner (AssemblyDefinition assembly, bool isApplication, out
{
foreach (var p in attribute.Properties)
{
if (p.Name == "IsApplication" && (bool)p.Argument.Value == (isApplication ? isApplication : (bool)p.Argument.Value))
if (p.Name == "IsApplication" && (bool)p.Argument.Value == (mainApplication ? mainApplication : (bool)p.Argument.Value))
{
designerFullName = attribute.ConstructorArguments[0].Value.ToString();
break;
Expand Down Expand Up @@ -131,7 +131,7 @@ void FixBody (MethodBody body, TypeDefinition localDesigner)
var match = opCodeRegex.Match (line);
if (match.Success && match.Groups.Count == 5) {
string key = match.Groups[4].Value.Replace (designerFullName, string.Empty);
if (designerConstants.ContainsKey (key))
if (designerConstants.ContainsKey (key) && !instructions.ContainsKey (i))
instructions.Add(i, designerConstants[key]);
}
}
Expand Down Expand Up @@ -185,7 +185,7 @@ protected override void ProcessAssembly (AssemblyDefinition assembly)
CustomAttribute designerAttribute;
if (assembly != mainAssembly) {
Context.LogMessage ($" {assembly.Name.Name} is not the main assembly. ");
if (!FindResourceDesigner (assembly, isApplication: false, designer: out localDesigner, designerAttribute: out designerAttribute)) {
if (!FindResourceDesigner (assembly, mainApplication: false, designer: out localDesigner, designerAttribute: out designerAttribute)) {
Context.LogMessage ($" {assembly.Name.Name} does not have a designer file.");
return;
}
Expand Down

0 comments on commit 6c89991

Please sign in to comment.