Example #1
0
        public bool TryEnable(HarmonyInstance harmony)
        {
            try
            {
                var otherAssembly = Assembly.Load(OtherModAssemblyName);
                if (otherAssembly != null)
                {
                    var version = new AssemblyName(otherAssembly.FullName).Version;
                    if (version == OtherModVersion || OtherModVersion == null)
                    {
                        var assembly = AssemblyUtility.FindModAssembly(ThisModName, IntegrationAssemblyPath);
                        if (assembly != null)
                        {
                            harmony.PatchAll(assembly);
                            Log.Message("Frontier Developments Shields :: enabled " + OtherModName + " support");
                            return(true);
                        }
                        else
                        {
                            Log.Warning("Frontier Developments Shields :: unable to load " + OtherModName + " support assembly");
                        }
                    }
                    else
                    {
                        Log.Warning("Frontier Developments Shields :: " + OtherModName + " " + version +
                                    "is loaded and " + OtherModVersion + " is required, not enabling support");
                    }
                }
            }
            catch (Exception)
            {
            }

            return(false);
        }