Class MyIniValue
Represents the value of a single configuration item.
Inheritance
System.Object
MyIniValue
Assembly: VRage.Game.dll
Syntax
public sealed class MyIniValue : ValueType
Constructors
MyIniValue(MyIniKey, String)
Declaration
public MyIniValue(MyIniKey key, string value)
Parameters
Type |
Name |
Description |
MyIniKey |
key |
|
System.String |
value |
|
Exceptions
Type |
Condition |
System.ArgumentException |
Configuration value cannot use an empty key
|
Fields
EMPTY
Declaration
public static readonly MyIniValue EMPTY
Field Value
Key
Gets the MyIniKey this value was retrieved from
Declaration
public readonly MyIniKey Key
Field Value
Properties
IsEmpty
Determines whether this value is empty. Be aware that an empty string is not considered to be an empty value.
Declaration
public bool IsEmpty { get; }
Property Value
Type |
Description |
System.Boolean |
|
Methods
GetLines(List<String>)
Retrieves each individual line of this value into the provided list.
Declaration
public void GetLines(List<string> lines)
Parameters
Type |
Name |
Description |
System.Collections.Generic.List<System.String> |
lines |
|
ToBoolean(Boolean)
Attempts to get this value as a System.Boolean. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public bool ToBoolean(bool defaultValue = false)
Parameters
Type |
Name |
Description |
System.Boolean |
defaultValue |
|
Returns
Type |
Description |
System.Boolean |
|
ToByte(Byte)
Attempts to get this value as a System.Byte. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public byte ToByte(byte defaultValue = 0)
Parameters
Type |
Name |
Description |
System.Byte |
defaultValue |
|
Returns
Type |
Description |
System.Byte |
|
ToChar(Char)
Attempts to get this value as a System.Char. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public char ToChar(char defaultValue = '\0')
Parameters
Type |
Name |
Description |
System.Char |
defaultValue |
|
Returns
Type |
Description |
System.Char |
|
ToDecimal(Decimal)
Attempts to get this value as a System.Decimal. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public Decimal ToDecimal(Decimal defaultValue)
Parameters
Type |
Name |
Description |
System.Decimal |
defaultValue |
|
Returns
Type |
Description |
System.Decimal |
|
ToDouble(Double)
Attempts to get this value as a System.Double. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public double ToDouble(double defaultValue = 0)
Parameters
Type |
Name |
Description |
System.Double |
defaultValue |
|
Returns
Type |
Description |
System.Double |
|
ToInt16(Int16)
Attempts to get this value as a System.Int16. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public short ToInt16(short defaultValue = 0)
Parameters
Type |
Name |
Description |
System.Int16 |
defaultValue |
|
Returns
Type |
Description |
System.Int16 |
|
ToInt32(Int32)
Attempts to get this value as a System.Int32. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public int ToInt32(int defaultValue = 0)
Parameters
Type |
Name |
Description |
System.Int32 |
defaultValue |
|
Returns
Type |
Description |
System.Int32 |
|
ToInt64(Int64)
Attempts to get this value as a System.Int64. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public long ToInt64(long defaultValue = 0L)
Parameters
Type |
Name |
Description |
System.Int64 |
defaultValue |
|
Returns
Type |
Description |
System.Int64 |
|
ToSByte(SByte)
Attempts to get this value as a System.SByte. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public sbyte ToSByte(sbyte defaultValue = 0)
Parameters
Type |
Name |
Description |
System.SByte |
defaultValue |
|
Returns
Type |
Description |
System.SByte |
|
ToSingle(Single)
Attempts to get this value as a System.Single. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public float ToSingle(float defaultValue = 0F)
Parameters
Type |
Name |
Description |
System.Single |
defaultValue |
|
Returns
Type |
Description |
System.Single |
|
ToString()
Attempts to get this value as a System.String. If the value is empty or cannot be understood as this data type, an empty string will be returned instead.
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
ToString(String)
Attempts to get this value as a System.String. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public string ToString(string defaultValue)
Parameters
Type |
Name |
Description |
System.String |
defaultValue |
|
Returns
Type |
Description |
System.String |
|
ToUInt16(UInt16)
Attempts to get this value as a System.UInt16. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public ushort ToUInt16(ushort defaultValue = 0)
Parameters
Type |
Name |
Description |
System.UInt16 |
defaultValue |
|
Returns
Type |
Description |
System.UInt16 |
|
ToUInt32(UInt32)
Attempts to get this value as a System.UInt32. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public uint ToUInt32(uint defaultValue = 0U)
Parameters
Type |
Name |
Description |
System.UInt32 |
defaultValue |
|
Returns
Type |
Description |
System.UInt32 |
|
ToUInt64(UInt64)
Attempts to get this value as a System.UInt64. If the value is empty or cannot be understood as this data type, the defaultValue will be returned instead.
Declaration
public ulong ToUInt64(ulong defaultValue = 0UL)
Parameters
Type |
Name |
Description |
System.UInt64 |
defaultValue |
|
Returns
Type |
Description |
System.UInt64 |
|
TryGetBoolean(out Boolean)
Attempts to get this value as a System.Boolean. Fills the value
on success.
Declaration
public bool TryGetBoolean(out bool value)
Parameters
Type |
Name |
Description |
System.Boolean |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetByte(out Byte)
Attempts to get this value as a System.Byte. Fills the value
on success.
Declaration
public bool TryGetByte(out byte value)
Parameters
Type |
Name |
Description |
System.Byte |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetChar(out Char)
Attempts to get this value as a System.Char. Fills the value
on success.
Declaration
public bool TryGetChar(out char value)
Parameters
Type |
Name |
Description |
System.Char |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetDecimal(out Decimal)
Attempts to get this value as a System.Decimal. Fills the value
on success.
Declaration
public bool TryGetDecimal(out Decimal value)
Parameters
Type |
Name |
Description |
System.Decimal |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetDouble(out Double)
Attempts to get this value as a System.Double. Fills the value
on success.
Declaration
public bool TryGetDouble(out double value)
Parameters
Type |
Name |
Description |
System.Double |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetInt16(out Int16)
Attempts to get this value as a System.Int16. Fills the value
on success.
Declaration
public bool TryGetInt16(out short value)
Parameters
Type |
Name |
Description |
System.Int16 |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetInt32(out Int32)
Attempts to get this value as a System.Int32. Fills the value
on success.
Declaration
public bool TryGetInt32(out int value)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetInt64(out Int64)
Attempts to get this value as a System.Int64. Fills the value
on success.
Declaration
public bool TryGetInt64(out long value)
Parameters
Type |
Name |
Description |
System.Int64 |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetSByte(out SByte)
Attempts to get this value as a System.SByte. Fills the value
on success.
Declaration
public bool TryGetSByte(out sbyte value)
Parameters
Type |
Name |
Description |
System.SByte |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetSingle(out Single)
Attempts to get this value as a System.Single. Fills the value
on success.
Declaration
public bool TryGetSingle(out float value)
Parameters
Type |
Name |
Description |
System.Single |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetString(out String)
Attempts to get this value as a System.String. Fills the value
on success.
Declaration
public bool TryGetString(out string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetUInt16(out UInt16)
Attempts to get this value as a System.UInt16. Fills the value
on success.
Declaration
public bool TryGetUInt16(out ushort value)
Parameters
Type |
Name |
Description |
System.UInt16 |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetUInt32(out UInt32)
Attempts to get this value as a System.UInt32. Fills the value
on success.
Declaration
public bool TryGetUInt32(out uint value)
Parameters
Type |
Name |
Description |
System.UInt32 |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
TryGetUInt64(out UInt64)
Attempts to get this value as a System.UInt64. Fills the value
on success.
Declaration
public bool TryGetUInt64(out ulong value)
Parameters
Type |
Name |
Description |
System.UInt64 |
value |
|
Returns
Type |
Description |
System.Boolean |
true if the value could be understood as this data type; false otherwise
|
Write(StringBuilder)
Writes this value as a string to the given string builder.
Declaration
public void Write(StringBuilder stringBuilder)
Parameters
Type |
Name |
Description |
System.Text.StringBuilder |
stringBuilder |
|