本文整理汇总了C#中Root.Start方法的典型用法代码示例。如果您正苦于以下问题:C# Root.Start方法的具体用法?C# Root.Start怎么用?C# Root.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Root
的用法示例。
在下文中一共展示了Root.Start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartInAppDomain
/// <summary>
/// Start the script up in its own application domain.
/// </summary>
/// <returns>True if the script was started successfully.</returns>
private bool StartInAppDomain()
{
m_appDomain = AppDomain.CreateDomain(Name, null, m_domainSetup);
if (m_policy != null)
m_appDomain.SetAppDomainPolicy(m_policy);
Root.Unloader unloader = new Root.Unloader(this);
unloader.UnloadRequest += (message) => new Thread(() => {
ErrorString = message;
NotifyProblem("Problem while running " + Name + ".");
Stop();
}).Start();
try {
Type rootT = typeof(Root);
m_log.Debug("[" + Type + "] Creating sandboxed script.");
m_root = (Root)m_appDomain.CreateInstanceAndUnwrap(rootT.Assembly.FullName, rootT.FullName);
m_log.Debug("[" + Type + "] Starting sandboxed script.");
string outcome = m_root.Start(m_assembly, m_class, m_host, m_world, ID, Name, unloader, m_args);
if (outcome != null) {
KillAppDomain();
ErrorString = outcome;
return false;
}
return true;
} catch (Exception e) {
KillAppDomain();
ErrorString = "Unable to start MRM." + e.Message + "\n" + e.StackTrace;
while (e.InnerException != null) {
e = e.InnerException;
ErrorString += "\n\nInner Exception: " + e.Message + "\n" + e.StackTrace;
}
return false;
}
}