コード例 #1
0
        // Token: 0x06001071 RID: 4209 RVA: 0x00064D2C File Offset: 0x00062F2C
        private static object GetValue(OwaRegistryKey key)
        {
            object result = null;

            if (OwaRegistryKeys.keyValueCache.TryGetValue(key, out result))
            {
                return(result);
            }
            return(key.DefaultValue);
        }
コード例 #2
0
        // Token: 0x06001070 RID: 4208 RVA: 0x00064BE4 File Offset: 0x00062DE4
        private static object ReadKeyValue(RegistryKey keyContainer, OwaRegistryKey owaKey)
        {
            ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "Reading registry key \"{0}\"", owaKey.Name);
            object obj;

            if (owaKey.Type == typeof(int))
            {
                obj = keyContainer.GetValue(owaKey.Name, owaKey.DefaultValue);
                if (obj.GetType() != typeof(int))
                {
                    obj = null;
                }
            }
            else if (owaKey.Type == typeof(string))
            {
                obj = keyContainer.GetValue(owaKey.Name, owaKey.DefaultValue);
                if (obj.GetType() != typeof(string))
                {
                    obj = null;
                }
            }
            else
            {
                if (!(owaKey.Type == typeof(bool)))
                {
                    return(null);
                }
                object value = keyContainer.GetValue(owaKey.Name, owaKey.DefaultValue);
                if (value.GetType() != typeof(int))
                {
                    obj = null;
                }
                else
                {
                    obj = ((int)value != 0);
                }
            }
            if (obj == null)
            {
                ExTraceGlobals.CoreTracer.TraceDebug(0L, "Couldn't find key or key format/type was incorrect, using default value");
                obj = owaKey.DefaultValue;
            }
            ExTraceGlobals.CoreTracer.TraceDebug <string, object>(0L, "Configuration registry key \"{0}\" read with value=\"{1}\"", owaKey.Name, obj);
            return(obj);
        }