Created
August 2, 2018 13:41
-
-
Save ezdiy/32347b6beb2e1133697d20805a8dbb24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace BepInEx | |
{ | |
public class BaseUnityPlugin : MonoBehaviour { } | |
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] | |
public class BepInPlugin : Attribute | |
{ | |
public BepInPlugin(string GUID, string Name, string Version) { } | |
} | |
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] | |
public class BepInDependency : Attribute | |
{ | |
public enum DependencyFlags : int | |
{ | |
HardDependency = 1, | |
SoftDependency = 2, | |
} | |
public BepInDependency(string a, DependencyFlags b = DependencyFlags.HardDependency) | |
{ | |
} | |
} | |
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] | |
public class BepInProcess : Attribute | |
{ | |
public string ProcessName { get; set; } | |
public BepInProcess(string processName) | |
{ | |
ProcessName = processName; | |
} | |
} | |
namespace Logging | |
{ | |
[Flags] | |
public enum LogLevel | |
{ | |
None = 0, | |
Fatal = 1, | |
Error = 2, | |
Warning = 4, | |
Message = 8, | |
Info = 16, | |
Debug = 32, | |
All = Fatal | Error | Warning | Message | Info | Debug | |
} | |
public static class Logger | |
{ | |
public static void Log(int level, object entry) | |
{ | |
if ((level & 15) != 0) | |
Debug.Info(entry); | |
else | |
Debug.Spam(entry); | |
} | |
public abstract class BaseLogger : TextWriter { }; | |
public static void SetLogger(BaseLogger logger) | |
{ | |
} | |
} | |
} | |
public static class BepInLogger | |
{ | |
public static void Log(string entry, bool show = false) | |
{ | |
if (show) | |
Debug.Info(entry); | |
else | |
Debug.Spam(entry); | |
} | |
public static void Log(object entry, bool show, ConsoleColor color) | |
{ | |
Log(entry.ToString(), show, color); | |
} | |
public static void Log(string entry, bool show, ConsoleColor color) | |
{ | |
Log(entry, show); | |
} | |
public static void EntryLogger(string entry, bool show) | |
{ | |
EntryLogged?.Invoke(entry, show); | |
} | |
public delegate void EntryLoggedEventHandler(string entry, bool show = false); | |
public static event EntryLoggedEventHandler EntryLogged; | |
} | |
namespace Common | |
{ | |
public static class Utility | |
{ | |
public static string PluginsDirectory => Path.GetFullPath(Application.dataPath + "/../bepinex"); | |
} | |
} | |
public class ConfigWrapper<T> | |
{ | |
public T Value { get; set; } | |
public ConfigWrapper(string name, BaseUnityPlugin o, T val) { Value = val; } | |
public ConfigWrapper(string name, object o, T val) { Value = val; } | |
public ConfigWrapper(string name, T val) { Value = val; } | |
public event EventHandler SettingChanged; | |
public void Clear() { } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment