Show / Hide Table of Contents

Class ClassManager

A class used to associate string class names with custom types and a set of properties. It automatically adds properties specified by a base class to each of its subclasses.

Inheritance
object
ClassManager
UnityClassManager
UnrealClassManager
Implements
IClassManager
IPropertyManager
ITypeChanger<IGameObject>
IClassDataProvider
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Microsoft.XboxStudios.GameStateTracker.Generic
Assembly: GameStateTracker.Generic.dll
Syntax
public class ClassManager : IClassManager, IPropertyManager, ITypeChanger<IGameObject>, IClassDataProvider

Constructors

View Source

ClassManager(StringComparison, IEnumerable<IClassDataProvider>?)

Initializes a new instance of the ClassManager class.

Declaration
public ClassManager(StringComparison comparisonType = StringComparison.OrdinalIgnoreCase, IEnumerable<IClassDataProvider>? classDataProviders = null)
Parameters
Type Name Description
StringComparison comparisonType

The comparison type to use when comparing class names.

IEnumerable<IClassDataProvider> classDataProviders

One or more objects providing the names of game classes and properties for managed C# types. If null, the default providers DefaultClassDataProviders are used.

Properties

View Source

Classes

Gets the collection of known class names.

Declaration
public IReadOnlyCollection<string> Classes { get; }
Property Value
Type Description
IReadOnlyCollection<string>
View Source

ComparisonType

Gets the comparison type to use when comparing class names.

Declaration
protected StringComparison ComparisonType { get; }
Property Value
Type Description
StringComparison
View Source

DefaultClassDataProviders

Gets the default objects providing the names of game classes and properties for managed C# types.

Declaration
public static IEnumerable<IClassDataProvider> DefaultClassDataProviders { get; }
Property Value
Type Description
IEnumerable<IClassDataProvider>

Methods

View Source

AddProperties(string, Type, params string[])

Adds properties to retrieve for the given class name or pattern.

Declaration
public void AddProperties(string classPattern, Type type, params string[] propertyNames)
Parameters
Type Name Description
string classPattern

The game object class name, which may include wildcards with the '*' character.

Type type

The type to convert the game object to.

string[] propertyNames

The properties to retrieve.

View Source

GetBaseClassNames(TypeInfo)

Gets the base class names for game objects associated with the type.

Declaration
public virtual IEnumerable<string> GetBaseClassNames(TypeInfo typeInfo)
Parameters
Type Name Description
TypeInfo typeInfo

The type info.

Returns
Type Description
IEnumerable<string>

An enumerable of base class names.

View Source

GetProperties(TypeInfo)

Gets the properties to retrieve for the given type.

Declaration
public IEnumerable<string> GetProperties(TypeInfo typeInfo)
Parameters
Type Name Description
TypeInfo typeInfo

The game object type info.

Returns
Type Description
IEnumerable<string>

An enumeration of properties to retrieve.

View Source

GetProperties(string?)

Gets the properties to retrieve for the given class name.

Declaration
public IEnumerable<string> GetProperties(string? className)
Parameters
Type Name Description
string className

The game object class name.

Returns
Type Description
IEnumerable<string>

An enumeration of properties to retrieve.

View Source

GetType(IGameObject)

Gets the target type for converting an object.

Declaration
protected virtual Type? GetType(IGameObject gameObject)
Parameters
Type Name Description
IGameObject gameObject

The object.

Returns
Type Description
Type

The target type to convert to.

View Source

GetType(string?)

Gets the target type for converting an object given its class name.

Declaration
protected virtual Type? GetType(string? className)
Parameters
Type Name Description
string className

The class name.

Returns
Type Description
Type

The target type to convert to.

View Source

HasClass(string?)

Determines if the class manager knows about the given class.

Declaration
public bool HasClass(string? className)
Parameters
Type Name Description
string className

The class name.

Returns
Type Description
bool

Whether or not the class manager knows about the class.

View Source

ImportSubclasses<T>(Assembly?)

Imports each subclass of the given type from the given assembly, and adds properties specified by GameProperty attributes.

Declaration
public void ImportSubclasses<T>(Assembly? assembly = null)
Parameters
Type Name Description
Assembly assembly

The assembly to look for subclasses in. If null, the assembly the type is defined in.

Type Parameters
Name Description
T

The base class type.

View Source

IsAssignableFrom(IGameObject, string)

Determines if the object has a base class with the given name.

Declaration
public bool IsAssignableFrom(IGameObject input, string className)
Parameters
Type Name Description
IGameObject input

The game object.

string className

The class name.

Returns
Type Description
bool

True if the object is assignable from the given name.

View Source

MatchesPattern(string, string?)

Determines if the class name matches the given pattern.

Declaration
protected virtual bool MatchesPattern(string pattern, string? className)
Parameters
Type Name Description
string pattern

The pattern, using * as an optional wildcard at the end.

string className

The class name to compare against.

Returns
Type Description
bool

True if the class name matches the pattern.

View Source

SetBaseClass(string, string)

Sets the base class name for a subclass.

Declaration
public bool SetBaseClass(string className, string subclass)
Parameters
Type Name Description
string className

The base class name.

string subclass

The subclass name.

Returns
Type Description
bool

True if any subclasses were previously unknown.

View Source

TryConvert(IGameObject, out IGameObject)

Attempts to convert the input object to a more specific type.

Declaration
public bool TryConvert(IGameObject input, out IGameObject output)
Parameters
Type Name Description
IGameObject input

The object to convert.

IGameObject output

The output object.

Returns
Type Description
bool

True if the object was converted to more specific type.

Implements

IClassManager
IPropertyManager
ITypeChanger<T>
IClassDataProvider

Extension Methods

IClassDataProviderExtensions.GetBaseClassName(IClassDataProvider, Type)
IClassDataProviderExtensions.GetBaseClassNames(IClassDataProvider, Type)
IClassDataProviderExtensions.GetProperties(IClassDataProvider, Type)
IClassManagerExtensions.AddProperties<T>(IClassManager, params string[])
IClassManagerExtensions.SetBaseClass(IClassManager, string?, IEnumerable<IGameObject>)
IClassManagerExtensions.SetBaseClass(IClassManager, string, IEnumerable<string>)
IClassManagerExtensions.SetBaseClass<T>(IClassManager, params string[])
IPropertyManagerExtensions.GetProperties(IPropertyManager, IEnumerable<IGameObject>?)
IPropertyManagerExtensions.GetProperties(IPropertyManager, IEnumerable<string?>)
ITypeChangerExtensions.Convert<T>(ITypeChanger<T>, T)
  • View Source
In this article
Back to top Generated by DocFX