Exemplo n.º 1
0
        public static Dictionary <string, Dictionary <string, MelonPreference> > GetPreferences()
        {
            Dictionary <string, Dictionary <string, MelonPreference> > output = new Dictionary <string, Dictionary <string, MelonPreference> >();

            if (MelonPreferences.Categories.Count <= 0)
            {
                return(output);
            }
            foreach (MelonPreferences_Category category in MelonPreferences.Categories)
            {
                Dictionary <string, MelonPreference> newprefsdict = new Dictionary <string, MelonPreference>();
                foreach (MelonPreferences_Entry entry in category.Entries)
                {
                    Type reflectedType = entry.GetReflectedType();
                    if ((reflectedType != typeof(string)) &&
                        (reflectedType != typeof(bool)) &&
                        (reflectedType != typeof(int)) &&
                        (reflectedType != typeof(float)) &&
                        (reflectedType != typeof(double)) &&
                        (reflectedType != typeof(long)))
                    {
                        continue;
                    }
                    MelonPreference newpref = new MelonPreference(entry);
                    newprefsdict.Add(entry.Identifier, newpref);
                }
                output.Add(category.Identifier, newprefsdict);
            }
            return(output);
        }
Exemplo n.º 2
0
        public static Dictionary <string, Dictionary <string, PrefDesc> > GetPrefs()
        {
            Dictionary <string, Dictionary <string, PrefDesc> >        output = new Dictionary <string, Dictionary <string, PrefDesc> >();
            Dictionary <string, Dictionary <string, MelonPreference> > prefs  = GetPreferences();

            for (int i = 0; i < prefs.Values.Count; i++)
            {
                Dictionary <string, MelonPreference> prefsdict    = prefs.Values.ElementAt(i);
                Dictionary <string, PrefDesc>        newprefsdict = new Dictionary <string, PrefDesc>();
                for (int j = 0; j < prefsdict.Values.Count; j++)
                {
                    MelonPreference pref    = prefsdict.Values.ElementAt(j);
                    PrefDesc        newpref = new PrefDesc(pref);
                    newpref.ValueEdited = pref.ValueEdited;
                    newprefsdict.Add(prefsdict.Keys.ElementAt(j), newpref);
                }
                output.Add(prefs.Keys.ElementAt(i), newprefsdict);
            }
            return(output);
        }
        public static Dictionary <string, Dictionary <string, MelonPreference> > GetPreferences()
        {
            Dictionary <string, Dictionary <string, MelonPreference> > output = new Dictionary <string, Dictionary <string, MelonPreference> >();

            if (MelonPreferences.categorytbl.Count <= 0)
            {
                return(output);
            }
            foreach (MelonPreferences_Category category in MelonPreferences.categorytbl)
            {
                Dictionary <string, MelonPreference> newprefsdict = new Dictionary <string, MelonPreference>();
                foreach (MelonPreferences_Entry entry in category.prefstbl)
                {
                    MelonPreference newpref = null;
                    if (entry.Type == MelonPreferences_Entry.TypeEnum.STRING)
                    {
                        newpref = new MelonPreference(entry);
                    }
                    else if (entry.Type == MelonPreferences_Entry.TypeEnum.BOOL)
                    {
                        newpref = new MelonPreference(entry);
                    }
                    else if (entry.Type == MelonPreferences_Entry.TypeEnum.INT)
                    {
                        newpref = new MelonPreference(entry);
                    }
                    else if (entry.Type == MelonPreferences_Entry.TypeEnum.FLOAT)
                    {
                        newpref = new MelonPreference(entry);
                    }
                    if (newpref == null)
                    {
                        continue;
                    }
                    newprefsdict.Add(entry.Name, newpref);
                }
                output.Add(category.Name, newprefsdict);
            }
            return(output);
        }
Exemplo n.º 4
0
 public PrefDesc(MelonPreference pref) : base(pref)
 {
 }