updating online repo to match local
This commit is contained in:
parent
3a2897d0d8
commit
8f043dd9aa
@ -1,24 +0,0 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ClodanClientUtils
|
||||
{
|
||||
/*
|
||||
* Abstract class that can be extended to hook up to the Raid finish event
|
||||
*/
|
||||
public abstract class BaseRaidFinishedPatch : ModulePatch
|
||||
{
|
||||
protected static Type _targetType;
|
||||
protected static MethodBase _method;
|
||||
public BaseRaidFinishedPatch() : base()
|
||||
{
|
||||
_targetType = ReflectionUtils.FindFirstEftType("LocalGame");
|
||||
_method = ReflectionUtils.FindFirstTypeMethod(_targetType, "method_12");
|
||||
}
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return _method;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ClodanClientUtils
|
||||
{
|
||||
/*
|
||||
* Abstract class that can be extended to hook up to the Raid startup event after everything has been loaded
|
||||
*/
|
||||
public abstract class BaseRaidStartupPatch : ModulePatch
|
||||
{
|
||||
protected static Type _targetType;
|
||||
protected static MethodBase _method;
|
||||
public BaseRaidStartupPatch() : base()
|
||||
{
|
||||
_targetType = ReflectionUtils.FindFirstEftType("GameWorld");
|
||||
_method = ReflectionUtils.FindFirstTypeMethod(_targetType, "OnGameStarted");
|
||||
}
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return _method;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ClodanClientUtils
|
||||
{
|
||||
public static class ReflectionUtils
|
||||
{
|
||||
|
||||
private static readonly Func<object, bool> _any = (t) => true;
|
||||
|
||||
public static Type[] FilterFindAnyType(string _name, string[] _namespaces = null, Func<Type, bool> filter = null, bool _partialName = false)
|
||||
{
|
||||
filter = filter ?? _any;
|
||||
return AppDomain.CurrentDomain
|
||||
.GetAssemblies()
|
||||
.SelectMany(assembly =>
|
||||
{
|
||||
return assembly.GetTypes()
|
||||
.Where(t => _namespaces == null || _namespaces.Contains(t.Namespace))
|
||||
.Where(t =>
|
||||
{
|
||||
if (_partialName)
|
||||
{
|
||||
return t.Name.Contains(_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return t.Name.EqualsAndNotNull(_name);
|
||||
}
|
||||
});
|
||||
}).Where(filter)
|
||||
.DistinctBy(t => t.GetHashCode())
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
public static Type[] FindAnyEftType(string _name, bool _partialName = false)
|
||||
{
|
||||
return FilterFindAnyType(_name: _name, _namespaces: new string[] { "EFT" }, _partialName: _partialName);
|
||||
}
|
||||
|
||||
public static Type[] FindAnyType(string _name, bool _partialName = false)
|
||||
{
|
||||
return FilterFindAnyType(_name: _name, _partialName: _partialName);
|
||||
}
|
||||
|
||||
public static Type FindFirstEftType(string _name, bool _partialName = false)
|
||||
{
|
||||
return FindAnyEftType(_name, _partialName).First();
|
||||
}
|
||||
|
||||
public static Type FindFirstType(string _name, bool _partialName = false)
|
||||
{
|
||||
return FindAnyType(_name, _partialName).First();
|
||||
}
|
||||
|
||||
public static MethodInfo[] FilterFindAllTypeMethod(Type type, Func<MethodInfo, bool> filter = null, string _name = null, bool _partialName = false)
|
||||
{
|
||||
filter = filter ?? _any;
|
||||
return type.GetMethods(BindingFlags.FlattenHierarchy | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).Where(m =>
|
||||
{
|
||||
if (_name == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_partialName)
|
||||
{
|
||||
return m.Name.Contains(_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return m.Name.EqualsAndNotNull(_name);
|
||||
}
|
||||
}
|
||||
}).Where(filter)
|
||||
.DistinctBy(m => m.GetHashCode())
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
public static MethodInfo[] FindAllTypeMethods(Type type, string _name = null, bool _partialName = false)
|
||||
{
|
||||
return FilterFindAllTypeMethod(type: type, _name: _name, _partialName: _partialName);
|
||||
}
|
||||
|
||||
public static MethodInfo FindFirstTypeMethod(Type type, string _name, bool _partialName = false)
|
||||
{
|
||||
return FindAllTypeMethods(type, _name, _partialName).First();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user