本文整理汇总了C#中Props.setDefault方法的典型用法代码示例。如果您正苦于以下问题:C# Props.setDefault方法的具体用法?C# Props.setDefault怎么用?C# Props.setDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Props
的用法示例。
在下文中一共展示了Props.setDefault方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createAgent
protected internal virtual AgentControllerInterface createAgent(Props agentProps)
{
AgentController controller = null;
string classname = agentProps.getString("classname");
if (classname.Length > 0)
{
if (classname.Equals("com.neokernel.xml.XMLStartupAgent"))
{
classname = "Feng.NeoKernel.nk.LicenseFreeXMLStartupAgent";
}
if (!classname.Equals("com.neokernel.xml.XMLStartupAgent") && !classname.Equals("com.neokernel.nk.Trmntr"))
{
this.println("Creating agent " + classname);
}
try
{
AgentInterface agent = null;
IClassFactoryInterface defaultClassFactory = (IClassFactoryInterface) agentProps.getProperty("class_factory");
if (defaultClassFactory == null)
{
defaultClassFactory = NK.DefaultClassFactory;
}
agent = (AgentInterface) defaultClassFactory.createInstance(classname);
Type type = agent.GetType();
if (!agentProps.hasProperty("name"))
{
string fullName = type.FullName;
int num = fullName.LastIndexOf('.');
if (num > 0)
{
fullName = fullName.Substring(num + 1);
}
agentProps.setProperty("name", fullName);
}
agentProps.setDefault("agent_id", this.NextAgentID);
agent.Props = agentProps;
controller = new AgentController(agent);
}
catch (ArgumentException exception)
{
this.error("Could not create Agent: " + classname, exception);
}
catch (ClassFactoryException exception2)
{
this.error("Could not create Agent: " + classname, exception2);
}
}
return controller;
}