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.DecryptStringValue(key, stringValue, DEFAULT_STRING);
                        }
                        else if (obscuredType == ObscuredPrefs.DataType.Int)
                        {
                            intValue = ObscuredPrefs.DecryptIntValue(key, stringValue, DEFAULT_INT);
                        }
                        else if (obscuredType == ObscuredPrefs.DataType.Float)
                        {
                            floatValue = ObscuredPrefs.DecryptFloatValue(key, stringValue, DEFAULT_FLOAT);
                        }
                    }
                }
            }
예제 #2
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.DecryptStringValue(key, stringValue, DefaultString);
                            if (stringValue == DefaultString)
                            {
                                stringValue = CantDecrypt;
                            }
                        }
                        else if (obscuredType == ObscuredPrefs.DataType.Int)
                        {
                            intValue = ObscuredPrefs.DecryptIntValue(key, stringValue, DefaultInt);
                            if (intValue == DefaultInt)
                            {
                                obscuredType = ObscuredPrefs.DataType.String;
                                stringValue  = CantDecrypt;
                            }
                        }
                        else if (obscuredType == ObscuredPrefs.DataType.Float)
                        {
                            floatValue = ObscuredPrefs.DecryptFloatValue(key, stringValue, DefaultFloat);
                            if (Math.Abs(floatValue - DefaultFloat) < 0.00001f)
                            {
                                obscuredType = ObscuredPrefs.DataType.String;
                                stringValue  = CantDecrypt;
                            }
                        }
                    }
                }
            }