コード例 #1
0
 public bool GetBooleanPreference(PreferenceKey key)
 {
     if (_preferences.ContainsKey(key))
     {
         return(_preferences[key]);
     }
     return(true);
 }
コード例 #2
0
    //------------------------Preference methods for storing and retrieving objects----------------------------------------
    public void UpdateCustomPref(PreferenceKey key, object obj)
    {
        string json = JsonUtility.ToJson(obj);

        Debug.Log(json);
        PlayerPrefs.SetString(key.ToString(), json);
        Debug.Log("Custom Preference Updated");
    }
コード例 #3
0
 public bool GetBoolPref(PreferenceKey Pref)
 {
     if (PlayerPrefs.HasKey(Pref.ToString()))
     {
         if (PlayerPrefs.GetInt(Pref.ToString()) == 1)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #4
0
        public static string GetValue(PreferenceKey key)
        {
            int keyIndex = (int)key;

            if (UserPreferences is null)
            {
                InitializePreferences();
            }

            if (UserPreferences.ContainsKey(keyIndex))
            {
                return(UserPreferences[keyIndex]);
            }
            else
            {
                return("");
            }
        }
コード例 #5
0
        public static bool LoadAndDeserializePreferences()
        {
            string prefsPath = GetPreferencesFilePath();

            if (!File.Exists(prefsPath))
            {
                return(false);
            }
            string[] iniRows = File.ReadAllText(prefsPath).Replace("\r", "").Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string iniRow in iniRows)
            {
                string[]      keyValue = iniRow.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries);
                PreferenceKey key      = (PreferenceKey)int.Parse(keyValue[0]);
                string        value    = Encoding.UTF8.GetString(BitUtility.BytesFromHex(keyValue[1]));
                SetValue(key, value, false);
            }
            return(true);
        }
コード例 #6
0
ファイル: App.cs プロジェクト: Arushacked/keepass2
        public bool GetBooleanPreference(PreferenceKey key)
        {
            Context            ctx   = Application.Context;
            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(ctx);

            switch (key)
            {
            case PreferenceKey.remember_keyfile:
                return(prefs.GetBoolean(ctx.Resources.GetString(Resource.String.keyfile_key), ctx.Resources.GetBoolean(Resource.Boolean.keyfile_default)));

            case PreferenceKey.UseFileTransactions:
                return(prefs.GetBoolean(ctx.Resources.GetString(Resource.String.UseFileTransactions_key), true));

            case PreferenceKey.CheckForFileChangesOnSave:
                return(prefs.GetBoolean(ctx.Resources.GetString(Resource.String.CheckForFileChangesOnSave_key), true));

            default:
                throw new Exception("unexpected key!");
            }
        }
コード例 #7
0
        public static void SetValue(PreferenceKey key, string newValue, bool save = true)
        {
            int keyIndex = (int)key;

            if (UserPreferences is null)
            {
                InitializePreferences();
            }

            if (UserPreferences.ContainsKey(keyIndex))
            {
                UserPreferences[keyIndex] = newValue;
            }
            else
            {
                UserPreferences.Add(keyIndex, newValue);
            }
            if (save)
            {
                SerializeAndSavePreferences();
            }
        }
コード例 #8
0
 public string GetStringPref(PreferenceKey Pref)
 {
     return(PlayerPrefs.GetString(Pref.ToString()));
 }
コード例 #9
0
 public void UpdateStringPref(PreferenceKey pref, string value)
 {
     PlayerPrefs.SetString(pref.ToString(), value);
 }
コード例 #10
0
 public float GetFloatPref(PreferenceKey Pref, float Default)
 {
     return(PlayerPrefs.GetFloat(Pref.ToString(), Default));
 }
コード例 #11
0
 public void UpdateFloatPref(PreferenceKey Pref, float value)
 {
     PlayerPrefs.SetFloat(Pref.ToString(), value);
 }
コード例 #12
0
 public void SetPreference(PreferenceKey key, bool value)
 {
     _preferences[key] = value;
 }
コード例 #13
0
ファイル: TestKp2aApp.cs プロジェクト: pythe/wristpass
 public void SetPreference(PreferenceKey key, bool value)
 {
     _preferences[key] = value;
 }
コード例 #14
0
 public void UpdateBoolpref(PreferenceKey Pref, bool value)
 {
     PlayerPrefs.SetInt(Pref.ToString(), (value ? 1 : 0));
 }
コード例 #15
0
    public object GetCustomPref(PreferenceKey key, Type t)
    {
        string json = PlayerPrefs.GetString(key.ToString());

        return(JsonUtility.FromJson(json, t));
    }
コード例 #16
0
ファイル: TestKp2aApp.cs プロジェクト: pythe/wristpass
 public bool GetBooleanPreference(PreferenceKey key)
 {
     if (_preferences.ContainsKey(key))
         return _preferences[key];
     return true;
 }
コード例 #17
0
 public void UpdateIntPref(PreferenceKey Pref, int value)
 {
     PlayerPrefs.SetInt(Pref.ToString(), value);
 }
コード例 #18
0
 public int GetIntPref(PreferenceKey Pref, int Default)
 {
     return(PlayerPrefs.GetInt(Pref.ToString(), Default));
 }
コード例 #19
0
 public UserPreferencesInput(PreferenceKey preferenceKey, string preferenceValue)
 {
     PreferenceKey = preferenceKey;
     PreferenceValue = preferenceValue;
 }