GH_SettingsServer

References
public sealed class GH_SettingsServer : GH_ISerializable
A single instance of this class is maintained at module level under the accessor "Settings".

Constructors

GH_SettingsServer

#
public GH_SettingsServer(string databaseName, bool loadSettings)
Create a new instance of the GH_SettingsServer class. The server will be associated with a settings xml file in the %ApplicationData%\Grasshopper\ directory.
databaseName (string)The name of the settings server (equals the name of the xml file so it must adhere to FAT, FAT32 and NTFS naming conventions).
loadSettings (bool)When true and a file with the same name already exists, its settings will be automatically loaded.

GH_SettingsServer

#
public GH_SettingsServer(string databaseName)
Create a new instance of the GH_SettingsServer class. The server will be associated with a settings xml file in the %ApplicationData%\Grasshopper\ directory. If a file with the same name already exists, its settings will be automatically loaded.
databaseName (string)The name of the settings server (equals the name of the xml file so it must adhere to FAT, FAT32 and NTFS naming conventions).

Properties

Count

#
public int Count { get; }
Gets the total number of settings stored in this database.

DatabaseName

#
public string DatabaseName { get; }
Gets the name of this settings database.

Methods

Clear

#
public void Clear()
Destroy all settings.

ConstainsEntry

#
public bool ConstainsEntry(string name)
Tests to see if a given entry is stored in this settings database.
name (string)Entry name to query.
True if the entry exists, false otherwise.

DeleteValue

#
public void DeleteValue(string key)
key (string)

EntryNames

#
public List<string> EntryNames()
Gets a list of all the entry names in this settings.

EntryType

#
public GH_SettingsType EntryType(string name)
Gets the type of a specific entry.
name (string)Name of entry.
Type of entry. If entry doesn't exist, GH_SettingsType._unknown is returned.

GetValue

#
public bool GetValue(string key, bool default)
key (string)
default (bool)

GetValue

#
public byte GetValue(string key, byte default)
key (string)
default (byte)

GetValue

#
public Color GetValue(string key, Color default)
key (string)
default (Color)

GetValue

#
public DateTime GetValue(string key, DateTime default)
key (string)
default (DateTime)

GetValue

#
public double GetValue(string key, double default)
key (string)
default (double)

GetValue

#
public int GetValue(string key, int default)
key (string)
default (int)

GetValue

#
public Point GetValue(string key, Point default)
key (string)
default (Point)

GetValue

#
public Rectangle GetValue(string key, Rectangle default)
key (string)
default (Rectangle)

GetValue

#
public Size GetValue(string key, Size default)
key (string)
default (Size)

GetValue

#
public string GetValue(string key, string default)
key (string)
default (string)

Read

#
public bool Read(GH_IReader reader)
Low-level deserializer.
reader (GH_IReader)Object to read from.
True on success, false on failure.
Read

SetValue

#
public void SetValue(string key, bool value)
key (string)
value (bool)

SetValue

#
public void SetValue(string key, byte value)
key (string)
value (byte)

SetValue

#
public void SetValue(string key, Color value)
key (string)
value (Color)

SetValue

#
public void SetValue(string key, DateTime value)
key (string)
value (DateTime)

SetValue

#
public void SetValue(string key, double value)
key (string)
value (double)

SetValue

#
public void SetValue(string key, int value)
key (string)
value (int)

SetValue

#
public void SetValue(string key, Point value)
key (string)
value (Point)

SetValue

#
public void SetValue(string key, Rectangle value)
key (string)
value (Rectangle)

SetValue

#
public void SetValue(string key, Size value)
key (string)
value (Size)

SetValue

#
public void SetValue(string key, string value)
key (string)
value (string)

SetValue

#
public void SetValue(string key)
key (string)

Write

#
public bool Write(GH_IWriter writer)
Low-level serializer.
writer (GH_IWriter)Object to write with. Writer must represent an empty archive chunk.
True on success, false on failure.
Write

WritePersistentSettings

#
public void WritePersistentSettings()
Store all settings in the xml file now. You must call this function if you want the current settings to persist between sessions.