mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
Formatting
This commit is contained in:
parent
43ea56fb29
commit
a6c80aaaab
@ -377,8 +377,7 @@ namespace XNode {
|
||||
public void OnAfterDeserialize() {
|
||||
this.Clear();
|
||||
|
||||
if (keys.Count != values.Count)
|
||||
{
|
||||
if (keys.Count != values.Count) {
|
||||
var msg = string.Format(
|
||||
XNodeRuntimeConstants.MISMATCHED_KEYS_TO_VALUES_EXCEPTION_MESSAGE,
|
||||
keys.Count,
|
||||
|
||||
@ -73,7 +73,7 @@ namespace XNode {
|
||||
foreach (NodePort listPort in dynamicListPorts) {
|
||||
// At this point we know that ports here are dynamic list ports
|
||||
// which have passed name/"backing port" checks, ergo we can proceed more safely.
|
||||
string backingPortName = listPort.fieldName.Split(' ')[0];
|
||||
string backingPortName = listPort.fieldName.Split(' ') [0];
|
||||
NodePort backingPort = staticPorts[backingPortName];
|
||||
|
||||
// Update port constraints. Creating a new port instead will break the editor, mandating the need for setters.
|
||||
@ -94,7 +94,7 @@ namespace XNode {
|
||||
return portValType.GetElementType();
|
||||
}
|
||||
if (portValType.IsGenericType && portValType.GetGenericTypeDefinition() == typeof(List<>)) {
|
||||
return portValType.GetGenericArguments()[0];
|
||||
return portValType.GetGenericArguments() [0];
|
||||
}
|
||||
return portValType;
|
||||
}
|
||||
@ -115,7 +115,7 @@ namespace XNode {
|
||||
Node.InputAttribute inputAttribute = x as Node.InputAttribute;
|
||||
Node.OutputAttribute outputAttribute = x as Node.OutputAttribute;
|
||||
return inputAttribute != null && inputAttribute.dynamicPortList ||
|
||||
outputAttribute != null && outputAttribute.dynamicPortList;
|
||||
outputAttribute != null && outputAttribute.dynamicPortList;
|
||||
});
|
||||
}
|
||||
|
||||
@ -127,12 +127,10 @@ namespace XNode {
|
||||
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
|
||||
// Loop through assemblies and add node types to list
|
||||
foreach (Assembly assembly in assemblies)
|
||||
{
|
||||
foreach (Assembly assembly in assemblies) {
|
||||
// Skip certain dlls to improve performance
|
||||
string assemblyName = assembly.GetName().Name;
|
||||
if (!XNodeRuntimeConstants.IGNORE_ASSEMBLY_PREFIXES.Any(x => assemblyName.StartsWith(x)))
|
||||
{
|
||||
if (!XNodeRuntimeConstants.IGNORE_ASSEMBLY_PREFIXES.Any(x => assemblyName.StartsWith(x))) {
|
||||
IEnumerable<Type> foundNodeTypes = assembly.GetTypes()
|
||||
.Where(t => !t.IsAbstract && baseType.IsAssignableFrom(t));
|
||||
nodeTypes.AddRange(foundNodeTypes);
|
||||
@ -194,8 +192,7 @@ namespace XNode {
|
||||
public void OnAfterDeserialize() {
|
||||
this.Clear();
|
||||
|
||||
if (keys.Count != values.Count)
|
||||
{
|
||||
if (keys.Count != values.Count) {
|
||||
var msg = string.Format(
|
||||
XNodeRuntimeConstants.MISMATCHED_KEYS_TO_VALUES_EXCEPTION_MESSAGE,
|
||||
keys.Count,
|
||||
|
||||
@ -1,22 +1,19 @@
|
||||
namespace XNode
|
||||
{
|
||||
namespace XNode {
|
||||
/// <summary>
|
||||
/// A helper class containing shared constants.
|
||||
/// </summary>
|
||||
public static class XNodeRuntimeConstants
|
||||
{
|
||||
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.";
|
||||
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 =
|
||||
{
|
||||
public static string[] IGNORE_ASSEMBLY_PREFIXES = {
|
||||
"ExCSS",
|
||||
"Microsoft",
|
||||
"Mono",
|
||||
@ -28,5 +25,5 @@ namespace XNode
|
||||
"UnityEditor",
|
||||
"UnityEngine"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user