public void AssemblyName() { string assemblyName = "nunit.tests.dll"; GuiOptions options = new GuiOptions(new string[] { assemblyName }); Assert.AreEqual(assemblyName, options.Parameters[0]); }
private void CriticalErrorReporterFormClosing(object sender, FormClosingEventArgs e) { GuiOptions options = GuiOptions.Instanse; // Save log try { File.AppendAllText(Path.Combine(Application.StartupPath, "Report " + DateTime.Now.Date.ToString().Substring(0, DateTime.Now.Date.ToString().IndexOf(" ")).Replace("/", "-") + ".log"), messageTextBox.Text + detailsTextBox.Text, Encoding.UTF8); } catch (Exception) { } // Report by Mail if (options.ReportRnD) { switch (Brand.Brand.Name) { case "Umax": { this.SendMail("*****@*****.**", "*****@*****.**", "Error: UDS 2012 " + DateTime.Now.ToString(), "Error: UDS 2012 " + DateTime.Now.ToString(), "smtp.mail.ru", 25, "login", "password", true); break; } } } // Report to user if (options.Report) { this.SendMail(options.ReportTo, options.ReportFrom, options.ReportSubject, options.ReportMessage, options.ReportHost, options.ReportPort, options.ReportLogin, options.ReportPassword, options.ReportAttachments); } this.Invoke((MethodInvoker) delegate() { Helper.Exit(); }); }
private static TestPackage MakeTestPackage(IList <string> testFiles, GuiOptions options) { var package = new TestPackage(testFiles); ApplyOptionsToPackage(package, options); return(package); }
void ConfirmButtonDelegate(bool inside) { if (inside) { //store changes in options foreach (CustomControl c in m_Controls) { c.m_OptionsPos.Offset = c.m_TempOffset; } if (GuiHUD.Instance != null && GuiHUD.Instance.IsInitialized == true) { GuiHUD.Instance.UpdateControlsPosition(); } if (Player.LocalInstance != null && Player.LocalInstance.Controls != null) { Player.LocalInstance.Controls.ControlSchemeChanged(); //update positions of joysticks } GuiOptions.Save(); //return to menu Owner.Back(); } }
private static TestPackage MakeTestPackage(string name, GuiOptions options) { var package = new TestPackage(name); ApplyOptionsToPackage(package, options); return(package); }
public API_NUnit_Gui loadNUnitGui() { var guiOptions = new GuiOptions(new string[] {}); guiOptions.noload = true; return(loadNUnitGui(guiOptions)); }
void OnUserAuthenticationChanged(bool state) { if (state == true) { Settings = UserSettings.Load(CloudUser.instance.primaryKey); GuiOptions.Load(); PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPPI(); ppi.PrimaryKey = CloudUser.instance.primaryKey; ppi.PrimaryKeyHash = CloudServices.CalcHash64(ppi.PrimaryKey); if (ppi.Experience == 0 && PlayerPrefs.HasKey("firstrun") == false) { ppi.IsFirstRun = true; PlayerPrefs.SetInt("firstrun", 0); } TapJoy.ConnectUser(ppi.PrimaryKey); } else { SaveSettings(); TapJoy.DisconnectUser(); } }
//-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- void OnDetectGraphicButton(bool inside) { if (inside == true) { m_GraphicEnum.Selection = GuiOptions.GetDefaultGraphics(); // this will invoke OnGraphicChanged() delegate } }
public void HelpTextUsesCorrectDelimiterForPlatform() { string helpText = new GuiOptions(new String[] {"Tests.dll"} ).GetHelpText(); char delim = System.IO.Path.DirectorySeparatorChar == '/' ? '-' : '/'; string expected = string.Format( "{0}config=", delim ); StringAssert.Contains( expected, helpText ); }
public void HelpTextUsesCorrectDelimiterForPlatform() { string helpText = new GuiOptions(new String[] { "Tests.dll" }).GetHelpText(); char delim = System.IO.Path.DirectorySeparatorChar == '/' ? '-' : '/'; string expected = string.Format("{0}config=", delim); StringAssert.Contains(expected, helpText); }
//-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- void OnDetectGraphicButton(bool inside) { if (inside == true) { GuiOptions.graphicDetail = GuiOptions.GetDefaultGraphics(); m_GraphicEnum.Selection = GuiOptions.graphicDetail; // this will invoke OnGraphicChanged() delegate UpdateHint(); } }
public MainPresenter(IMainView view, ITestModel model, GuiOptions options) { _view = view; _model = model; _options = options; _recentFilesService = _model.GetService <IRecentFiles>(); InitializeMainMenu(); WireUpEvents(); }
public MainPresenter(IMainView view, ITestModel model, GuiOptions options) { _view = view; _model = model; _options = options; _recentFilesService = _model.GetService<IRecentFiles>(); InitializeMainMenu(); WireUpEvents(); }
protected override void OnViewHide() { // unbind buttons for (int idx = 0; idx < m_Buttons.Length; ++idx) { GuiBaseUtils.RegisterButtonDelegate(m_Buttons[idx], null, null); } RegisterButtonDelegate(RESET, null, null); // store options GuiOptions.Save(); // call super base.OnViewHide(); }
// HANDLERS void OnResetPressed(bool inside) { if (inside == false) { return; } GuiOptions.ResetToDefaults(); ApplyGraphicsOptions(); if (GuiHUD.Instance != null) { GuiHUD.Instance.UpdateAttackButtonSettings(); } ResetPage(); }
public static NUnitForm nUnitGui_ShowGui(this API_NUnit_Gui nUnitGui, GuiOptions guiOptions) { "[API_NUnit_Gui] in nUnitGui_ShowGui".info(); Func <NUnitForm> createNUnitForm = () => { var sync = new AutoResetEvent(false); NUnitForm nUnitForm = null; O2Thread.staThread( () => { if (NUnit.Util.Services.TestAgency.isNull()) { var nunitGuiRunner = nUnitGui.Executable.parentFolder().pathCombine("lib\\nunit-gui-runner.dll"); nunitGuiRunner.loadAssemblyAndAllItsDependencies(); SettingsService settingsService = new SettingsService(); InternalTrace.Initialize("nunit-gui_%p.log", (InternalTraceLevel)settingsService.GetSetting("Options.InternalTraceLevel", InternalTraceLevel.Default)); ServiceManager.Services.AddService(settingsService); ServiceManager.Services.AddService(new DomainManager()); ServiceManager.Services.AddService(new RecentFilesService()); ServiceManager.Services.AddService(new ProjectService()); ServiceManager.Services.AddService(new AddinRegistry()); ServiceManager.Services.AddService(new AddinManager()); ServiceManager.Services.AddService(new TestAgency()); ServiceManager.Services.InitializeServices(); } else { "[API_NUnit_Gui] in nUnitGui_ShowGui: NUnit.Util.Services.TestAgency was not null: {0}".debug(NUnit.Util.Services.TestAgency); } ServiceManager.Services.AddService(new TestLoader(new GuiTestEventDispatcher())); nUnitForm = new NUnitForm(guiOptions); "NUnitForm".o2Cache(nUnitForm); sync.Set(); nUnitForm.ShowDialog(); "NUnitForm".o2Cache(null); }); sync.WaitOne(); return(nUnitForm); }; return("NUnitForm".o2Cache(createNUnitForm)); }
public static int StartGuiApplication(string[] args, GuiOptions guiOptions) { AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionEventHandler; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (args.Contains(URLHandlers.UrlRegistrationArgument)) { //Passing in null will cause a NullRefrenceException if it tries to show the dialog //asking for elevation permission, but we want that to happen. Doing that keeps us //from getting in to a infinite loop of trying to register. URLHandlers.RegisterURLHandler(null, null); } else { new Main(args, user, guiOptions); } return(Exit.OK); }
private static TestPackage ApplyOptionsToPackage(TestPackage package, GuiOptions options) { // TODO: Remove temporary Settings used in testing GUI package.Settings["ProcessModel"] = "InProcess"; package.Settings["NumberOfTestWorkers"] = 0; //if (options.ProcessModel != null) // package.AddSetting("ProcessModel", options.ProcessModel); //if (options.DomainUsage != null) // package.AddSetting("DomainUsage", options.DomainUsage); //if (options.ActiveConfig != null) // package.AddSetting("ActiveConfig", options.ActiveConfig); if (options.InternalTraceLevel != null) { package.Settings["InternalTraceLevel"] = options.InternalTraceLevel; } return(package); }
void SaveSettings() { GuiOptions.Save(); Settings.Save(); }
public void NoParametersCount() { GuiOptions options = new GuiOptions(new string[] {}); Assert.IsTrue(options.NoArgs); }
public API_NUnit_Gui loadNUnitGui(GuiOptions guiOptions) { this.nUnitForm = this.nUnitGui_ShowGui(guiOptions); NunitGuiLoaded = true; return this; }
public static int Main(string[] args) { NUnitForm.CommandLineOptions command = new NUnitForm.CommandLineOptions(); GuiOptions parser = new GuiOptions(args); if(parser.Validate() && !parser.help) { if ( parser.cleanup ) { DomainManager.DeleteShadowCopyPath(); return 0; } if(!parser.NoArgs) { if (parser.IsAssembly) command.testFileName = parser.Assembly; command.configName = parser.config; command.testName = parser.fixture; command.noload = parser.noload; command.autorun = parser.run; if (parser.lang != null) Thread.CurrentThread.CurrentUICulture = new CultureInfo( parser.lang ); if ( parser.HasInclude ) { command.categories = parser.include; command.exclude = false; } else if ( parser.HasExclude ) { command.categories = parser.exclude; command.exclude = true; } } // Add Standard Services to ServiceManager ServiceManager.Services.AddService( new SettingsService() ); ServiceManager.Services.AddService( new DomainManager() ); ServiceManager.Services.AddService( new RecentFilesService() ); ServiceManager.Services.AddService( new TestLoader( new GuiTestEventDispatcher() ) ); ServiceManager.Services.AddService( new AddinRegistry() ); ServiceManager.Services.AddService( new AddinManager() ); // Initialize Services ServiceManager.Services.InitializeServices(); // Create container in order to allow ambient properties // to be shared across all top-level forms. AppContainer c = new AppContainer(); AmbientProperties ambient = new AmbientProperties(); c.Services.AddService( typeof( AmbientProperties ), ambient ); NUnitForm form = new NUnitForm( command ); c.Add( form ); try { Application.Run( form ); } finally { ServiceManager.Services.StopAllServices(); } } else { string message = parser.GetHelpText(); UserMessage.DisplayFailure( message,"Help Syntax" ); return 2; } return 0; }
public void ValidateSuccessful() { GuiOptions options = new GuiOptions(new string[] { "nunit.tests.dll" }); Assert.IsTrue(options.Validate(), "command line should be valid"); }
public API_NUnit_Gui(GuiOptions guiOptions) { loadNUnitGui(guiOptions); }
public void ShortHelp() { GuiOptions options = new GuiOptions(new string[] {"-?"}); Assert.IsTrue(options.help); }
public static int Main(string[] args) { // Create SettingsService early so we know the trace level right at the start SettingsService settingsService = new SettingsService(); InternalTrace.Initialize("nunit-gui_%p.log", (InternalTraceLevel)settingsService.GetSetting("Options.InternalTraceLevel", InternalTraceLevel.Default)); log.Info("Starting NUnit GUI"); GuiOptions guiOptions = new GuiOptions(args); GuiAttachedConsole attachedConsole = null; if (guiOptions.console) { log.Info("Creating attached console"); attachedConsole = new GuiAttachedConsole(); } if (guiOptions.help) { MessageDisplay.Display(guiOptions.GetHelpText()); return 0; } if (!guiOptions.Validate()) { string message = "Error in command line"; MessageDisplay.Error(message + Environment.NewLine + Environment.NewLine + guiOptions.GetHelpText()); log.Error(message); return 2; } if (guiOptions.cleanup) { log.Info("Performing cleanup of shadow copy cache"); DomainManager.DeleteShadowCopyPath(); return 0; } if (!guiOptions.NoArgs) { if (guiOptions.lang != null) { log.Info("Setting culture to " + guiOptions.lang); Thread.CurrentThread.CurrentUICulture = new CultureInfo(guiOptions.lang); } } try { // Add Standard Services to ServiceManager log.Info("Adding Services"); ServiceManager.Services.AddService(settingsService); ServiceManager.Services.AddService(new DomainManager()); ServiceManager.Services.AddService(new RecentFilesService()); ServiceManager.Services.AddService(new ProjectService()); ServiceManager.Services.AddService(new TestLoader(new GuiTestEventDispatcher())); ServiceManager.Services.AddService(new AddinRegistry()); ServiceManager.Services.AddService(new AddinManager()); ServiceManager.Services.AddService(new TestAgency()); // Initialize Services log.Info("Initializing Services"); ServiceManager.Services.InitializeServices(); } catch (Exception ex) { MessageDisplay.FatalError("Service initialization failed.", ex); log.Error("Service initialization failed", ex); return 2; } // Create container in order to allow ambient properties // to be shared across all top-level forms. log.Info("Initializing AmbientProperties"); AppContainer c = new AppContainer(); AmbientProperties ambient = new AmbientProperties(); c.Services.AddService(typeof(AmbientProperties), ambient); log.Info("Constructing Form"); NUnitForm form = new NUnitForm(guiOptions); c.Add(form); try { log.Info("Starting Gui Application"); Application.Run(form); log.Info("Application Exit"); } catch( Exception ex ) { log.Error("Gui Application threw an excepion", ex ); throw; } finally { log.Info("Stopping Services"); ServiceManager.Services.StopAllServices(); } if (attachedConsole != null) { Console.WriteLine("Press Enter to exit"); Console.ReadLine(); attachedConsole.Close(); } log.Info("Exiting NUnit GUI"); InternalTrace.Close(); return 0; }
private static TestPackage MakeTestPackage(IList<string> testFiles, GuiOptions options) { var package = new TestPackage(testFiles); ApplyOptionsToPackage(package, options); return package; }
private static TestPackage MakeTestPackage(string name, GuiOptions options) { var package = new TestPackage(name); ApplyOptionsToPackage(package, options); return package; }
public void NoNameValuePairs() { GuiOptions parser = new GuiOptions(new String[]{"TestFixture", "Tests.dll"}); Assert.IsFalse(parser.Validate()); }
public void InvalidCommandLineParms() { GuiOptions parser = new GuiOptions(new String[]{"-garbage:TestFixture", "-assembly:Tests.dll"}); Assert.IsFalse(parser.Validate()); }
public void InvalidArgs() { GuiOptions options = new GuiOptions(new string[] { "-asembly:nunit.tests.dll" }); Assert.IsFalse(options.Validate()); }
public void Help() { GuiOptions options = new GuiOptions(new string[] { "/help" }); Assert.IsTrue(options.help); }
public static int Main(string[] args) { NTrace.Info( "Starting NUnit GUI" ); GuiOptions guiOptions = new GuiOptions(args); GuiAttachedConsole attachedConsole = null; if ( guiOptions.console ) attachedConsole = new GuiAttachedConsole(); if( !guiOptions.Validate() || guiOptions.help) { string message = guiOptions.GetHelpText(); UserMessage.DisplayFailure( message,"Help Syntax" ); return 2; } if ( guiOptions.cleanup ) { DomainManager.DeleteShadowCopyPath(); return 0; } if(!guiOptions.NoArgs) { if (guiOptions.lang != null) Thread.CurrentThread.CurrentUICulture = new CultureInfo( guiOptions.lang ); } // Add Standard Services to ServiceManager ServiceManager.Services.AddService( new SettingsService() ); ServiceManager.Services.AddService( new DomainManager() ); ServiceManager.Services.AddService( new RecentFilesService() ); ServiceManager.Services.AddService( new TestLoader( new GuiTestEventDispatcher() ) ); ServiceManager.Services.AddService( new AddinRegistry() ); ServiceManager.Services.AddService( new AddinManager() ); ServiceManager.Services.AddService( new TestAgency() ); // Initialize Services ServiceManager.Services.InitializeServices(); // Create container in order to allow ambient properties // to be shared across all top-level forms. AppContainer c = new AppContainer(); AmbientProperties ambient = new AmbientProperties(); c.Services.AddService( typeof( AmbientProperties ), ambient ); NUnitForm form = new NUnitForm( guiOptions ); c.Add( form ); try { Application.Run( form ); } finally { ServiceManager.Services.StopAllServices(); } if ( attachedConsole != null ) { Console.WriteLine( "Press Enter to exit" ); Console.ReadLine(); attachedConsole.Close(); } NTrace.Info( "Exiting NUnit GUI" ); return 0; }
public Main(string[] cmdlineArgs, GUIUser User, GuiOptions guiOptions) { log.Info("Starting the GUI"); m_CommandLineArgs = cmdlineArgs; m_User = User; User.displayMessage = AddStatusMessage; User.displayError = ErrorDialog; controlFactory = new ControlFactory(); Instance = this; mainModList = new MainModList(source => UpdateFilters(this), TooManyModsProvide, User); InitializeComponent(); // We need to initialize error dialog first to display errors m_ErrorDialog = controlFactory.CreateControl <ErrorDialog>(); Manager = new KSPManager(User); if (guiOptions?.FactorioInstallName != null) { // Set a KSP directory by its alias. try { manager.SetCurrentInstance(guiOptions.FactorioInstallName); } catch (InvalidKSPInstanceKraken) { User.RaiseError("Invalid Factorio installation specified \"{0}\", use '--factorio-dir' to specify by path, or 'list-installs' to see known Factorio installations", guiOptions.FactorioInstallName); } } else if (guiOptions?.FactorioDirectory != null) { // Set a KSP directory by its path manager.SetCurrentInstanceByPath(guiOptions.FactorioDirectory); } // We want to check our current instance is null first, as it may // have already been set by a command-line option. if (CurrentInstance == null && manager.GetPreferredInstance() == null) { Hide(); var result = new ChooseKSPInstance().ShowDialog(); if (result == DialogResult.Cancel || result == DialogResult.Abort) { Application.Exit(); return; } } m_Configuration = Configuration.LoadOrCreateConfiguration ( CurrentInstance.findFactorioBinaryPath(), Path.Combine(CurrentInstance.CkanDir(), "GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); FilterToolButton.MouseHover += (sender, args) => FilterToolButton.ShowDropDown(); launchKSPToolStripMenuItem.MouseHover += (sender, args) => launchKSPToolStripMenuItem.ShowDropDown(); ApplyToolButton.MouseHover += (sender, args) => ApplyToolButton.ShowDropDown(); ModList.CurrentCellDirtyStateChanged += ModList_CurrentCellDirtyStateChanged; ModList.CellValueChanged += ModList_CellValueChanged; m_TabController = new TabController(MainTabControl); m_TabController.ShowTab("ManageModsTabPage"); RecreateDialogs(); if (guiOptions?.ShowConsole != true) { Util.HideConsoleWindow(); } // Disable the modinfo controls until a mod has been choosen. ModInfoTabControl.Enabled = false; // WinForms on Mac OS X has a nasty bug where the UI thread hogs the CPU, // making our download speeds really slow unless you move the mouse while // downloading. Yielding periodically addresses that. // https://bugzilla.novell.com/show_bug.cgi?id=663433 if (Platform.IsMac) { var yield_timer = new Timer { Interval = 2 }; yield_timer.Tick += (sender, e) => { Thread.Yield(); }; yield_timer.Start(); } Application.Run(this); }
public NUnitFormArxNet( GuiOptions guiOptions ) : base("NUnit") { InitializeComponent(); this.guiOptions = guiOptions; this.recentFilesService = ServicesArxNet.RecentFiles; this.userSettings = ServicesArxNet.UserSettings; this.presenter = new NUnitPresenterArxNet(this, TestLoader); //����ǰһCAD��ĵ� //prevActiveDocument = CADApplication.DocumentManager.MdiActiveDocument; //CADApplication.DocumentManager.MdiActiveDocument.Window.h }
public void AssemblyName() { string assemblyName = "nunit.tests.dll"; GuiOptions options = new GuiOptions(new string[]{ assemblyName }); Assert.AreEqual(assemblyName, options.Parameters[0]); }
public API_NUnit_Gui loadNUnitGui(GuiOptions guiOptions) { this.nUnitForm = this.nUnitGui_ShowGui(guiOptions); NunitGuiLoaded = true; return(this); }
public static NUnitForm nUnitGui_ShowGui(this API_NUnit_Gui nUnitGui, GuiOptions guiOptions) { Func<NUnitForm> createNUnitForm = ()=>{ var sync = new AutoResetEvent(false); NUnitForm nUnitForm = null; O2Thread.staThread( ()=>{ if(NUnit.Util.Services.TestAgency.isNull()) { var nunitGuiRunner = nUnitGui.installer.Executable.parentFolder().pathCombine("lib\\nunit-gui-runner.dll"); nunitGuiRunner.loadAssemblyAndAllItsDependencies(); SettingsService settingsService = new SettingsService(); InternalTrace.Initialize("nunit-gui_%p.log", (InternalTraceLevel)settingsService.GetSetting("Options.InternalTraceLevel", InternalTraceLevel.Default)); ServiceManager.Services.AddService(settingsService); ServiceManager.Services.AddService(new DomainManager()); ServiceManager.Services.AddService(new RecentFilesService()); ServiceManager.Services.AddService(new ProjectService()); ServiceManager.Services.AddService(new AddinRegistry()); ServiceManager.Services.AddService(new AddinManager()); ServiceManager.Services.AddService(new TestAgency()); ServiceManager.Services.InitializeServices(); } ServiceManager.Services.AddService(new TestLoader(new GuiTestEventDispatcher())); nUnitForm = new NUnitForm(guiOptions); "NUnitForm".o2Cache(nUnitForm); sync.Set(); nUnitForm.ShowDialog(); }); sync.WaitOne(); return nUnitForm; }; return "NUnitForm".o2Cache(createNUnitForm); }
public API_NUnit_Gui loadNUnitGui() { var guiOptions = new GuiOptions(new string[] {}); guiOptions.noload = true; return loadNUnitGui(guiOptions); }
public void InvalidCommandLineParms() { GuiOptions parser = new GuiOptions(new String[] { "-garbage:TestFixture", "-assembly:Tests.dll" }); Assert.IsFalse(parser.Validate()); }
protected void InitializeOptions() { GuiOptions options = GuiOptions.Instanse; }
public void NoNameValuePairs() { GuiOptions parser = new GuiOptions(new String[] { "TestFixture", "Tests.dll" }); Assert.IsFalse(parser.Validate()); }
public NUnitArxNetForm(GuiOptions guiOptions) { InitializeComponent(); this.guiOptions = guiOptions; this.recentFilesService = Services.RecentFiles; this.userSettings = Services.UserSettings; }
void OnLefthandedToggled(bool state) { GuiOptions.SetNewLeftHandAiming(state); }
private static TestPackage ApplyOptionsToPackage(TestPackage package, GuiOptions options) { // TODO: Remove temporary Settings used in testing GUI package.Settings["ProcessModel"] = "InProcess"; package.Settings["NumberOfTestWorkers"] = 0; //if (options.ProcessModel != null) // package.AddSetting("ProcessModel", options.ProcessModel); //if (options.DomainUsage != null) // package.AddSetting("DomainUsage", options.DomainUsage); //if (options.ActiveConfig != null) // package.AddSetting("ActiveConfig", options.ActiveConfig); if (options.InternalTraceLevel != null) package.Settings["InternalTraceLevel"] = options.InternalTraceLevel; return package; }
public NUnitForm( GuiOptions guiOptions ) : base("NUnit") { InitializeComponent(); this.guiOptions = guiOptions; this.recentFilesService = Services.RecentFiles; this.userSettings = Services.UserSettings; this.presenter = new NUnitPresenter(this, TestLoader); }
public void ShortHelp() { GuiOptions options = new GuiOptions(new string[] { "-?" }); Assert.IsTrue(options.help); }