本文整理汇总了C#中ISimulationBase.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# ISimulationBase.Copy方法的具体用法?C# ISimulationBase.Copy怎么用?C# ISimulationBase.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISimulationBase
的用法示例。
在下文中一共展示了ISimulationBase.Copy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BaseMain
static bool _IsHandlingException; // Make sure we don't go recursive on ourself
#endregion Fields
#region Methods
//could move our main function into OpenSimMain and kill this class
public static void BaseMain(string[] args, string defaultIniFile, ISimulationBase simBase)
{
// First line, hook the appdomain to the crash reporter
AppDomain.CurrentDomain.UnhandledException +=
CurrentDomain_UnhandledException;
// Add the arguments supplied when running the application to the configuration
ArgvConfigSource configSource = new ArgvConfigSource(args);
if (!args.Contains("-skipconfig"))
Configure(false);
// Increase the number of IOCP threads available. Mono defaults to a tragically low number
int workerThreads, iocpThreads;
ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
//MainConsole.Instance.InfoFormat("[Universe MAIN]: Runtime gave us {0} worker threads and {1} IOCP threads", workerThreads, iocpThreads);
if (workerThreads < 500 || iocpThreads < 1000)
{
workerThreads = 500;
iocpThreads = 1000;
//MainConsole.Instance.Info("[Universe MAIN]: Bumping up to 500 worker threads and 1000 IOCP threads");
ThreadPool.SetMaxThreads(workerThreads, iocpThreads);
}
BinMigratorService service = new BinMigratorService();
service.MigrateBin();
// Configure nIni aliases and localles
Culture.SystemCultureInfo = CultureInfo.CurrentCulture;
Culture.SetCurrentCulture();
configSource.Alias.AddAlias("On", true);
configSource.Alias.AddAlias("Off", false);
configSource.Alias.AddAlias("True", true);
configSource.Alias.AddAlias("False", false);
//Command line switches
configSource.AddSwitch("Startup", "inifile");
configSource.AddSwitch("Startup", "inimaster");
configSource.AddSwitch("Startup", "inigrid");
configSource.AddSwitch("Startup", "inisim");
configSource.AddSwitch("Startup", "inidirectory");
configSource.AddSwitch("Startup", "oldoptions");
configSource.AddSwitch("Startup", "inishowfileloading");
configSource.AddSwitch("Startup", "mainIniDirectory");
configSource.AddSwitch("Startup", "mainIniFileName");
configSource.AddSwitch("Startup", "secondaryIniFileName");
configSource.AddSwitch("Startup", "RegionDataFileName");
configSource.AddSwitch("Console", "Console");
configSource.AddSwitch("Console", "LogAppendName");
configSource.AddSwitch("Console", "LogPath");
configSource.AddSwitch("Network", "http_listener_port");
IConfigSource m_configSource = Configuration(configSource, defaultIniFile);
// Check if we're saving crashes
m_saveCrashDumps = m_configSource.Configs["Startup"].GetBoolean("save_crashes", m_saveCrashDumps);
// load Crash directory config
m_crashDir = m_configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
//Initialize the sim base now
Startup(configSource, m_configSource, simBase.Copy(), args);
}
示例2: BaseMain
//.........这里部分代码省略.........
// Configure Log4Net
configSource.AddSwitch("Startup", "logconfig");
string logConfigFile = configSource.Configs["Startup"].GetString("logconfig", String.Empty);
if (logConfigFile != String.Empty)
{
XmlConfigurator.Configure(new FileInfo(logConfigFile));
//MainConsole.Instance.InfoFormat("[OPENSIM MAIN]: configured log4net using \"{0}\" as configuration file",
// logConfigFile);
}
else
{
XmlConfigurator.Configure();
//MainConsole.Instance.Info("[OPENSIM MAIN]: configured log4net using default OpenSim.exe.config");
}
// Increase the number of IOCP threads available. Mono defaults to a tragically low number
int workerThreads, iocpThreads;
ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
//MainConsole.Instance.InfoFormat("[OPENSIM MAIN]: Runtime gave us {0} worker threads and {1} IOCP threads", workerThreads, iocpThreads);
if (workerThreads < 500 || iocpThreads < 1000)
{
workerThreads = 500;
iocpThreads = 1000;
//MainConsole.Instance.Info("[OPENSIM MAIN]: Bumping up to 500 worker threads and 1000 IOCP threads");
ThreadPool.SetMaxThreads(workerThreads, iocpThreads);
}
// Check if the system is compatible with OpenSimulator.
// Ensures that the minimum system requirements are met
//MainConsole.Instance.Info("[Setup]: Performing compatibility checks... \n");
string supported = String.Empty;
if (Util.IsEnvironmentSupported(ref supported))
{
int minWorker, minIOC;
// Get the current settings.
ThreadPool.GetMinThreads(out minWorker, out minIOC);
//MainConsole.Instance.InfoFormat("[Setup]: Environment is compatible. Thread Workers: {0}, IO Workers {1}\n", minWorker, minIOC);
}
else
{
MainConsole.Instance.Warn("[Setup]: Environment is unsupported (" + supported + ")\n");
#if BlockUnsupportedVersions
Thread.Sleep(10000); //Sleep 10 seconds
return;
#endif
}
// Configure nIni aliases and localles
Culture.SetCurrentCulture();
configSource.Alias.AddAlias("On", true);
configSource.Alias.AddAlias("Off", false);
configSource.Alias.AddAlias("True", true);
configSource.Alias.AddAlias("False", false);
///Command line switches
configSource.AddSwitch("Startup", "inifile");
configSource.AddSwitch("Startup", "inimaster");
configSource.AddSwitch("Startup", "inigrid");
configSource.AddSwitch("Startup", "inisim");
configSource.AddSwitch("Startup", "inidirectory");
configSource.AddSwitch("Startup", "oldoptions");
configSource.AddSwitch("Startup", "inishowfileloading");
configSource.AddSwitch("Startup", "mainIniDirectory");
configSource.AddSwitch("Startup", "mainIniFileName");
configSource.AddSwitch("Startup", "secondaryIniFileName");
configSource.AddConfig("Network");
IConfigSource m_configSource = Configuration(configSource, defaultIniFile);
// Check if we're saving crashes
m_saveCrashDumps = m_configSource.Configs["Startup"].GetBoolean("save_crashes", m_saveCrashDumps);
// load Crash directory config
m_crashDir = m_configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
// check auto restart
bool AutoRestart = m_configSource.Configs["Startup"].GetBoolean("AutoRestartOnCrash", true);
//Set up the error reporting
if (m_configSource.Configs["ErrorReporting"] != null)
{
m_sendErrorReport = m_configSource.Configs["ErrorReporting"].GetBoolean("SendErrorReports", true);
m_urlToPostErrors = m_configSource.Configs["ErrorReporting"].GetString("ErrorReportingURL",
m_urlToPostErrors);
}
bool Running = true;
//If auto restart is set, then we always run.
// otherwise, just run the first time that Running == true
while (AutoRestart || Running)
{
//Always run once, then disable this
Running = false;
//Initialize the sim base now
Startup(configSource, m_configSource, simBase.Copy(), args);
}
}
示例3: BaseMain
//.........这里部分代码省略.........
{
workerThreads = workerThreadsMax;
// m_log.InfoFormat("[OPENSIM MAIN]: Limiting worker threads to {0}",workerThreads);
}
// Increase the number of IOCP threads available.
// Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17)
if (iocpThreads < iocpThreadsMin)
{
iocpThreads = iocpThreadsMin;
// m_log.InfoFormat("[OPENSIM MAIN]: Bumping up IO completion threads to {0}",iocpThreads);
}
// Make sure we don't overallocate IOCP threads and thrash system resources
if ( iocpThreads > iocpThreadsMax )
{
iocpThreads = iocpThreadsMax;
//m_log.InfoFormat("[OPENSIM MAIN]: Limiting IO completion threads to {0}",iocpThreads);
}
// set the resulting worker and IO completion thread counts back to ThreadPool
if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) )
{
//m_log.InfoFormat("[OPENSIM MAIN]: Threadpool set to {0} worker threads and {1} IO completion threads", workerThreads, iocpThreads);
}
//else
//{
//m_log.Info("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect.");
// Check if the system is compatible with OpenSimulator.
// Ensures that the minimum system requirements are met
//MainConsole.Instance.Info("[Setup]: Performing compatibility checks... \n");
string supported = String.Empty;
if (Util.IsEnvironmentSupported(ref supported))
{
int minWorker, minIOC;
// Get the current settings.
ThreadPool.GetMinThreads(out minWorker, out minIOC);
//MainConsole.Instance.InfoFormat("[Setup]: Environment is compatible. Thread Workers: {0}, IO Workers {1}\n", minWorker, minIOC);
}
else
{
MainConsole.Instance.Warn("[Setup]: Environment is unsupported (" + supported + ")\n");
#if BlockUnsupportedVersions
Thread.Sleep(10000); //Sleep 10 seconds
return;
#endif
}
BinMigratorService service = new BinMigratorService();
service.MigrateBin();
// Configure nIni aliases and localles
Culture.SetCurrentCulture();
configSource.Alias.AddAlias("On", true);
configSource.Alias.AddAlias("Off", false);
configSource.Alias.AddAlias("True", true);
configSource.Alias.AddAlias("False", false);
//Command line switches
configSource.AddSwitch("Startup", "inifile");
configSource.AddSwitch("Startup", "inimaster");
configSource.AddSwitch("Startup", "inigrid");
configSource.AddSwitch("Startup", "inisim");
configSource.AddSwitch("Startup", "inidirectory");
configSource.AddSwitch("Startup", "oldoptions");
configSource.AddSwitch("Startup", "inishowfileloading");
configSource.AddSwitch("Startup", "mainIniDirectory");
configSource.AddSwitch("Startup", "mainIniFileName");
configSource.AddSwitch("Startup", "secondaryIniFileName");
configSource.AddConfig("Network");
IConfigSource m_configSource = Configuration(configSource, defaultIniFile);
// Check if we're saving crashes
m_saveCrashDumps = m_configSource.Configs["Startup"].GetBoolean("save_crashes", m_saveCrashDumps);
// load Crash directory config
m_crashDir = m_configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
// check auto restart
bool AutoRestart = m_configSource.Configs["Startup"].GetBoolean("AutoRestartOnCrash", true);
//Set up the error reporting
if (m_configSource.Configs["ErrorReporting"] != null)
{
m_sendErrorReport = m_configSource.Configs["ErrorReporting"].GetBoolean("SendErrorReports", true);
m_urlToPostErrors = m_configSource.Configs["ErrorReporting"].GetString("ErrorReportingURL",
m_urlToPostErrors);
}
bool Running = true;
//If auto restart is set, then we always run.
// otherwise, just run the first time that Running == true
while (AutoRestart || Running)
{
//Always run once, then disable this
Running = false;
//Initialize the sim base now
Startup(configSource, m_configSource, simBase.Copy(), args);
}
}