Table of Contents

Class EnumHandler

Namespace
Nautilus.Handlers
Assembly
Nautilus.dll
Class responsible to resolve anything related to adding custom enum objects.
public static class EnumHandler
Inheritance
EnumHandler
Inherited Members

Methods

AddEntry<TEnum>(string)

Adds a new custom enum object instance.
public static EnumBuilder<TEnum> AddEntry<TEnum>(string name) where TEnum : Enum

Parameters

name string
The name for this instance. Must be unique and not contain any special characters.

Returns

EnumBuilder<TEnum>
A reference to the created custom enum object or if the name is already in use it will return null.

Type Parameters

TEnum
Type of the enum to add an entry for.

AddEntry<TEnum>(string, Assembly)

Adds a new custom enum object instance.
public static EnumBuilder<TEnum> AddEntry<TEnum>(string name, Assembly ownerAssembly) where TEnum : Enum

Parameters

name string
The name for this instance. Must be unique and not contain any special characters.
ownerAssembly Assembly
The owner of this TechType instance.

Returns

EnumBuilder<TEnum>
A reference to the created custom enum object or if the name is already in use it will return null

Type Parameters

TEnum
Type of the enum to add an entry for.

ModdedEnumExists<TEnum>(string)

Safely looks for a custom enum object from another mod.
public static bool ModdedEnumExists<TEnum>(string name) where TEnum : Enum

Parameters

name string
The name of the custom enum object.

Returns

bool
true if the object was found; otherwise false.

Type Parameters

TEnum
Type of the enum to search for.

TryAddEntry<TEnum>(string, out EnumBuilder<TEnum>)

Adds a new custom enum object instance.
public static bool TryAddEntry<TEnum>(string name, out EnumBuilder<TEnum> builder) where TEnum : Enum

Parameters

name string
The name for this instance. Must be unique and not contain any special characters.
builder EnumBuilder<TEnum>
The reference to the created custom enum object.

Returns

bool
trueif successful; otherwise, false.

Type Parameters

TEnum
Type of the enum to add an entry for.

TryAddEntry<TEnum>(string, Assembly, out EnumBuilder<TEnum>)

Adds a new custom enum object instance.
public static bool TryAddEntry<TEnum>(string name, Assembly ownerAssembly, out EnumBuilder<TEnum> builder) where TEnum : Enum

Parameters

name string
The name for this instance. Must be unique and not contain any special characters.
ownerAssembly Assembly
The owner of this TechType instance.
builder EnumBuilder<TEnum>
The reference to the created custom enum object.

Returns

bool
trueif successful otherwise; false.

Type Parameters

TEnum
Type of the enum to add an entry for.

TryGetOwnerAssembly<TEnum>(TEnum, out Assembly)

Safely looks for a custom enum object from another mod and outputs the instance when found.
public static bool TryGetOwnerAssembly<TEnum>(TEnum modEnumValue, out Assembly addedBy) where TEnum : Enum

Parameters

modEnumValue TEnum
The custom enum object value.
addedBy Assembly
The Assembly that added the Enum value.

Returns

bool
true if the Assembly was found; otherwise false.

Type Parameters

TEnum
Type of the enum to search for.

Remarks

Make sure to set a [BepInDependency("otherModGUID", BepInDependency.DependencyFlags.SoftDependency)] on your plugin to ensure theirs loads first.

TryGetValue<TEnum>(string, out TEnum)

Safely looks for a custom enum object from another mod and outputs the instance when found.
public static bool TryGetValue<TEnum>(string name, out TEnum enumValue) where TEnum : Enum

Parameters

name string
The name of the custom enum object.
enumValue TEnum
The custom enum object value.

Returns

bool
true if the object was found; otherwise, false.

Type Parameters

TEnum
Type of the enum to search for.

Remarks

Make sure to set a [BepInDependency("otherModGUID", BepInDependency.DependencyFlags.SoftDependency)] on your plugin to ensure theirs loads first.

TryGetValue<TEnum>(string, out TEnum, out Assembly)

Safely looks for a custom enum object from another mod and outputs the instance when found.
public static bool TryGetValue<TEnum>(string name, out TEnum enumValue, out Assembly addedBy) where TEnum : Enum

Parameters

name string
The name of the custom enum object.
enumValue TEnum
The custom enum object value.
addedBy Assembly
The Assembly that added the Enum value.

Returns

bool
true if the object was found; otherwise false.

Type Parameters

TEnum
Type of the enum to search for.

Remarks

Make sure to set a [BepInDependency("otherModGUID", BepInDependency.DependencyFlags.SoftDependency)] on your plugin to ensure theirs loads first.