Esempio n. 1
0
 internal static bool OverrideSettingsWithID(SettingsBase settings, string ID)
 {
     if (AllSettingsDict.ContainsKey(ID))
     {
         AllSettingsDict[ID] = settings;
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
 /// <summary>
 /// Retrieves the Settings instance from the SettingsDatabase with the given ID.
 /// </summary>
 /// <param name="uniqueID">The ID for the settings instance.</param>
 /// <returns>Returns the settings instance with the given ID. Returns null if nothing can be found.</returns>
 public static ISerialisableFile GetSettings(string uniqueID)
 {
     if (AllSettingsDict.ContainsKey(uniqueID))
     {
         return(AllSettingsDict[uniqueID]);
     }
     else
     {
         return(null);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Retrieves the Settings instance from the SettingsDatabase with the given ID.
 /// </summary>
 /// <param name="uniqueID">The ID for the settings instance.</param>
 /// <returns>Returns the settings instance with the given ID. Returns null if nothing can be found.</returns>
 internal static SettingsBase GetSettings(string uniqueID)
 {
     if (AllSettingsDict.ContainsKey(uniqueID))
     {
         return(AllSettingsDict[uniqueID]);
     }
     else
     {
         return(null);
     }
 }
 public static bool RegisterSettings(SettingsBase settingsClass, string uniqueID)
 {
     if (!AllSettingsDict.ContainsKey(uniqueID))
     {
         AllSettingsDict.Add(uniqueID, settingsClass);
         _modSettingsVMs = null;
         return(true);
     }
     else
     {
         //TODO:: When debugging log is finished, show a message saying that the key already exists
         return(false);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Registers the settings class with the SettingsDatabase for use in the settings menu.
 /// </summary>
 /// <param name="settings">Intance of the settings object to be registered with the SettingsDatabase.</param>
 /// <returns>Returns true if successful. Returns false if the object's ID key is already present in the SettingsDatabase.</returns>
 public static bool RegisterSettings(SettingsBase settings)
 {
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     if (!AllSettingsDict.ContainsKey(settings.ID))
     {
         AllSettingsDict.Add(settings.ID, settings);
         _modSettingsVMs = null;
         return(true);
     }
     else
     {
         //TODO:: When debugging log is finished, show a message saying that the key already exists
         return(false);
     }
 }