101 lines
2.7 KiB
C#
101 lines
2.7 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: MindLated.Protection.Arithmetic.Utils.ArithmeticUtils
|
|
// Assembly: Server, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
|
// MVID: 33673F0A-7F43-4A2B-BC08-8E59A15CB7DA
|
|
// Assembly location: C:\Users\Admin\Desktop\Sheet RAT 2.5\Server.exe
|
|
|
|
using dnlib.DotNet.Emit;
|
|
using System;
|
|
using System.Windows.Forms;
|
|
using System.Reflection;
|
|
|
|
//#nullable disable
|
|
namespace MindLated.Protection.Arithmetic.Utils {
|
|
|
|
public static class ArithmeticUtils
|
|
{
|
|
public static bool CheckArithmetic(Instruction instruction)
|
|
{
|
|
return instruction.IsLdcI4() && instruction.GetLdcI4Value() != 1 && instruction.GetLdcI4Value() != 0;
|
|
}
|
|
|
|
public static double GetY(double x) => x / 2.0;
|
|
|
|
public static MethodInfo GetMethod(ArithmeticTypes mathType)
|
|
{
|
|
switch (mathType)
|
|
{
|
|
case ArithmeticTypes.Abs:
|
|
return typeof (Math).GetMethod("Abs", new Type[1]
|
|
{
|
|
typeof (double)
|
|
});
|
|
case ArithmeticTypes.Log:
|
|
return typeof (Math).GetMethod("Log", new Type[1]
|
|
{
|
|
typeof (double)
|
|
});
|
|
case ArithmeticTypes.Log10:
|
|
return typeof (Math).GetMethod("Log10", new Type[1]
|
|
{
|
|
typeof (double)
|
|
});
|
|
case ArithmeticTypes.Sin:
|
|
return typeof (Math).GetMethod("Sin", new Type[1]
|
|
{
|
|
typeof (double)
|
|
});
|
|
case ArithmeticTypes.Cos:
|
|
return typeof (Math).GetMethod("Cos", new Type[1]
|
|
{
|
|
typeof (double)
|
|
});
|
|
case ArithmeticTypes.Round:
|
|
return typeof (Math).GetMethod("Round", new Type[1]
|
|
{
|
|
typeof (double)
|
|
});
|
|
case ArithmeticTypes.Sqrt:
|
|
return typeof (Math).GetMethod("Sqrt", new Type[1]
|
|
{
|
|
typeof (double)
|
|
});
|
|
case ArithmeticTypes.Ceiling:
|
|
return typeof (Math).GetMethod("Ceiling", new Type[1]
|
|
{
|
|
typeof (double)
|
|
});
|
|
case ArithmeticTypes.Floor:
|
|
return typeof (Math).GetMethod("Floor", new Type[1]
|
|
{
|
|
typeof (double)
|
|
});
|
|
case ArithmeticTypes.Tan:
|
|
return typeof (Math).GetMethod("Tan", new Type[1]
|
|
{
|
|
typeof (double)
|
|
});
|
|
case ArithmeticTypes.Tanh:
|
|
return typeof (Math).GetMethod("Tanh", new Type[1]
|
|
{
|
|
typeof (double)
|
|
});
|
|
case ArithmeticTypes.Truncate:
|
|
return typeof (Math).GetMethod("Truncate", new Type[1]
|
|
{
|
|
typeof (double)
|
|
});
|
|
default:
|
|
return (MethodInfo) null;
|
|
}
|
|
}
|
|
|
|
public static OpCode GetOpCode(ArithmeticTypes arithmetic)
|
|
{
|
|
if (arithmetic == ArithmeticTypes.Add)
|
|
return OpCodes.Add;
|
|
return arithmetic == ArithmeticTypes.Sub ? OpCodes.Sub : (OpCode) null;
|
|
}
|
|
}
|
|
}
|