Skip to content

Commit

Permalink
Removed MonoInternals because it was not needed
Browse files Browse the repository at this point in the history
Fixed missing generic attribute in Traverse
Removed nunit test project
Ready for 1.0.9 release
  • Loading branch information
pardeike committed Mar 16, 2017
1 parent 7f62570 commit ed94115
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 371 deletions.
6 changes: 0 additions & 6 deletions Harmony.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Harmony", "Harmony\Harmony.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarmonyTests", "HarmonyTests\HarmonyTests.csproj", "{518BE511-DF94-411D-9577-D3D8959907D2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarmonyNUnitTests", "HarmonyNUnitTests\HarmonyNUnitTests.csproj", "{3EEC5AB4-E61A-45AB-8889-EE247174EC64}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -23,10 +21,6 @@ Global
{518BE511-DF94-411D-9577-D3D8959907D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{518BE511-DF94-411D-9577-D3D8959907D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{518BE511-DF94-411D-9577-D3D8959907D2}.Release|Any CPU.Build.0 = Release|Any CPU
{3EEC5AB4-E61A-45AB-8889-EE247174EC64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3EEC5AB4-E61A-45AB-8889-EE247174EC64}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3EEC5AB4-E61A-45AB-8889-EE247174EC64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3EEC5AB4-E61A-45AB-8889-EE247174EC64}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 0 additions & 1 deletion Harmony/Harmony.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
<Compile Include="ILCopying\ILInstruction.cs" />
<Compile Include="ILCopying\Memory.cs" />
<Compile Include="ILCopying\MethodCopier.cs" />
<Compile Include="ILCopying\MonoInternals.cs" />
<Compile Include="Extras\MethodInvoker.cs" />
<Compile Include="MethodPatcher.cs" />
<Compile Include="Patch.cs" />
Expand Down
5 changes: 1 addition & 4 deletions Harmony/ILCopying/Memory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ public static long WriteJump(long memory, long destination)

public static long GetMethodStart(MethodBase method)
{
long originalCodeStart = 0;
if (MonoInternals.GetCodeInfo(method, out originalCodeStart) == false)
throw new Exception("Cannot get info for original: " + method);
return originalCodeStart;
return method.MethodHandle.GetFunctionPointer().ToInt64();
}

public static unsafe long WriteByte(long memory, byte value)
Expand Down
138 changes: 0 additions & 138 deletions Harmony/ILCopying/MonoInternals.cs

This file was deleted.

28 changes: 14 additions & 14 deletions Harmony/Tools/Traverse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,33 +85,27 @@ public object GetValue()
return _root;
}

public T GetValue<T>()
{
var value = GetValue();
if (value == null) return default(T);
return (T)value;
}

public object GetValue(params object[] arguments)
{
if (_method == null)
throw new Exception("cannot get method value without method");
return _method.Invoke(_root, arguments);
}

public object GetValue<T>(params object[] arguments)
public T GetValue<T>(params object[] arguments)
{
if (_method == null)
throw new Exception("cannot get method value without method");
return (T)_method.Invoke(_root, arguments);
}

Traverse Resolve()
{
if (_root == null && _type != null) return this;
return new Traverse(GetValue());
}

public T GetValue<T>()
{
var value = GetValue();
if (value == null) return default(T);
return (T)value;
}

public Traverse SetValue(object value)
{
if (_info is FieldInfo)
Expand All @@ -123,6 +117,12 @@ public Traverse SetValue(object value)
return this;
}

Traverse Resolve()
{
if (_root == null && _type != null) return this;
return new Traverse(GetValue());
}

public Traverse Type(string name)
{
if (name == null) throw new Exception("name cannot be null");
Expand Down
86 changes: 0 additions & 86 deletions HarmonyNUnitTests/HarmonyNUnitTests.csproj

This file was deleted.

35 changes: 0 additions & 35 deletions HarmonyNUnitTests/PatchClasses.cs

This file was deleted.

36 changes: 0 additions & 36 deletions HarmonyNUnitTests/Properties/AssemblyInfo.cs

This file was deleted.

Loading

0 comments on commit ed94115

Please sign in to comment.