| 4 | namespace PenguLoader.Main |
| 5 | { |
| 6 | static class Module |
| 7 | { |
| 8 | private static string ModuleName => "core.dll"; |
| 9 | private static string TargetName => LCU.ClientUxProcessName; |
| 10 | private static string ModulePath => Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ModuleName); |
| 11 | private static string DebuggerValue => $"rundll32 \"{ModulePath}\", #6000 "; |
| 12 | |
| 13 | private static string SymlinkName => "version.dll"; |
| 14 | private static string SymlinkPath => Path.Combine(Config.LeaguePath, SymlinkName); |
| 15 | |
| 16 | public static bool IsFound => File.Exists(ModulePath); |
| 17 | |
| 18 | public static bool IsLoaded => Utils.IsFileInUse(ModulePath); |
| 19 | |
| 20 | public static bool IsActivated |
| 21 | { |
| 22 | get |
| 23 | { |
| 24 | if (Config.UseSymlink) |
| 25 | { |
| 26 | if (!LCU.IsValidDir(Config.LeaguePath)) |
| 27 | return false; |
| 28 | |
| 29 | var resolved = Utils.NormalizePath(Symlink.Resolve(SymlinkPath)); |
| 30 | var modulePath = Utils.NormalizePath(ModulePath); |
| 31 | |
| 32 | return string.Compare(resolved, modulePath, false) == 0; |
| 33 | } |
| 34 | else |
| 35 | { |
| 36 | var param = IFEO.GetDebugger(TargetName); |
| 37 | return DebuggerValue.Equals(param, StringComparison.OrdinalIgnoreCase); |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | public static bool SetActive(bool active) |
| 43 | { |
| 44 | if (IsActivated == active) |
| 45 | return true; |
| 46 | |
| 47 | if (Config.UseSymlink) |
| 48 | { |
| 49 | var path = SymlinkPath; |
| 50 | Utils.DeletePath(path); |
| 51 | |
| 52 | if (active) |
| 53 | { |
| 54 | Symlink.Create(path, ModulePath); |
| 55 | } |
| 56 | } |
| 57 | else |
| 58 | { |
| 59 | if (active) |
| 60 | { |
| 61 | IFEO.SetDebugger(TargetName, DebuggerValue); |
| 62 | } |
| 63 | else |
nothing calls this directly
no test coverage detected