Show / Hide Table of Contents

# Class ModPrefs

Allows to get and set preferences for your mod.

##### Inheritance

Object
ModPrefs

##### Implements

IModPrefs

##### Inherited Members

Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()

###### Namespace: IPA.Config

###### Assembly: IPA.Loader.dll

##### Syntax

    [Obsolete("Uses IniFile, which uses 16 bit system calls. Use BS Utils INI system for now.")]
    public class ModPrefs : IModPrefs

### Constructors

| Improve this Doc View Source

#### ModPrefs(PluginLoader.PluginMetadata)

Constructs a ModPrefs object for the provide plugin.

##### Declaration

    public ModPrefs(PluginLoader.PluginMetadata plugin)

##### Parameters

Type | Name | Description
--- | --- | ---
PluginLoader.PluginMetadata | plugin | the plugin to get the preferences file for

### Methods

| Improve this Doc View Source

#### GetBool(String, String, Boolean, Boolean)

Gets a bool from the ini.

##### Declaration

    public static bool GetBool(string section, string name, bool defaultValue = false, bool autoSave = false)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section | Section of the key.
String | name | Name of the key.
Boolean | defaultValue | Value that should be used when no value is found.
Boolean | autoSave | Whether or not the default value should be written if no value is found.

##### Returns

Type | Description
--- | ---
Boolean |

| Improve this Doc View Source

#### GetFloat(String, String, Single, Boolean)

Gets a float from the ini.

##### Declaration

    public static float GetFloat(string section, string name, float defaultValue = 0F, bool autoSave = false)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section | Section of the key.
String | name | Name of the key.
Single | defaultValue | Value that should be used when no value is found.
Boolean | autoSave | Whether or not the default value should be written if no value is found.

##### Returns

Type | Description
--- | ---
Single |

| Improve this Doc View Source

#### GetInt(String, String, Int32, Boolean)

Gets an int from the ini.

##### Declaration

    public static int GetInt(string section, string name, int defaultValue = 0, bool autoSave = false)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section | Section of the key.
String | name | Name of the key.
Int32 | defaultValue | Value that should be used when no value is found.
Boolean | autoSave | Whether or not the default value should be written if no value is found.

##### Returns

Type | Description
--- | ---
Int32 |

| Improve this Doc View Source

#### GetString(String, String, String, Boolean)

Gets a string from the ini.

##### Declaration

    public static string GetString(string section, string name, string defaultValue = "", bool autoSave = false)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section | Section of the key.
String | name | Name of the key.
String | defaultValue | Value that should be used when no value is found.
Boolean | autoSave | Whether or not the default value should be written if no value is found.

##### Returns

Type | Description
--- | ---
String |

| Improve this Doc View Source

#### HasKey(String, String)

Checks whether or not a key exists in the ini.

##### Declaration

    public static bool HasKey(string section, string name)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section | Section of the key.
String | name | Name of the key.

##### Returns

Type | Description
--- | ---
Boolean |

| Improve this Doc View Source

#### SetBool(String, String, Boolean)

Sets a bool in the ini.

##### Declaration

    public static void SetBool(string section, string name, bool value)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section | Section of the key.
String | name | Name of the key.
Boolean | value | Value that should be written.

| Improve this Doc View Source

#### SetFloat(String, String, Single)

Sets a float in the ini.

##### Declaration

    public static void SetFloat(string section, string name, float value)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section | Section of the key.
String | name | Name of the key.
Single | value | Value that should be written.

| Improve this Doc View Source

#### SetInt(String, String, Int32)

Sets an int in the ini.

##### Declaration

    public static void SetInt(string section, string name, int value)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section | Section of the key.
String | name | Name of the key.
Int32 | value | Value that should be written.

| Improve this Doc View Source

#### SetString(String, String, String)

Sets a string in the ini.

##### Declaration

    public static void SetString(string section, string name, string value)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section | Section of the key.
String | name | Name of the key.
String | value | Value that should be written.

### Explicit Interface Implementations

| Improve this Doc View Source

#### IModPrefs.GetBool(String, String, Boolean, Boolean)

##### Declaration

    bool IModPrefs.GetBool(string section, string name, bool defaultValue, bool autoSave)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section |
String | name |
Boolean | defaultValue |
Boolean | autoSave |

##### Returns

Type | Description
--- | ---
Boolean |

| Improve this Doc View Source

#### IModPrefs.GetFloat(String, String, Single, Boolean)

##### Declaration

    float IModPrefs.GetFloat(string section, string name, float defaultValue, bool autoSave)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section |
String | name |
Single | defaultValue |
Boolean | autoSave |

##### Returns

Type | Description
--- | ---
Single |

| Improve this Doc View Source

#### IModPrefs.GetInt(String, String, Int32, Boolean)

##### Declaration

    int IModPrefs.GetInt(string section, string name, int defaultValue, bool autoSave)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section |
String | name |
Int32 | defaultValue |
Boolean | autoSave |

##### Returns

Type | Description
--- | ---
Int32 |

| Improve this Doc View Source

#### IModPrefs.GetString(String, String, String, Boolean)

##### Declaration

    string IModPrefs.GetString(string section, string name, string defaultValue, bool autoSave)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section |
String | name |
String | defaultValue |
Boolean | autoSave |

##### Returns

Type | Description
--- | ---
String |

| Improve this Doc View Source

#### IModPrefs.HasKey(String, String)

##### Declaration

    bool IModPrefs.HasKey(string section, string name)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section |
String | name |

##### Returns

Type | Description
--- | ---
Boolean |

| Improve this Doc View Source

#### IModPrefs.SetBool(String, String, Boolean)

##### Declaration

    void IModPrefs.SetBool(string section, string name, bool value)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section |
String | name |
Boolean | value |

| Improve this Doc View Source

#### IModPrefs.SetFloat(String, String, Single)

##### Declaration

    void IModPrefs.SetFloat(string section, string name, float value)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section |
String | name |
Single | value |

| Improve this Doc View Source

#### IModPrefs.SetInt(String, String, Int32)

##### Declaration

    void IModPrefs.SetInt(string section, string name, int value)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section |
String | name |
Int32 | value |

| Improve this Doc View Source

#### IModPrefs.SetString(String, String, String)

##### Declaration

    void IModPrefs.SetString(string section, string name, string value)

##### Parameters

Type | Name | Description
--- | --- | ---
String | section |
String | name |
String | value |

### Implements

IModPrefs

### Extension Methods

ReflectionUtil.SetPrivateField(Object, String, Object)
ReflectionUtil.GetPrivateField<T>(Object, String)
ReflectionUtil.SetPrivateProperty(Object, String, Object)
ReflectionUtil.InvokePrivateMethod(Object, String, Object[])
ReflectionUtil.InvokePrivateMethod<T>(Object, String, Object[])