Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ InvokeXsltLateBoundFunction()

IList< XPathItem > System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction ( string name,
string namespaceUri,
IList< XPathItem >[] args )
inline

Definition at line 186 of file XmlQueryContext.cs.

187 {
188 object obj = ((_argList != null) ? _argList.GetExtensionObject(namespaceUri) : null);
189 if (obj == null)
190 {
191 throw new XslTransformException(System.SR.XmlIl_UnknownExtObj, namespaceUri);
192 }
193 if (_extFuncsLate == null)
194 {
195 _extFuncsLate = new XmlExtensionFunctionTable();
196 }
197 XmlExtensionFunction xmlExtensionFunction = _extFuncsLate.Bind(name, namespaceUri, args.Length, obj.GetType(), BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
198 object[] array = new object[args.Length];
199 for (int i = 0; i < args.Length; i++)
200 {
201 XmlQueryType xmlArgumentType = xmlExtensionFunction.GetXmlArgumentType(i);
202 switch (xmlArgumentType.TypeCode)
203 {
204 case XmlTypeCode.Boolean:
205 array[i] = XsltConvert.ToBoolean(args[i]);
206 break;
207 case XmlTypeCode.Double:
208 array[i] = XsltConvert.ToDouble(args[i]);
209 break;
210 case XmlTypeCode.String:
211 array[i] = XsltConvert.ToString(args[i]);
212 break;
213 case XmlTypeCode.Node:
214 if (xmlArgumentType.IsSingleton)
215 {
216 array[i] = XsltConvert.ToNode(args[i]);
217 }
218 else
219 {
220 array[i] = XsltConvert.ToNodeSet(args[i]);
221 }
222 break;
223 case XmlTypeCode.Item:
224 array[i] = args[i];
225 break;
226 }
227 Type clrArgumentType = xmlExtensionFunction.GetClrArgumentType(i);
228 if (xmlArgumentType.TypeCode == XmlTypeCode.Item || !clrArgumentType.IsAssignableFrom(array[i].GetType()))
229 {
231 }
232 }
233 object obj2 = xmlExtensionFunction.Invoke(obj, array);
234 if (obj2 == null && xmlExtensionFunction.ClrReturnType == XsltConvert.VoidType)
235 {
236 return XmlQueryNodeSequence.Empty;
237 }
238 return (IList<XPathItem>)_runtime.ChangeTypeXsltResult(XmlQueryTypeFactory.ItemS, obj2);
239 }
static string XmlIl_UnknownExtObj
Definition SR.cs:2046
Definition SR.cs:7
XmlExtensionFunction Bind(string name, string namespaceUri, int numArgs, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods|DynamicallyAccessedMemberTypes.NonPublicMethods)] Type objectType, BindingFlags flags)
XmlExtensionFunctionTable _extFuncsLate
object ChangeTypeXsltResult(int indexType, object value)
object ChangeTypeXsltArgument(int indexType, object value, Type destinationType)
object? GetExtensionObject(string namespaceUri)

References System.Xml.Xsl.Runtime.XmlQueryContext._argList, System.Xml.Xsl.Runtime.XmlQueryContext._extFuncsLate, System.Xml.Xsl.Runtime.XmlQueryContext._runtime, System.array, System.Xml.Xsl.Runtime.XmlExtensionFunctionTable.Bind(), System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(), System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltResult(), System.Xml.Xsl.Runtime.XmlQueryNodeSequence.Empty, System.Xml.Xsl.XsltArgumentList.GetExtensionObject(), System.Xml.Xsl.XmlQueryTypeFactory.ItemS, System.obj, System.Xml.Xsl.Runtime.XsltConvert.ToBoolean(), System.Xml.Xsl.Runtime.XsltConvert.ToDouble(), System.Xml.Xsl.Runtime.XsltConvert.ToNode(), System.Xml.Xsl.Runtime.XsltConvert.ToNodeSet(), System.Xml.Xsl.Runtime.XsltConvert.ToString(), System.Xml.Xsl.Runtime.XsltConvert.VoidType, and System.SR.XmlIl_UnknownExtObj.