Table of Contents

Struct IConfig

Namespace
SampSharp.OpenMp.Core.Api
Assembly
SampSharp.OpenMp.Core.dll

This type represents a pointer to an unmanaged open.mp IConfig interface.

[OpenMpApi(new Type[] { typeof(IExtensible) })]
public readonly struct IConfig : IEquatable<IConfig>, IConfig.IManagedInterface, IExtensible.IManagedInterface, IUnmanagedInterface
Implements
Inherited Members

Constructors

IConfig(nint)

Initializes a new instance of the IConfig struct.

public IConfig(nint handle)

Parameters

handle nint

A pointer to the unmanaged interface.

Properties

Handle

Gets the handle to the unmanaged interface instance.

public nint Handle { get; }

Property Value

nint

HasValue

Gets a value indicating whether the pointer has a value.

public bool HasValue { get; }

Property Value

bool

Methods

AddBan(BanEntry)

Adds a ban.

public void AddBan(BanEntry entry)

Parameters

entry BanEntry

The ban entry to add.

AddExtension<T>(T)

Adds the specified managed extension to this extensible.

public void AddExtension<T>(T extension) where T : Extension

Parameters

extension T

An instance of the extension to add. The extension will be disposed if the extension could not be added to this extensible.

Type Parameters

T

The type of the managed extension.

Remarks

A managed extension can only be added to one extensible.

Exceptions

ArgumentException

Throw when an instance of the extension type was already added to this extensible.

ClearBans()

Clears all bans.

public void ClearBans()

Equals(IConfig)

public bool Equals(IConfig other)

Parameters

other IConfig

Returns

bool

Equals(object?)

public override bool Equals(object? other)

Parameters

other object

Returns

bool

GetBan(Size)

Gets the ban at the specified index.

public BanEntry? GetBan(Size index)

Parameters

index Size

The index of the ban.

Returns

BanEntry

The ban entry.

GetBansCount()

Gets the number of bans.

public Size GetBansCount()

Returns

Size

The number of bans.

GetBool(string)

Get a variable as a boolean.

public BlittableRef<bool> GetBool(string key)

Parameters

key string

The key of the variable.

Returns

BlittableRef<bool>

A pointer to the value.

GetExtension(UID)

Gets the extension with the specified id.

public IExtension GetExtension(UID id)

Parameters

id UID

The identifier of the extension type.

Returns

IExtension

The extension or null if the extension could not be found.

GetExtension<T>()

Gets the specified managed extension from this extensible.

public T GetExtension<T>() where T : Extension

Returns

T

An instance of the extension with type T.

Type Parameters

T

The type of the managed extension.

Exceptions

ArgumentException

Thrown if the extension could not be found.

GetFloat(string)

Get a variable as a float.

public BlittableRef<float> GetFloat(string key)

Parameters

key string

The key of the variable.

Returns

BlittableRef<float>

A pointer to the value.

GetHashCode()

public override int GetHashCode()

Returns

int

GetInt(string)

Get a variable as an integer.

public BlittableRef<int> GetInt(string key)

Parameters

key string

The key of the variable.

Returns

BlittableRef<int>

A pointer to the value.

GetNameFromAlias(string)

Get an option name from an alias if available.

public (bool, string?) GetNameFromAlias(string alias)

Parameters

alias string

The alias to find.

Returns

(bool, string)

A pair of bool which is true if the alias is deprecated and a string with the real config name.

GetOptions()

Gets all available options and their type.

public IReadOnlyDictionary<string, ConfigOptionType> GetOptions()

Returns

IReadOnlyDictionary<string, ConfigOptionType>

GetString(string)

Get a variable as a string.

public string? GetString(string key)

Parameters

key string

The key of the variable.

Returns

string

The value of the variable or null if not found.

GetStrings(string)

Gets a list of strings.

public string?[] GetStrings(string key)

Parameters

key string

The key of the variable.

Returns

string[]

An array containing the string values.

GetValueType(string)

Gets the type of a variable.

[OpenMpApiFunction("getType")]
public ConfigOptionType GetValueType(string key)

Parameters

key string

The key of the variable.

Returns

ConfigOptionType

tHE type of the variable.

IsBanned(BanEntry)

Checks if a ban entry is banned.

public bool IsBanned(BanEntry entry)

Parameters

entry BanEntry

The ban entry to check.

Returns

bool

true if the entry is banned; otherwise, false.

QueryExtension<T>()

Gets the specified unmanaged extension from this extensible.

public T QueryExtension<T>() where T : unmanaged, IExtension.IManagedInterface

Returns

T

The unmanaged extension or null if the extension could not be found.

Type Parameters

T

The type of the unmanaged extension.

ReloadBans()

Reloads the bans.

public void ReloadBans()

RemoveBan(BanEntry)

Removes a ban.

public void RemoveBan(BanEntry entry)

Parameters

entry BanEntry

The ban entry to remove.

RemoveBan(Size)

Removes a ban.

[OpenMpApiOverload("_index")]
public void RemoveBan(Size index)

Parameters

index Size

The index of the ban to remove.

RemoveExtension(IExtension)

Removes the specified extension from this extensible.

public void RemoveExtension(IExtension extension)

Parameters

extension IExtension

The extension to remove.

Exceptions

ArgumentException

Thrown if the extension could not be found.

RemoveExtension(UID)

Removes the extension with the specified id from this extensible.

public void RemoveExtension(UID id)

Parameters

id UID

The identifier of the extension.

Exceptions

ArgumentException

Thrown if the extension could not be found.

RemoveExtension<T>(T)

Removes the specified managed extension from this extensible.

public void RemoveExtension<T>(T extension) where T : Extension

Parameters

extension T

The managed extension to remove.

Type Parameters

T

The type of the managed extension.

Exceptions

ArgumentException

Thrown if the extension could not be found.

TryGetExtension<T>()

Tries to get the specified managed extension from this extensible.

public T? TryGetExtension<T>() where T : Extension

Returns

T

An instance of the extension with type T or null if no extension with the specified type could be found.

Type Parameters

T

The type of the managed extension.

TryQueryExtension<T>(out T)

Tries to get the specified unmanaged extension from this extensible.

public bool TryQueryExtension<T>(out T extension) where T : unmanaged, IExtension.IManagedInterface

Parameters

extension T

The extension if found, otherwise null.

Returns

bool

true if the extension was found; false otherwise.

Type Parameters

T

The type of the unmanaged extension.

WriteBans()

Writes the bans to the file.

public void WriteBans()

Operators

operator ==(IConfig, object?)

Determines whether the specified values are equal.

public static bool operator ==(IConfig lhs, object? rhs)

Parameters

lhs IConfig

The value on the left side of the operator.

rhs object

The value on the right side of the operator.

Returns

bool

true if the values are equal; otherwise, false.

explicit operator IExtensible(IConfig)

Casts the IConfig to a IExtensible.

public static explicit operator IExtensible(IConfig value)

Parameters

value IConfig

The IConfig to cast.

Returns

IExtensible

The converted IExtensible.

explicit operator IConfig(IExtensible)

Casts the IExtensible to a IConfig.

public static explicit operator IConfig(IExtensible value)

Parameters

value IExtensible

The IExtensible to cast.

Returns

IConfig

The converted IConfig.

operator !=(IConfig, object?)

Determines whether the specified values are not equal.

public static bool operator !=(IConfig lhs, object? rhs)

Parameters

lhs IConfig

The value on the left side of the operator.

rhs object

The value on the right side of the operator.

Returns

bool

true if the values are not equal; otherwise, false.