Example #1
0
        /// <summary>
        /// Assignable from config file.  Allows for control over the default <see cref="BindingFlags"/>
        /// used in .NET reflection
        /// </summary>
        protected internal void SetDefaultReflectionFlags()
        {
            var strDfFlagsRaw = SysCfg.GetAppCfgSetting(DEFAULT_FLAGS);

            if (string.IsNullOrWhiteSpace(strDfFlagsRaw))
            {
                return;
            }
            var hasFlags = false;
            var dfFlag   = BindingFlags.Public;
            var splitOn  = strDfFlagsRaw.Contains(",") ? ',' : '|';

            foreach (var strDfFlag in strDfFlagsRaw.Split(splitOn))
            {
                if (string.IsNullOrWhiteSpace(strDfFlag))
                {
                    continue;
                }

                if (Enum.TryParse(strDfFlag.Trim(), true, out BindingFlags flag))
                {
                    dfFlag  |= flag;
                    hasFlags = true;
                }
            }

            if (hasFlags)
            {
                NfSettings.DefaultFlags = dfFlag;
            }
        }
Example #2
0
        /// <summary>
        /// Assignable from the config file. Determines if assemblies are loaded using ReflectionOnly
        /// </summary>
        protected internal void SetReflectionOnly()
        {
            var useReflectionOnly =
                ResolveBool(SysCfg.GetAppCfgSetting(USE_REFLX_LOAD));

            NfConfig.UseReflectionOnlyLoad = useReflectionOnly != null && useReflectionOnly.Value;
        }
Example #3
0
        /// <summary>
        /// Resolve a port number from the config file's appSettings
        /// on <see cref="appKey"/>
        /// </summary>
        /// <param name="appKey"></param>
        /// <returns></returns>
        protected internal int?ResolvePort(string appKey)
        {
            var cval = SysCfg.GetAppCfgSetting(appKey);

            return(ResolveInt(cval));
        }