Skip to content

Commit

Permalink
Release 2.0.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
pardeike committed Feb 29, 2020
1 parent 2c3d2dd commit d227f8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Harmony/Harmony.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
<Authors>Andreas Pardeike</Authors>
<AssemblyName>0Harmony</AssemblyName>
<SignAssembly>true</SignAssembly>
<Version>2.0.0.7</Version>
<Version>2.0.0.8</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/pardeike/Harmony</PackageProjectUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageTags>Harmony,Mono,Patch,Patching,Runtime,Detour,Detours,Aspect,Aspects</PackageTags>
<AssemblyVersion>2.0.0.7</AssemblyVersion>
<FileVersion>2.0.0.7</FileVersion>
<AssemblyVersion>2.0.0.8</AssemblyVersion>
<FileVersion>2.0.0.8</FileVersion>
<PackageIcon>HarmonyLogo.png</PackageIcon>
<PackageIconUrl>https://raw.githubusercontent.com/pardeike/Harmony/master/HarmonyLogo.png</PackageIconUrl>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
11 changes: 5 additions & 6 deletions Harmony/Internal/Emitter.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using MonoMod.Utils.Cil;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -17,13 +18,13 @@ public override string ToString()

internal class Emitter
{
readonly MonoMod.Utils.Cil.CecilILGenerator il;
readonly CecilILGenerator il;
readonly Dictionary<int, CodeInstruction> instructions = new Dictionary<int, CodeInstruction>();
readonly bool debug;

internal Emitter(ILGenerator il, bool debug)
{
this.il = Traverse.Create(il).Field("Target").GetValue<MonoMod.Utils.Cil.CecilILGenerator>();
this.il = il.GetProxiedShim<CecilILGenerator>();
this.debug = debug;
}

Expand All @@ -39,8 +40,7 @@ internal void AddInstruction(OpCode opcode, object operand)

internal int CurrentPos()
{
var cilInstructions = Traverse.Create(il).Field("IL").Field("instructions").GetValue<Mono.Collections.Generic.Collection<Mono.Cecil.Cil.Instruction>>();
return cilInstructions.Sum(instr => instr.GetSize());
return il.ILOffset;
}

internal static string CodePos(int offset)
Expand Down Expand Up @@ -86,8 +86,7 @@ internal void LogAllLocalVariables()
if (debug == false)
return;

var variables = Traverse.Create(il).Field("IL").Field("body").Field("variables").GetValue<Mono.Collections.Generic.Collection<Mono.Cecil.Cil.VariableDefinition>>();
variables.Do(v =>
il.IL.Body.Variables.Do(v =>
{
var str = string.Format("{0}Local var {1}: {2}{3}", CodePos(0), v.Index, v.VariableType.FullName, v.IsPinned ? "(pinned)" : "");
FileLog.LogBuffered(str);
Expand Down

0 comments on commit d227f8b

Please sign in to comment.