Example #1
0
        private static bool IsThirdPartyOption(InitialStateOption item)
        {
            var act        = (Action)InitOptActField.GetValue(item);
            var optAsm     = act.Method.DeclaringType?.Assembly;
            var optAsmName = optAsm?.GetName().Name;

            if (optAsmName == null)
            {
                return(false);
            }
            if (optAsmName.StartsWith("TaleWorlds."))
            {
                return(false);
            }
            if (optAsmName.StartsWith("SandBox."))
            {
                return(false);
            }
            if (optAsmName.StartsWith("SandBoxCore."))
            {
                return(false);
            }
            if (optAsmName.StartsWith("StoryMode."))
            {
                return(false);
            }

            return(true);
        }
        private static bool IsThirdPartyOption(InitialStateOption item)
        {
            try {
                var act        = (Action)InitOptActField.GetValue(item);
                var optAsm     = act.Method.DeclaringType?.Assembly;
                var optAsmName = optAsm?.GetName().Name;
                if (optAsmName == null ||
                    optAsmName.StartsWith("TaleWorlds.") ||
                    optAsmName.StartsWith("SandBox.") ||
                    optAsmName.StartsWith("SandBoxCore.") ||
                    optAsmName.StartsWith("StoryMode."))
                {
                    if (PathHelpers.IsOfficialAssembly(optAsm))
                    {
                        return(false);
                    }
                }
            }
            catch (Exception) {
                return(true);
            }

            return(true);
        }