mirror of
				https://github.com/jakeswenson/BitBetter.git
				synced 2025-10-31 12:53:25 +00:00 
			
		
		
		
	Simplify patch
This commit is contained in:
		
							parent
							
								
									a9f3cef023
								
							
						
					
					
						commit
						bb086b99dd
					
				|  | @ -45,16 +45,14 @@ internal class Program | ||||||
|             TypeDef type = services.First(t => t.Name == "LicensingService"); |             TypeDef type = services.First(t => t.Name == "LicensingService"); | ||||||
|             MethodDef constructor = type.FindConstructors().First(); |             MethodDef constructor = type.FindConstructors().First(); | ||||||
|              |              | ||||||
|             Instruction instToReplace = |             Instruction instructionToPatch = | ||||||
|                 constructor.Body.Instructions |                 constructor.Body.Instructions | ||||||
|                     .FirstOrDefault(i => i.OpCode == OpCodes.Ldstr |                     .FirstOrDefault(i => i.OpCode == OpCodes.Ldstr | ||||||
|                                          && String.Equals((String)i.Operand, existingCert.Thumbprint, StringComparison.InvariantCultureIgnoreCase)); |                                          && String.Equals((String)i.Operand, existingCert.Thumbprint, StringComparison.InvariantCultureIgnoreCase)); | ||||||
|              |              | ||||||
|             if (instToReplace != null) |             if (instructionToPatch != null) | ||||||
|             { |             { | ||||||
|                 Int32 index = constructor.Body.Instructions.IndexOf(instToReplace); |                 instructionToPatch.Operand = certificate.Thumbprint; | ||||||
|                 constructor.Body.Instructions.Remove(instToReplace); |  | ||||||
|                 constructor.Body.Instructions.Insert(index, Instruction.Create(OpCodes.Ldstr, certificate.Thumbprint)); |  | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user