1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-03-26 22:49:02 +08:00
xNode/Scripts/XNodeRuntimeConstants.cs
Jeff Campbell 86ef6510ef String format fix and simplified assembly skip
Fixed missing format arguments for exception

* Added missing string format arguments used for exception
* Moved duplicate exception message to XNodeRuntimeConstants class
* Modified NodeDataCache deserialization exception thrown to be the same format as Node

Simplified logic for discovering node types

* Simplified the reflection logic used to discover node types by creating a constant array of assembly prefixes to ignore and then checking to see if discovered assembly names begin with those prefixes, and if they do skip checking them for derived node types. Added additional common assembly prefixes that Unity loads into memory that would not contain Node types.
2020-02-26 09:56:48 +01:00

34 lines
917 B
C#

namespace XNode
{
/// <summary>
/// A helper class containing shared constants.
/// </summary>
public static class XNodeRuntimeConstants
{
// Exceptions
public const string MISMATCHED_KEYS_TO_VALUES_EXCEPTION_MESSAGE =
"There are {0} keys and {1} values after deserialization. " +
"Make sure that both key and value types are serializable.";
// Reflection
/// <summary>
/// A collection of assembly prefixes that should not be reflected for derived node types.
/// </summary>
public static string[] IGNORE_ASSEMBLY_PREFIXES =
{
"ExCSS",
"Microsoft",
"Mono",
"netstandard",
"mscorlib",
"nunit",
"SyntaxTree",
"System",
"Unity",
"UnityEditor",
"UnityEngine"
};
}
}