using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Rage; using LSPD_First_Response.Mod.API; using System.Reflection; //using LSPD_First_Response.Mod.Callouts; namespace Code_Blue_Calls { public class Main : Plugin { public override void Initialize() { Functions.OnOnDutyStateChanged += OnOnDutyStateChangedHandler; Game.LogTrivial("Code Blue callouts initialized."); AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(LSPDFRResolveEventHandler); } public override void Finally() { throw new NotImplementedException(); } public static void OnOnDutyStateChangedHandler(bool OnDuty) { if (OnDuty) { RegisterCallouts(); Game.DisplayNotification("Code Blue Callouts loaded."); } } private static void RegisterCallouts() { Functions.RegisterCallout(typeof(Callouts.DomesticViolence)); } public static Assembly LSPDFRResolveEventHandler(object sender, ResolveEventArgs args) { foreach (Assembly assembly in Functions.GetAllUserPlugins()) { if (args.Name.ToLower().Contains(assembly.GetName().Name.ToLower())) { return assembly; } } return null; } public static bool IsLSPDFRPluginRunning(string Plugin, Version minversion = null) { foreach (Assembly assembly in Functions.GetAllUserPlugins()) { AssemblyName an = assembly.GetName(); if (an.Name.ToLower() == Plugin.ToLower()) { if (minversion == null || an.Version.CompareTo(minversion) >= 0) { return true; } } } return false; } } }