Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Utility

Sinai edited this page Jan 31, 2022 · 4 revisions

UniverseLib has several general utility classes which live in the UniverseLib.Utility namespace.

ParseUtility

ParseUtility is a powerful parsing API for taking user input and parsing it into some common classes you would want to parse.

The main methods you will use are:

  • CanParse(Type) - returns true if ParseUtility is able to parse the provided type.
  • TryParse(string, type, out object, out Exception) - the only method you need to use to try to parse something.

SignatureHighlighter

SignatureHighlighter is a Unity rich-text signature highlighter, able to syntax-highlight Types, Methods, Properties and Fields.

  • Parse(Type, bool, MemberInfo) - the main method for parsing a Type, Namespace and optional MemberInfo.
  • HighlightMethod(MethodInfo) - a helper for highlighting a MethodInfo along with it's arguments and containing Type.
  • ParseGenericArgs(Type[], bool) - a helper to highlight an array of Types into a <T1, T2, ...> format.

ToStringUtility

ToStringUtility is mainly used by UnityExplorer for formatting an object's ToString value.

UnityHelpers

UnityHelpers contains an assortment of general Unity helper methods.

MiscUtility

MiscUtility contains some miscellaneous helper methods, for things which didn't fit in an existing category.

IOUtility

IOUtility contains a few IO-related helpers.

ArgumentUtility

ArgumentUtility is a small class for helping with some common argument operations (ie, Array.Empty, etc).