33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
|
using System.Collections.Generic;
|
||
|
namespace RecrownedGTK.Persistence {
|
||
|
public struct PreferencesInfo {
|
||
|
public PreferenceInfo[] preferences;
|
||
|
public void SetPreferences(Dictionary<string, string> preferences)
|
||
|
{
|
||
|
this.preferences = new PreferenceInfo[preferences.Count];
|
||
|
int pairIndex = 0;
|
||
|
foreach (KeyValuePair<string, string> item in preferences)
|
||
|
{
|
||
|
this.preferences[pairIndex] = new PreferenceInfo(item.Key, item.Value);
|
||
|
pairIndex++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Dictionary<string, string> GetPreferences() {
|
||
|
Dictionary<string, string> res = new Dictionary<string, string>();
|
||
|
for (int prefID = 0; prefID < preferences.Length; prefID++) {
|
||
|
res.Add(preferences[prefID].key, preferences[prefID].value);
|
||
|
}
|
||
|
return res;
|
||
|
}
|
||
|
|
||
|
public struct PreferenceInfo {
|
||
|
public string key, value;
|
||
|
|
||
|
public PreferenceInfo(string key, string value) {
|
||
|
this.key = key;
|
||
|
this.value = value;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|