本文整理汇总了C#中Rhino.Context.GetApplicationClassLoader方法的典型用法代码示例。如果您正苦于以下问题:C# Context.GetApplicationClassLoader方法的具体用法?C# Context.GetApplicationClassLoader怎么用?C# Context.GetApplicationClassLoader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino.Context
的用法示例。
在下文中一共展示了Context.GetApplicationClassLoader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public static void Init(Context cx, Scriptable scope, bool @sealed)
{
ClassLoader loader = cx.GetApplicationClassLoader();
Rhino.NativeJavaTopPackage top = new Rhino.NativeJavaTopPackage(loader);
top.SetPrototype(GetObjectPrototype(scope));
top.SetParentScope(scope);
for (int i = 0; i != commonPackages.Length; i++)
{
NativeJavaPackage parent = top;
for (int j = 0; j != commonPackages[i].Length; j++)
{
parent = parent.ForcePackage(commonPackages[i][j], scope);
}
}
// getClass implementation
IdFunctionObject getClass = new IdFunctionObject(top, FTAG, Id_getClass, "getClass", 1, scope);
// We want to get a real alias, and not a distinct JavaPackage
// with the same packageName, so that we share classes and top
// that are underneath.
string[] topNames = ScriptRuntime.GetTopPackageNames();
NativeJavaPackage[] topPackages = new NativeJavaPackage[topNames.Length];
for (int i_1 = 0; i_1 < topNames.Length; i_1++)
{
topPackages[i_1] = (NativeJavaPackage)top.Get(topNames[i_1], top);
}
// It's safe to downcast here since initStandardObjects takes
// a ScriptableObject.
ScriptableObject global = (ScriptableObject)scope;
if (@sealed)
{
getClass.SealObject();
}
getClass.ExportAsScopeProperty();
global.DefineProperty("Packages", top, ScriptableObject.DONTENUM);
for (int i_2 = 0; i_2 < topNames.Length; i_2++)
{
global.DefineProperty(topNames[i_2], topPackages[i_2], ScriptableObject.DONTENUM);
}
}