protected override int RunImpl(string[] args) { if (!ParseArguments(args)) { ShowHelp(); return(1); } if (Arguments.Help) { ShowHelp(); return(0); } RuntimeSetup runtimeSetup = new RuntimeSetup(); runtimeSetup.RuntimePath = runtimePath; foreach (string pluginDirectory in Arguments.PluginDirectories) { runtimeSetup.AddPluginDirectory(pluginDirectory); } RichConsoleLogger runtimeLogger = new RichConsoleLogger(Console); FilteredLogger filteredLogger = new FilteredLogger(runtimeLogger, Arguments.Verbosity); RuntimeBootstrap.Initialize(runtimeSetup, filteredLogger); runtimeLogger.Log(LogSeverity.Important, "This program is a stub..."); return(0); }
protected override void ShowHelp() { // Show argument only help first because what we do next might take a little while // and we want to make the program appear responsive. base.ShowHelp(); // Print out options related to the currently available set of plugins. var setup = new RuntimeSetup(); if (Arguments != null && Arguments.PluginDirectories != null) { GenericCollectionUtils.ForEach(Arguments.PluginDirectories, x => setup.AddPluginDirectory(x)); } using (RuntimeBootstrap.Initialize(setup, CreateLogger())) { IReportManager reportManager = RuntimeAccessor.ServiceLocator.Resolve <IReportManager>(); ShowRegisteredComponents("Supported report types:", reportManager.FormatterHandles, h => h.GetTraits().Name, h => h.GetTraits().Description); ITestRunnerManager runnerManager = RuntimeAccessor.ServiceLocator.Resolve <ITestRunnerManager>(); ShowRegisteredComponents("Supported runner types:", runnerManager.TestRunnerFactoryHandles, h => h.GetTraits().Name, h => h.GetTraits().Description); } }
private void Canonicalize(string baseDirectory) { if (RuntimeSetup != null) { RuntimeSetup.Canonicalize(baseDirectory); } }
/// <inheritdoc /> protected override int RunImpl(string[] args) { if (!ParseArguments(args)) { ShowHelp(); return(1); } if (Arguments.Help) { ShowHelp(); return(0); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var runtimeSetup = new RuntimeSetup(); GenericCollectionUtils.ForEach(Arguments.PluginDirectories, x => runtimeSetup.AddPluginDirectory(x)); ILogger logger = new FilteredLogger(new RichConsoleLogger(Console), Verbosity.Normal); using (RuntimeBootstrap.Initialize(runtimeSetup, logger)) { IControlPanelPresenter presenter = RuntimeAccessor.Instance.ServiceLocator.Resolve <IControlPanelPresenter>(); presenter.Show(null); } return(0); }
private RuntimeSetup CreateRuntimeSetup() { var runtimeSetup = new RuntimeSetup(); GenericCollectionUtils.ForEach(Arguments.PluginDirectories, runtimeSetup.AddPluginDirectory); return(runtimeSetup); }
public void Initialize(RuntimeSetup runtimeSetup, ILogger logger) { if (!RuntimeAccessor.IsInitialized) { RuntimeBootstrap.Initialize(runtimeSetup, logger); initializedRuntime = true; } }
void Start() { rts = GameObject.FindWithTag("Character").GetComponent <RuntimeSetup>(); Character = GameObject.FindWithTag("Character").GetComponent <Character>(); //rigBod = GetComponent<Rigidbody2D>(); onLoad = GetComponent <onLoadPlayer>(); UpdateHealthUI(health); }
/// <inheritdoc /> protected override int RunImpl(string[] args) { if (!ParseArguments(args)) { ShowHelp(); return(1); } if (Arguments.Help) { ShowHelp(); return(0); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); UnhandledErrorPolicy(); var runtimeSetup = new RuntimeSetup { RuntimePath = Path.GetDirectoryName(AssemblyUtils.GetFriendlyAssemblyLocation( typeof(IcarusProgram).Assembly)) }; var runtimeLogger = new RuntimeLogger(); GenericCollectionUtils.ForEach(Arguments.PluginDirectories, runtimeSetup.AddPluginDirectory); using (RuntimeBootstrap.Initialize(runtimeSetup, runtimeLogger)) { // wire up services & components var scanner = new DefaultConventionScanner(RuntimeAccessor.Registry); scanner.Scan("Gallio.Icarus", Assembly.GetExecutingAssembly()); LoadPackages(); var optionsController = RuntimeAccessor.ServiceLocator.Resolve <IOptionsController>(); // create & initialize a test runner whenever the test runner factory is changed optionsController.TestRunnerFactory.PropertyChanged += (s, e) => ConfigureTestRunnerFactory(optionsController.TestRunnerFactory); ConfigureTestRunnerFactory(optionsController.TestRunnerFactory); var runtimeLogController = RuntimeAccessor.ServiceLocator.Resolve <IRuntimeLogController>(); runtimeLogController.SetLogger(runtimeLogger); var applicationController = RuntimeAccessor.ServiceLocator.Resolve <IApplicationController>(); applicationController.Arguments = Arguments; ErrorDialogUnhandledExceptionHandler.RunApplicationWithHandler(new Main(applicationController)); UnloadPackages(); } return(ResultCode.Success); }
public static void SetupRuntime(string runtimePath) { if (runtimePath == null) throw new ArgumentNullException("runtimePath"); if (!RuntimeAccessor.IsInitialized) { var setup = new RuntimeSetup(); setup.RuntimePath = runtimePath; RuntimeBootstrap.Initialize(setup, null); } }
public bool Initialize(RuntimeSetup runtimeSetup, ILogger logger) { hook = HostUtils.CreateInstance <ElevationHook>(host); if (!hook.HasElevatedPrivileges()) { logger.Log(LogSeverity.Warning, "Failed to create an elevation context out of process. The process was created successfully but it did not acquire elevated privileges for an unknown reason."); return(false); } hook.Initialize(runtimeSetup, new RemoteLogger(logger)); return(true); }
public static void SetupRuntime(string runtimePath) { if (runtimePath == null) { throw new ArgumentNullException("runtimePath"); } if (!RuntimeAccessor.IsInitialized) { var setup = new RuntimeSetup(); setup.RuntimePath = runtimePath; RuntimeBootstrap.Initialize(setup, null); } }
private ScriptEngine CreateRubyEngine() { RuntimeSetup = ScriptRuntimeSetup.ReadConfiguration(); var languageSetup = RuntimeSetup.AddRubySetup(); RuntimeSetup.PrivateBinding = true; RuntimeSetup.HostType = typeof(TmpHost); RuntimeSetup.HostArguments = new object[] { new OptionsAttribute() }; languageSetup.Options["Verbosity"] = 2; var runtime = Ruby.CreateRuntime(RuntimeSetup); return(Ruby.GetEngine(runtime)); }
protected override void ShowHelp() { // Show argument only help first because what we do next might take a little while // and we want to make the program appear responsive. base.ShowHelp(); // Print out options related to the currently available set of plugins. var setup = new RuntimeSetup(); using (RuntimeAccessor.IsInitialized ? null : RuntimeBootstrap.Initialize(setup, CreateLogger())) { IUtilityCommandManager utilityCommandManager = RuntimeAccessor.ServiceLocator.Resolve <IUtilityCommandManager>(); ShowRegisteredComponents("Supported utility commands:", utilityCommandManager.CommandHandles, h => h.GetTraits().Name, h => h.GetTraits().Description); } }
public void Start() { rts = GameObject.FindWithTag("Character").GetComponent <RuntimeSetup>(); }
private void WriteAndroidCfg(string outputDir) { string configPath = Path.Combine(outputDir, ANDROID_CFG); RuntimeSetup setup = Factory.AGSEditor.CurrentGame.DefaultSetup; int rotation = (int)setup.Rotation; NativeProxy.WritePrivateProfileString("misc", "config_enabled", "1", configPath); NativeProxy.WritePrivateProfileString("misc", "rotation", rotation.ToString(), configPath); NativeProxy.WritePrivateProfileString("misc", "translation", setup.Translation, configPath); NativeProxy.WritePrivateProfileString("controls", "mouse_method", "0", configPath); NativeProxy.WritePrivateProfileString("controls", "mouse_longclick", "1", configPath); NativeProxy.WritePrivateProfileString("compatibility", "clear_cache_on_room_change", "0", configPath); NativeProxy.WritePrivateProfileString("sound", "samplerate", "44100", configPath); NativeProxy.WritePrivateProfileString("sound", "enabled", "1", configPath); NativeProxy.WritePrivateProfileString("sound", "threaded", "1", configPath); NativeProxy.WritePrivateProfileString("sound", "cache_size", "64", configPath); NativeProxy.WritePrivateProfileString("midi", "enabled", "0", configPath); NativeProxy.WritePrivateProfileString("midi", "preload_patches", "0", configPath); NativeProxy.WritePrivateProfileString("video", "framedrop", "0", configPath); if (setup.GraphicsDriver == GraphicsDriver.Software) { NativeProxy.WritePrivateProfileString("graphics", "renderer", "0", configPath); } else { NativeProxy.WritePrivateProfileString("graphics", "renderer", "1", configPath); } if (setup.GraphicsFilter == "StdScale") { NativeProxy.WritePrivateProfileString("graphics", "smoothing", "0", configPath); } else { NativeProxy.WritePrivateProfileString("graphics", "smoothing", "1", configPath); } if (setup.FullscreenGameScaling == GameScaling.ProportionalStretch) { NativeProxy.WritePrivateProfileString("graphics", "scaling", "1", configPath); } else if (setup.FullscreenGameScaling == GameScaling.StretchToFit) { NativeProxy.WritePrivateProfileString("graphics", "scaling", "2", configPath); } else { NativeProxy.WritePrivateProfileString("graphics", "scaling", "0", configPath); } NativeProxy.WritePrivateProfileString("graphics", "super_sampling", "0", configPath); NativeProxy.WritePrivateProfileString("graphics", "smooth_sprites", setup.AAScaledSprites ? "1" : "0", configPath); NativeProxy.WritePrivateProfileString("debug", "show_fps", "0", configPath); NativeProxy.WritePrivateProfileString("debug", "logging", "0", configPath); }
public void Initialize(RuntimeSetup runtimeSetup, ILogger logger) { RuntimeBootstrap.Initialize(runtimeSetup, logger); }
public bool Initialize(RuntimeSetup runtimeSetup, ILogger logger) { hook = HostUtils.CreateInstance<ElevationHook>(host); if (!hook.HasElevatedPrivileges()) { logger.Log(LogSeverity.Warning, "Failed to create an elevation context out of process. The process was created successfully but it did not acquire elevated privileges for an unknown reason."); return false; } hook.Initialize(runtimeSetup, new RemoteLogger(logger)); return true; }
/// <summary> /// Runs an isolated task in a host. /// </summary> /// <typeparam name="TIsolatedTask">The isolated task type.</typeparam> /// <param name="hostSetup">The host setup which includes the test isolation option properties copied down, not null.</param> /// <param name="statusReporter">The status reporter, not null.</param> /// <param name="args">The task arguments.</param> /// <returns>The task result.</returns> protected virtual object RunIsolatedTaskInHost <TIsolatedTask>(HostSetup hostSetup, StatusReporter statusReporter, object[] args) where TIsolatedTask : IsolatedTask { IHost host = null; try { statusReporter("Creating test host."); host = hostFactory.CreateHost(hostSetup, logger); RemoteLogger remoteLogger = new RemoteLogger(logger); RuntimeSetup runtimeSetup = RuntimeAccessor.Instance.GetRuntimeSetup().Copy(); Shim shim = HostUtils.CreateInstance <Shim>(host); try { statusReporter("Initializing the runtime."); shim.Initialize(runtimeSetup, remoteLogger); statusReporter(""); var isolatedTask = HostUtils.CreateInstance <TIsolatedTask>(host); ManualResetEvent disconnectedEvent = new ManualResetEvent(false); EventHandler disconnectedEventHandler = (sender, e) => disconnectedEvent.Set(); try { host.Disconnected += disconnectedEventHandler; RunIsolatedTaskDelegate isolatedTaskDelegate = isolatedTask.Run; IAsyncResult asyncResult = isolatedTaskDelegate.BeginInvoke(args, null, null); WaitHandle.WaitAny(new[] { disconnectedEvent, asyncResult.AsyncWaitHandle }); if (asyncResult.IsCompleted) { return(isolatedTaskDelegate.EndInvoke(asyncResult)); } throw new TestIsolationException("The host disconnected or was terminated prematurely while the task was running."); } finally { host.Disconnected -= disconnectedEventHandler; } } finally { statusReporter("Shutting down the runtime."); shim.Shutdown(); GC.KeepAlive(remoteLogger); } } finally { statusReporter("Disposing test host."); try { if (host != null) { host.Dispose(); } } catch (Exception ex) { UnhandledExceptionPolicy.Report("An exception occurred while disposing the test host.", ex); } statusReporter(""); } }
public void Initialize(RuntimeSetup runtimeSetup, ILogger logger) { RuntimeBootstrap.Initialize(runtimeSetup, logger); }
/// <inheritdoc /> protected override int RunImpl(string[] args) { ShowBanner(); InstallCancelHandler(); if (!ParseArguments(args) || Arguments.CommandAndArguments.Length == 0) { ShowHelp(); return(Arguments.Help ? 0 : 1); } ILogger logger = CreateLogger(); IProgressMonitorProvider progressMonitorProvider = Arguments.NoProgress ? (IProgressMonitorProvider)NullProgressMonitorProvider.Instance : new RichConsoleProgressMonitorProvider(Console); string commandName = Arguments.CommandAndArguments[0]; string[] commandRawArguments = new string[Arguments.CommandAndArguments.Length - 1]; Array.Copy(Arguments.CommandAndArguments, 1, commandRawArguments, 0, commandRawArguments.Length); IUtilityCommand command = GetSpecialCommand(commandName); bool isSpecialCommand = command != null; var runtimeSetup = new RuntimeSetup(); GenericCollectionUtils.ForEach(Arguments.PluginDirectories, x => runtimeSetup.AddPluginDirectory(x)); using (isSpecialCommand ? null : RuntimeBootstrap.Initialize(runtimeSetup, logger)) { if (command == null) { var commandManager = RuntimeAccessor.ServiceLocator.Resolve <IUtilityCommandManager>(); command = commandManager.GetCommand(commandName); if (command == null) { ShowErrorMessage(string.Format("Unrecognized utility command name: '{0}'.", commandName)); ShowHelp(); return(1); } } Type commandArgumentsClass = command.GetArgumentClass(); var commandArgumentParser = new CommandLineArgumentParser(commandArgumentsClass, null); if (Arguments.Help) { ShowHelpForParticularCommand(commandName, commandArgumentParser); return(0); } object commandArguments = Activator.CreateInstance(commandArgumentsClass); if (!commandArgumentParser.Parse(commandRawArguments, commandArguments, ShowErrorMessage) || !command.ValidateArguments(commandArguments, ShowErrorMessage)) { ShowHelpForParticularCommand(commandName, commandArgumentParser); return(1); } var commandContext = new UtilityCommandContext(commandArguments, Console, logger, progressMonitorProvider, Arguments.Verbosity); return(command.Execute(commandContext)); } }