本文整理汇总了C#中ResourceManager.initialize方法的典型用法代码示例。如果您正苦于以下问题:C# ResourceManager.initialize方法的具体用法?C# ResourceManager.initialize怎么用?C# ResourceManager.initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResourceManager
的用法示例。
在下文中一共展示了ResourceManager.initialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: initializeResourceManager
private void initializeResourceManager() {
/*
* Which resource manager?
*/
System.String rm = getString(NVelocity.Runtime.RuntimeConstants_Fields.RESOURCE_MANAGER_CLASS);
if (rm != null && rm.Length > 0) {
/*
* if something was specified, then make one.
* if that isn't a ResourceManager, consider
* this a huge error and throw
*/
System.Object o = null;
//UPGRADE_NOTE: Exception 'java.lang.ClassNotFoundException' was converted to ' ' which has different behavior. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1100"'
try {
//UPGRADE_TODO: Format of parameters of method 'java.lang.Class.forName' are different in the equivalent in .NET. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1092"'
Type rmType = System.Type.GetType(rm);
o = System.Activator.CreateInstance(rmType);
} catch (System.Exception cnfe) {
System.String err = "The specified class for Resourcemanager (" + rm + ") does not exist (or is not accessible to the current classlaoder.";
error(err);
throw new System.Exception(err);
}
if (!(o is ResourceManager)) {
System.String err = "The specified class for ResourceManager (" + rm + ") does not implement org.apache.runtime.resource.ResourceManager." + " Velocity not initialized correctly.";
error(err);
throw new System.Exception(err);
}
resourceManager = (ResourceManager) o;
resourceManager.initialize(this);
} else {
/*
* someone screwed up. Lets not fool around...
*/
System.String err = "It appears that no class was specified as the" + " ResourceManager. Please ensure that all configuration" + " information is correct.";
error(err);
throw new System.Exception(err);
}
}