Пример #1
0
        internal PrefsRecord(string originalKey)
        {
            key = savedKey = originalKey;

            ReadValue();

            // only string prefs may be obscured
            if (prefType == PrefsType.String)
            {
                Obscured = IsValueObscured(stringValue);

                if (Obscured)
                {
                    key = DecryptKey(key);

                    if (obscuredType == ObscuredPrefs.DataType.String)
                    {
                        stringValue = ObscuredPrefs.DecryptValue(key, null, DefaultString, stringValue);
                        if (stringValue == DefaultString)
                        {
                            stringValue = CantDecrypt;
                        }
                    }
                    else if (obscuredType == ObscuredPrefs.DataType.Int)
                    {
                        intValue = ObscuredPrefs.DecryptValue(key, null, DefaultInt, stringValue);
                        if (intValue == DefaultInt)
                        {
                            obscuredType = ObscuredPrefs.DataType.String;
                            stringValue  = CantDecrypt;
                        }
                    }
                    else if (obscuredType == ObscuredPrefs.DataType.Float)
                    {
                        floatValue = ObscuredPrefs.DecryptValue(key, null, DefaultFloat, stringValue);
                        if (Math.Abs(floatValue - DefaultFloat) < 0.00001f)
                        {
                            obscuredType = ObscuredPrefs.DataType.String;
                            stringValue  = CantDecrypt;
                        }
                    }
                }
            }
        }