/// <summary> /// Create a value wrapper that can contain and bind values. The name need to be registred first /// </summary> /// <param name="prototypeLoader">a prototype loader (could be null)</param> /// <param name="prototype">a prototype that could contains this value (could be null)</param> /// <param name="name">the name of the type for this value wrapper</param> /// <param name="value">the string text for the value for this wrapper</param> /// <returns>a loaded value wrapper</returns> public IValueWrapper CreateValue(PrototypeLoader prototypeLoader, PrototypeBase prototype, string name, string value) { var type = PrototypeLoaderAccess.ParameterTypes[name]; if (type == null) { throw new KeyNotFoundException("Parameter type '" + name + "' is not registered"); } var parameter = (IValueWrapper)Activator.CreateInstance(type); parameter.Name = name; parameter.Value = PrototypeLoaderAccess.ParameterConverter[name].DynamicInvoke(prototypeLoader, prototype, value); parameter.Exists = true; return(parameter); }
/// <summary> /// Transform a value string to the target value using the registered conversion functions /// </summary> /// <param name="prototypeLoader">a prototype loader (could be null)</param> /// <param name="prototype">a prototype that could contains this value (could be null)</param> /// <param name="name">the name of the type</param> /// <param name="value">the string representation</param> /// <returns>converted value</returns> public object TransformValue(PrototypeLoader prototypeLoader, PrototypeBase prototype, string name, string value) { return(PrototypeLoaderAccess.ParameterConverter[name].DynamicInvoke(prototypeLoader, prototype, value)); }
public static void EffectBase(PrototypeLoader pl, PrototypeBase pb, AnimationEffect e, XmlNode node) { PrototypeLoader.EffectBase(pl, pb, e, node); }
public static void SetParameter(PrototypeLoader pl, string value, IValueWrapper target, PrototypeBase current, bool forceref = false, Delegate customConverter = null) { pl.SetParameter(value, target, current, forceref, customConverter); }