public bool Equals(SerializableSystemType _Object) { if (_Object == null) { return(false); } return(SystemType.Equals(_Object.SystemType)); }
public SerializableArgument(object argument, Type parameterType, string parameterName) { this.parameterType = parameterType; this.parameterName = parameterName; argumentType = argument == null ? parameterType : argument.GetType(); SetArgumentValue(argument); }
public override bool Equals(Object obj) { SerializableSystemType temp = obj as SerializableSystemType; if (temp == null) { return(false); } return(Equals(temp)); }
public SerializableMethod(MethodInfo method) { methodInfo = method; methodName = method.Name; containingType = method.DeclaringType; isGeneric = method.IsGenericMethod; ExtractParameters(method, isGeneric, out parameterTypes, out parameterNames); bindingFlags = (method.IsPublic ? BindingFlags.Public : BindingFlags.NonPublic) | (method.IsStatic ? BindingFlags.Static : BindingFlags.Instance); }
/// <summary> /// Set the value of the serialized argument. /// Note that this runs the serialization process, so it is not fast. /// </summary> /// <param name="argument">Argument to set</param> /// <exception cref="ArgumentException">If the argument is not assignable to the parameter type</exception> public void SetArgumentValue(object argument) { if (parameterType.SystemType.IsValueType) { if (argument == null) { throw new ArgumentException("Trying to set null as parameter value for a SerializeableParameter, but the parameter's type is the " + "value type " + parameterType.Name + "!"); } if (argument.GetType() != parameterType.SystemType) { throw new ArgumentException("Trying to assign " + argument + " of value type " + argument.GetType() + " to a SerializeableParameter that expects a value" + "of value type " + parameterType.Name); } } else { if (argument != null && !parameterType.SystemType.IsInstanceOfType(argument)) { throw new ArgumentException("Trying to assign " + argument + " of type " + argument.GetType().Name + " to SerializeableParameter expecting type " + parameterType.Name + ", which is not valid! Use the type or a subtype"); } } if (argument == null) { argumentType = parameterType; } else { argumentType = argument.GetType(); } argumentValue = argument; isUnityObject = argument is Object; if (isUnityObject) { paramAsJson = ""; objectArgument = argument as UnityEngine.Object; } else { if (objectArgument != null) { if (Application.isPlaying) { Object.Destroy(objectArgument); } else { Object.DestroyImmediate(objectArgument); } } objectArgument = null; fsData data; _serializer.TrySerialize(argumentType, argument, out data).AssertSuccess(); paramAsJson = fsJsonPrinter.CompressedJson(data); } }
public SerializableFieldSetter(FieldInfo field) { containingType = field.DeclaringType; fieldType = field.FieldType; fieldName = field.Name; }