public void listTools_SelectedIndexChanged(object sender, EventArgs e) { if (listTools.SelectedIndex != -1) { if (listTools.SelectedIndex != PreviouslySelectedIndex) { if (PreviouslySelectedIndex != -1 && !CheckPassTool(PreviouslySelectedIndex)) { listTools.SelectedIndex = PreviouslySelectedIndex; return; } PreviouslySelectedIndex = listTools.SelectedIndex; ToolDescription highlighted = ToolList[listTools.SelectedIndex]; textTitle.Text = highlighted.Title; textCommand.Text = highlighted.Command; textArguments.Text = highlighted.Arguments; textInitialDirectory.Text = highlighted.InitialDirectory; cbOutputImmediateWindow.CheckState = highlighted.OutputToImmediateWindow ? CheckState.Checked : CheckState.Unchecked; comboReport.SelectedItem = ComboContainsTitle(highlighted.ReportTitle) ? highlighted.ReportTitle : string.Empty; } btnMoveUp.Enabled = (listTools.SelectedIndex != 0); btnMoveDown.Enabled = (listTools.SelectedIndex != ToolList.Count - 1); } }
public void AddDialog(string title, string command, string arguments, string initialDirectory, bool isImmediateOutput, string selectedReport, string argsCollectorDllPath, string argsCollectorType, string toolDirPath, string packageVersion, string packageIdentifier, string packageName) { ToolDescription newTool; if (ToolDescription.IsWebPageCommand(command)) { newTool = new ToolDescription(GetTitle(title), command, arguments, string.Empty, false, selectedReport, argsCollectorDllPath, argsCollectorType, toolDirPath, null, packageVersion, packageIdentifier, packageName); } else { newTool = new ToolDescription(GetTitle(title), command, arguments, initialDirectory, isImmediateOutput, selectedReport, argsCollectorDllPath, argsCollectorType, toolDirPath, null, packageVersion, packageIdentifier, packageName); } ToolList.Add(newTool); RefreshListBox(); PreviouslySelectedIndex = -1; listTools.SelectedIndex = ToolList.Count - 1; btnRemove.Enabled = true; }
private static void AssertToolEquality(ToolDescription expected, ToolDescription actual) { Assert.AreEqual(expected.Title, actual.Title); Assert.AreEqual(expected.Command, actual.Command); Assert.AreEqual(expected.Arguments, actual.Arguments); Assert.AreEqual(expected.InitialDirectory, actual.InitialDirectory); Assert.AreEqual(expected.ReportTitle, actual.ReportTitle); Assert.AreEqual(expected.OutputToImmediateWindow, actual.OutputToImmediateWindow); }
public static ToolDescription[] GetDefaults() { var descriptions = new ToolDescription[4]; descriptions[1] = new ToolDescription(new ToolUseDescription(false, false)); descriptions[2] = new ToolDescription(new ToolUseDescription(true, true), new ToolUseDescription(false, false)); descriptions[3] = new ToolDescription(new ToolUseDescription(true, true)); return(descriptions); }
/// <summary> /// Show the ContextMenu full of macros next to btnArguments. /// </summary> public void ShowArgumentsOpen() { bool isWebPage = ToolDescription.IsWebPageCommand(textCommand.Text); PopulateMacroDropdown(MacroListArguments, contextMenuMacroArguments, isWebPage); if (!isWebPage) { contextMenuMacroArguments.Items.Insert(4, new ToolStripSeparator()); contextMenuMacroArguments.Items.Insert(9, new ToolStripSeparator()); } contextMenuMacroArguments.Show(btnArguments, new Point(btnArguments.Width, 0)); }
/// <summary> /// Loop through the macroList adding each to the menu and setting its ToolTip to the appropriate value. /// </summary> /// <param name="macroList">List of macros to add from (eg. _macroListInitialDirectory)</param> /// <param name="menu">Menu to add the macros to.</param> /// <param name="isWebPage"></param> private void PopulateMacroDropdown(IEnumerable <MacroMenuItem> macroList, ToolStrip menu, bool isWebPage) { while (menu.Items.Count > 0) { menu.Items.RemoveAt(0); } foreach (MacroMenuItem menuItem in macroList) { if (string.IsNullOrEmpty(ToolDir) && menuItem.ShortText == ToolMacros.TOOL_DIR) { continue; } if (string.IsNullOrEmpty(ArgsCollectorPath) && menuItem.ShortText == ToolMacros.COLLECTED_ARGS) { continue; } if (isWebPage && !menuItem.IsWebApplicable) { continue; } menu.Items.Add(menuItem); if (SkylineWindowParent != null) { int spot = listTools.SelectedIndex; ToolDescription td = ToolList[spot]; ToolMacroInfo tmi = new ToolMacroInfo(SkylineWindowParent, td); string content; if (menuItem.Text == Resources.ToolMacros__listArguments_Input_Report_Temp_Path) { content = Resources.ConfigureToolsDlg_PopulateMacroDropdown_File_path_to_a_temporary_report; } else if (menuItem.Text == Resources.ToolMacros__listArguments_Collected_Arguments) { content = Resources.ConfigureToolsDlg_PopulateMacroDropdown_Arguments_collected_at_run_time; } else { content = menuItem.GetContents(tmi); } if (string.IsNullOrEmpty(content)) { content = Resources.ConfigureToolsDlg_PopulateMacroDropdown_N_A; } menuItem.ToolTipText = content; } } }
/// <summary> /// Remove the currently selected value. /// </summary> public void Remove() { int spot = listTools.SelectedIndex; if (spot >= Settings.Default.ToolList.Count && !Unsaved) { //Removing a newly added tool } else { Unsaved = true; } Removelist.Add(ToolList[spot]); ToolList.RemoveAt(spot); RefreshListBox(); if (ToolList.Count == 0) { textTitle.Text = string.Empty; textCommand.Text = string.Empty; textArguments.Text = string.Empty; textInitialDirectory.Text = string.Empty; btnRemove.Enabled = false; PreviouslySelectedIndex = -1; cbOutputImmediateWindow.CheckState = CheckState.Unchecked; comboReport.SelectedItem = string.Empty; } // If the removed Index was the last in the list, the selected index is the new last element. else if (spot == ToolList.Count) { // If the removed Index was the last in the list, the selected index is the new last element. listTools.SelectedIndex = spot - 1; } else { listTools.SelectedIndex = spot; //In this case the selected index doesn't actually change so the textBoxes still need to be updated. ToolDescription highlighted = ToolList[listTools.SelectedIndex]; textTitle.Text = highlighted.Title; textCommand.Text = highlighted.Command; textArguments.Text = highlighted.Arguments; textInitialDirectory.Text = highlighted.InitialDirectory; cbOutputImmediateWindow.CheckState = highlighted.OutputToImmediateWindow ? CheckState.Checked : CheckState.Unchecked; comboReport.SelectedItem = ComboContainsTitle(highlighted.ReportTitle) ? highlighted.ReportTitle : string.Empty; } }
public static void Add(FSM fsm, String name, String title, String description, String category) { if (Tools == null) { Tools = new Dictionary<string, ToolDescription>(); } Tools[name] = new ToolDescription() { description = description, title = title, fsm = fsm, category = category }; }
public virtual void DoFunction(GameLocation location, int x, int y, int power, Farmer who) { this.lastUser = who; short seed = (short)Game1.random.Next((int)short.MinValue, 32768); if (Game1.IsClient && who.Equals((object)Game1.player)) { Game1.recentMultiplayerRandom = new Random((int)seed); ToolDescription indexFromTool = ToolFactory.getIndexFromTool(this); Game1.client.sendMessage((byte)7, new object[7] { (object)indexFromTool.index, (object)indexFromTool.upgradeLevel, (object)(short)x, (object)(short)y, (object)location.name, (object)(byte)who.FacingDirection, (object)seed }); } else if (Game1.IsServer && who.Equals((object)Game1.player)) { Game1.recentMultiplayerRandom = new Random((int)seed); MultiplayerUtility.broadcastToolAction(this, x, y, location.name, (byte)who.FacingDirection, seed, who.uniqueMultiplayerID); } if (this.isHeavyHitter() && !(this is MeleeWeapon)) { Rumble.rumble(0.1f + (float)(Game1.random.NextDouble() / 4.0), (float)(100 + Game1.random.Next(50))); location.damageMonster(new Rectangle(x - Game1.tileSize / 2, y - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize), this.upgradeLevel + 1, (this.upgradeLevel + 1) * 3, false, who); } if (!(this is MeleeWeapon) || who.UsingTool && Game1.mouseClickPolling < 50 && ((this as MeleeWeapon).type != 1 && (this as MeleeWeapon).initialParentTileIndex != 47) && (MeleeWeapon.timedHitTimer <= 0 && who.FarmerSprite.indexInCurrentAnimation == 5 && (double)who.FarmerSprite.timer < (double)who.FarmerSprite.interval / 4.0)) { return; } if ((this as MeleeWeapon).type == 2 && (this as MeleeWeapon).isOnSpecial) { (this as MeleeWeapon).doClubFunction(who); } else { if (who.FarmerSprite.indexInCurrentAnimation <= 0) { return; } MeleeWeapon.timedHitTimer = 500; } }
public void MoveDown() { // If there is a value below selected index, swap places. int spot = listTools.SelectedIndex; int max = ToolList.Count - 1; if (spot < max) { ToolDescription temp = ToolList[spot]; ToolList[spot] = ToolList[spot + 1]; ToolList[spot + 1] = temp; RefreshListBox(); PreviouslySelectedIndex = PreviouslySelectedIndex + 1; listTools.SelectedIndex = spot + 1; Unsaved = true; } }
public void MoveUp() { // If there is a value above selected index, swap places. int spot = listTools.SelectedIndex; if (spot > 0) { // Swap ToolDescription temp = ToolList[spot]; ToolList[spot] = ToolList[spot - 1]; ToolList[spot - 1] = temp; RefreshListBox(); PreviouslySelectedIndex = PreviouslySelectedIndex - 1; listTools.SelectedIndex = spot - 1; Unsaved = true; } }
public void TestFindArgsCollectorMethod() { var toolDescription = new ToolDescription("ToolTitle", string.Empty, string.Empty); Assert.IsNotNull(toolDescription.FindArgsCollectorMethod(typeof(DifferentArguments))); AssertEx.ThrowsException <ToolExecutionException>(() => toolDescription.FindArgsCollectorMethod(typeof(NoMethod))); AssertEx.ThrowsException <ToolExecutionException>(() => toolDescription.FindArgsCollectorMethod(typeof(AmbiguousMethod))); Assert.IsNotNull(toolDescription.FindArgsCollectorMethod(typeof(ReportAsString))); var reportAsStringOrReader = toolDescription.FindArgsCollectorMethod(typeof(ReportAsStringOrReader)); Assert.IsNotNull(reportAsStringOrReader); CollectionAssert.AreEqual(new[] { typeof(IWin32Window), typeof(TextReader), typeof(string[]) }, reportAsStringOrReader.GetParameters().Select(p => p.ParameterType).ToArray()); Assert.AreEqual("CollectArgsReader", toolDescription.FindArgsCollectorMethod(typeof(WithCollectArgsReader)).Name); }
// Token: 0x060007B1 RID: 1969 RVA: 0x000A8560 File Offset: 0x000A6760 public virtual void DoFunction(GameLocation location, int x, int y, int power, Farmer who) { this.lastUser = who; short seed = (short)Game1.random.Next(-32768, 32768); if (Game1.IsClient && who.Equals(Game1.player)) { Game1.recentMultiplayerRandom = new Random((int)seed); ToolDescription t = ToolFactory.getIndexFromTool(this); Game1.client.sendMessage(7, new object[] { t.index, t.upgradeLevel, (short)x, (short)y, location.name, (byte)who.FacingDirection, seed }); } else if (Game1.IsServer && who.Equals(Game1.player)) { Game1.recentMultiplayerRandom = new Random((int)seed); MultiplayerUtility.broadcastToolAction(this, x, y, location.name, (byte)who.FacingDirection, seed, who.uniqueMultiplayerID); } if (this.isHeavyHitter() && !(this is MeleeWeapon)) { Rumble.rumble(0.1f + (float)(Game1.random.NextDouble() / 4.0), (float)(100 + Game1.random.Next(50))); location.damageMonster(new Rectangle(x - Game1.tileSize / 2, y - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize), this.upgradeLevel + 1, (this.upgradeLevel + 1) * 3, false, who); } if (this is MeleeWeapon && (!who.UsingTool || Game1.mouseClickPolling >= 50 || (this as MeleeWeapon).type == 1 || (this as MeleeWeapon).initialParentTileIndex == 47 || MeleeWeapon.timedHitTimer > 0 || who.FarmerSprite.indexInCurrentAnimation != 5 || who.FarmerSprite.timer >= who.FarmerSprite.interval / 4f)) { if ((this as MeleeWeapon).type == 2 && (this as MeleeWeapon).isOnSpecial) { (this as MeleeWeapon).doClubFunction(who); return; } if (who.FarmerSprite.indexInCurrentAnimation > 0) { MeleeWeapon.timedHitTimer = 500; } } }
private void textCommand_TextChanged(object sender, EventArgs e) { int spot = listTools.SelectedIndex; if (spot != -1) { if (ToolList[spot].Command != textCommand.Text) { Unsaved = true; ToolList[spot].Command = textCommand.Text; } if (ToolDescription.IsWebPageCommand(textCommand.Text)) { labelCommand.Text = Resources.ConfigureToolsDlg_textCommand_TextChanged_U_RL_; labelArguments.Text = Resources.ConfigureToolsDlg_textCommand_TextChanged__Query_params_; if (textInitialDirectory.Enabled) { textInitialDirectory.Enabled = false; textInitialDirectory.Text = string.Empty; cbOutputImmediateWindow.Enabled = false; btnFindCommand.Enabled = false; btnInitialDirectory.Enabled = false; btnInitialDirectoryMacros.Enabled = false; } } else { labelCommand.Text = Resources.ConfigureToolsDlg_textCommand_TextChanged__Command_; labelArguments.Text = Resources.ConfigureToolsDlg_textCommand_TextChanged_A_rguments_; if (!textInitialDirectory.Enabled) { textInitialDirectory.Enabled = true; textInitialDirectory.Text = ToolList[spot].InitialDirectory; cbOutputImmediateWindow.Enabled = true; btnFindCommand.Enabled = true; btnInitialDirectory.Enabled = true; btnInitialDirectoryMacros.Enabled = true; } } } }
private void TestToolDirMacro() { string path1 = TestFilesDir.GetTestPath("TestToolDirMacro.zip"); RunDlg <ConfigureToolsDlg>(SkylineWindow.ShowConfigureToolsDlg, configureToolsDlg => { configureToolsDlg.RemoveAllTools(); configureToolsDlg.InstallZipTool(path1); Assert.AreEqual("TestToolDirMacro", configureToolsDlg.textTitle.Text); Assert.AreEqual("$(ToolDir)\\HelloWorld.exe", configureToolsDlg.textCommand.Text); Assert.AreEqual("$(ToolDir)\\MSStatsDSS.r", configureToolsDlg.textArguments.Text); Assert.AreEqual(string.Empty, configureToolsDlg.textInitialDirectory.Text); Assert.AreEqual(CheckState.Unchecked, configureToolsDlg.cbOutputImmediateWindow.CheckState); Assert.AreEqual(string.Empty, configureToolsDlg.comboReport.SelectedItem); configureToolsDlg.PopulateListMacroArguments(); string toolDir = configureToolsDlg.ToolDir; string macroToolDir = configureToolsDlg.GetMacroArgumentToolTip(Resources.ToolMacros__listArguments_Tool_Directory); Assert.AreEqual(toolDir, macroToolDir); string inputReportTempPath = configureToolsDlg.GetMacroArgumentToolTip( Resources.ToolMacros__listArguments_Input_Report_Temp_Path); Assert.AreEqual(inputReportTempPath, Resources.ConfigureToolsDlg_PopulateMacroDropdown_File_path_to_a_temporary_report); configureToolsDlg.SaveTools(); ToolDescription tool = Settings.Default.ToolList[0]; Assert.AreEqual(tool.Title, configureToolsDlg.textTitle.Text); Assert.AreEqual(tool.ToolDirPath, toolDir); string expectedcommand = configureToolsDlg.textCommand.Text.Replace("$(ToolDir)", toolDir); string command = ToolMacros.ReplaceMacrosCommand(SkylineWindow.Document, SkylineWindow, tool, SkylineWindow); Assert.AreEqual(expectedcommand, command); string expectedArgument = configureToolsDlg.textArguments.Text.Replace("$(ToolDir)", toolDir); string arguments = ToolMacros.ReplaceMacrosArguments(SkylineWindow.Document, SkylineWindow, tool, SkylineWindow); Assert.AreEqual(expectedArgument, arguments); configureToolsDlg.RemoveAllTools(); configureToolsDlg.OkDialog(); }); }
public static void broadcastToolAction(Tool t, int tileX, int tileY, string location, byte facingDirection, short seed, long whichPlayer) { ToolDescription indexFromTool = ToolFactory.getIndexFromTool(t); foreach (KeyValuePair <long, Farmer> current in Game1.otherFarmers) { if (current.Value.currentLocation.name.Equals(location) && whichPlayer != current.Value.uniqueMultiplayerID) { current.Value.multiplayerMessage.Add(new object[] { 7, indexFromTool.index, indexFromTool.upgradeLevel, (short)tileX, (short)tileY, location, facingDirection, seed, whichPlayer }); } } }
public void AddTool(ToolDescription t) { ValidToolsFound.Add(t); }
protected override void LoadContentInternal(GraphicsDevice graphicsDevice, ContentManager contentManager, ImGuiRenderer guiRenderer) { _mapControlLogin = contentManager.Load <Texture2D>($"Content/Controls/control-login-{IconSize}"); _mapControlLogout = contentManager.Load <Texture2D>($"Content/Controls/control-logout-{IconSize}"); _mapToolTerrainElevate = contentManager.Load <Texture2D>($"Content/Tools/terrain-elevate-{IconSize}"); _mapToolTerrainLower = contentManager.Load <Texture2D>($"Content/Tools/terrain-lower-{IconSize}"); _mapToolTerrainAdd = contentManager.Load <Texture2D>($"Content/Tools/terrain-add-{IconSize}"); _mapToolTerrainSubtract = contentManager.Load <Texture2D>($"Content/Tools/terrain-subtract-{IconSize}"); _mapToolTerrainCoast = contentManager.Load <Texture2D>($"Content/Tools/terrain-coast-{IconSize}"); _mapToolTerrainFlatten = contentManager.Load <Texture2D>($"Content/Tools/terrain-flatten-{IconSize}"); _mapToolTerrainPaint = contentManager.Load <Texture2D>($"Content/Tools/terrain-paint-{IconSize}"); _mapToolTerrainSmooth = contentManager.Load <Texture2D>($"Content/Tools/terrain-smooth-{IconSize}"); var mapControlLogin = guiRenderer.BindTexture(_mapControlLogin); var mapControlLogout = guiRenderer.BindTexture(_mapControlLogout); var mapToolTerrainElevate = guiRenderer.BindTexture(_mapToolTerrainElevate); var mapToolTerrainLower = guiRenderer.BindTexture(_mapToolTerrainLower); var mapToolTerrainAdd = guiRenderer.BindTexture(_mapToolTerrainAdd); var mapToolTerrainSubtract = guiRenderer.BindTexture(_mapToolTerrainSubtract); var mapToolTerrainCoast = guiRenderer.BindTexture(_mapToolTerrainCoast); var mapToolTerrainFlatten = guiRenderer.BindTexture(_mapToolTerrainFlatten); var mapToolTerrainPaint = guiRenderer.BindTexture(_mapToolTerrainPaint); var mapToolTerrainSmooth = guiRenderer.BindTexture(_mapToolTerrainSmooth); var loginToolDescription = new ToolDescription { Group = ToolGroup.Control, Name = "Login", TextureHandle = mapControlLogin, Size = IconSize }; loginToolDescription.Clicked += LoginClicked; var logoutToolDescription = new ToolDescription { Group = ToolGroup.Control, Name = "Logout", TextureHandle = mapControlLogout, Size = IconSize }; logoutToolDescription.Clicked += LogoutClicked; _toolDescriptions = new[] { loginToolDescription, logoutToolDescription, new ToolDescription { Group = ToolGroup.Selection, Name = "Elevate", TextureHandle = mapToolTerrainElevate, Size = IconSize }, new ToolDescription { Group = ToolGroup.Selection, Name = "Lower", TextureHandle = mapToolTerrainLower, Size = IconSize }, new ToolDescription { Group = ToolGroup.Selection, Name = "Add", TextureHandle = mapToolTerrainAdd, Size = IconSize }, new ToolDescription { Group = ToolGroup.Selection, Name = "Subtract", TextureHandle = mapToolTerrainSubtract, Size = IconSize }, new ToolDescription { Group = ToolGroup.Selection, Name = "Coast", TextureHandle = mapToolTerrainCoast, Size = IconSize }, new ToolDescription { Group = ToolGroup.Selection, Name = "Flatten", TextureHandle = mapToolTerrainFlatten, Size = IconSize }, new ToolDescription { Group = ToolGroup.Selection, Name = "Paint", TextureHandle = mapToolTerrainPaint, Size = IconSize }, new ToolDescription { Group = ToolGroup.Selection, Name = "Smooth", TextureHandle = mapToolTerrainSmooth, Size = IconSize } }; }
private void TestToolVersioning() { string version1 = TestFilesDir.GetTestPath("TestToolVersioning\\1.0\\Counter.zip"); { RunDlg <ConfigureToolsDlg>(SkylineWindow.ShowConfigureToolsDlg, configureToolsDlg => { configureToolsDlg.RemoveAllTools(); configureToolsDlg.SaveTools(); configureToolsDlg.InstallZipTool(version1); Assert.AreEqual("Counter", configureToolsDlg.textTitle.Text); Assert.AreEqual("$(ToolDir)\\NumberWriter.exe", configureToolsDlg.textCommand.Text); Assert.AreEqual("100 100", configureToolsDlg.textArguments.Text); Assert.AreEqual(string.Empty, configureToolsDlg.textInitialDirectory.Text); Assert.AreEqual(CheckState.Checked, configureToolsDlg.cbOutputImmediateWindow.CheckState); configureToolsDlg.OkDialog(); }); ToolDescription newtool = Settings.Default.ToolList[0]; Assert.AreEqual("Counter", newtool.PackageName); Assert.AreEqual("uw.genomesciences.macosslabs.skyline.externaltools.test.countertool", newtool.PackageIdentifier); Assert.AreEqual("1.0", newtool.PackageVersion); } { var configureToolsDlg = ShowDialog <ConfigureToolsDlg>(SkylineWindow.ShowConfigureToolsDlg); RunDlg <MultiButtonMsgDlg>(() => configureToolsDlg.InstallZipTool(version1), messageDlg => { string messageForm = TextUtil.LineSeparate( Resources.ConfigureToolsDlg_OverwriteOrInParallel_The_tool__0__is_already_installed_, string.Empty, Resources .ConfigureToolsDlg_OverwriteOrInParallel_Do_you_wish_to_reinstall_or_install_in_parallel_); AssertEx.AreComparableStrings(messageForm, messageDlg.Message, 1); messageDlg.Btn1Click(); // In Parallel }); WaitForConditionUI(3 * 1000, () => configureToolsDlg.ToolList.Count == 2); string version2 = TestFilesDir.GetTestPath("TestToolVersioning\\1.0.2\\Counter.zip"); RunDlg <MultiButtonMsgDlg>(() => configureToolsDlg.InstallZipTool(version2), messageDlg => { string messageForm = TextUtil.LineSeparate(Resources.ConfigureToolsDlg_OverwriteOrInParallel_The_tool__0__is_currently_installed_, string.Empty, Resources.ConfigureToolsDlg_OverwriteOrInParallel_Do_you_wish_to_upgrade_to__0__or_install_in_parallel_); AssertEx.AreComparableStrings(messageForm, messageDlg.Message, 2); messageDlg.Btn0Click(); // Update/Overwrite }); WaitForConditionUI(3 * 1000, () => configureToolsDlg.ToolList.Count == 2); OkDialog(configureToolsDlg, configureToolsDlg.OkDialog); ToolDescription newtool = Settings.Default.ToolList[1]; Assert.AreEqual("Counter", newtool.PackageName); Assert.AreEqual("uw.genomesciences.macosslabs.skyline.externaltools.test.countertool", newtool.PackageIdentifier); Assert.AreEqual("1.0.2", newtool.PackageVersion); } { var configureToolsDlg = ShowDialog <ConfigureToolsDlg>(SkylineWindow.ShowConfigureToolsDlg); RunDlg <MultiButtonMsgDlg>(() => configureToolsDlg.InstallZipTool(version1), messageDlg => { string messageForm = TextUtil.LineSeparate(Resources.ConfigureToolsDlg_OverwriteOrInParallel_This_is_an_older_installation_v_0__of_the_tool__1_, string.Empty, Resources.ConfigureToolsDlg_OverwriteOrInParallel_Do_you_wish_to_overwrite_with_the_older_version__0__or_install_in_parallel_); AssertEx.AreComparableStrings(messageForm, messageDlg.Message, 3); messageDlg.Btn1Click(); // In Parallel }); WaitForConditionUI(3 * 1000, () => configureToolsDlg.ToolList.Count == 3); string versionDifferent = TestFilesDir.GetTestPath("TestToolVersioning\\Differentidentifier\\Counter.zip"); //Testing recognition of a different unique identifier when zip has the same name RunUI(() => configureToolsDlg.InstallZipTool(versionDifferent)); WaitForConditionUI(3 * 1000, () => configureToolsDlg.ToolList.Count == 4); string version3 = TestFilesDir.GetTestPath("TestToolVersioning\\1.2.0\\Counter.zip"); RunDlg <MultiButtonMsgDlg>(() => configureToolsDlg.InstallZipTool(version3), messageDlg => { string messageForm = TextUtil.LineSeparate(Resources.ConfigureToolsDlg_OverwriteOrInParallel_The_tool__0__is_currently_installed_, string.Empty, Resources.ConfigureToolsDlg_OverwriteOrInParallel_Do_you_wish_to_upgrade_to__0__or_install_in_parallel_); AssertEx.AreComparableStrings(messageForm, messageDlg.Message, 2); messageDlg.Btn0Click(); // Upgrade }); WaitForConditionUI(3 * 1000, () => configureToolsDlg.ToolList.Count == 4); RunUI(configureToolsDlg.RemoveAllTools); WaitForConditionUI(3 * 1000, () => configureToolsDlg.ToolList.Count == 0); OkDialog(configureToolsDlg, configureToolsDlg.OkDialog); } //Settings.Default.ToolList.Clear(); }
private void ZipTestAnnotations() { var sampleId = new AnnotationDef("SampleID", // Not L10N AnnotationDef.AnnotationTargetSet.Singleton( AnnotationDef.AnnotationTarget.replicate), AnnotationDef.AnnotationType.text, new List <string>()); var isConc = new AnnotationDef("IS Conc", // Not L10N AnnotationDef.AnnotationTargetSet.Singleton( AnnotationDef.AnnotationTarget.replicate), AnnotationDef.AnnotationType.text, new List <string>()); var analyteConcentration = new AnnotationDef("Analyte Concentration", // Not L10N AnnotationDef.AnnotationTargetSet.Singleton( AnnotationDef.AnnotationTarget.replicate), AnnotationDef.AnnotationType.text, new List <string>()); var sampleIdTransition = new AnnotationDef("SampleID", // Not L10N AnnotationDef.AnnotationTargetSet.Singleton( AnnotationDef.AnnotationTarget.transition), AnnotationDef.AnnotationType.text, new List <string>()); // Test proper loading of annotations string testAnnotationsPath = TestFilesDir.GetTestPath("TestAnnotations.zip"); // Not L10N RunDlg <ConfigureToolsDlg>(() => SkylineWindow.ShowConfigureToolsDlg(), dlg => { dlg.RemoveAllTools(); dlg.InstallZipTool(testAnnotationsPath); WaitForConditionUI(3 * 1000, () => dlg.ToolList.Count == 4); ToolDescription t0 = dlg.ToolList[0]; ToolDescription t1 = dlg.ToolList[1]; ToolDescription t2 = dlg.ToolList[2]; ToolDescription t3 = dlg.ToolList[3]; AssertEx.AreEqualDeep(t0.Annotations, new List <AnnotationDef>()); AssertEx.AreEqualDeep(t1.Annotations, new List <AnnotationDef> { sampleId, isConc, analyteConcentration }); AssertEx.AreEqualDeep(t2.Annotations, new List <AnnotationDef> { sampleId }); AssertEx.AreEqualDeep(t3.Annotations, new List <AnnotationDef>()); Assert.IsTrue(Settings.Default.AnnotationDefList.Contains(sampleId)); Assert.IsTrue(Settings.Default.AnnotationDefList.Contains(isConc)); Assert.IsTrue(Settings.Default.AnnotationDefList.Contains(analyteConcentration)); dlg.OkDialog(); }); // Test conflicting annotations var configureToolsDlg = ShowDialog <ConfigureToolsDlg>(SkylineWindow.ShowConfigureToolsDlg); string conflictAnnotationsPath = TestFilesDir.GetTestPath("ConflictAnnotations.zip"); // Not L10N RunDlg <MultiButtonMsgDlg>(() => configureToolsDlg.InstallZipTool(conflictAnnotationsPath), messageDlg => messageDlg.Btn1Click()); // keep existing annotations WaitForConditionUI(3 * 1000, () => configureToolsDlg.ToolList.Count == 5); Assert.IsTrue(Settings.Default.AnnotationDefList.Contains(sampleId)); RunDlg <MultiButtonMsgDlg>(() => configureToolsDlg.InstallZipTool(conflictAnnotationsPath), dlg => dlg.Btn0Click()); { var messageDlg = WaitForOpenForm <MultiButtonMsgDlg>(); OkDialog(messageDlg, messageDlg.Btn0Click); } // overwrite existing annotations Assert.IsTrue(Settings.Default.AnnotationDefList.Contains(sampleIdTransition)); OkDialog(configureToolsDlg, configureToolsDlg.OkDialog); RunUI(() => SkylineWindow.PopulateToolsMenu()); // Test running the tool with an unchecked annotation RunDlg <MessageDlg>(() => SkylineWindow.RunTool(4), dlg => { Assert.AreEqual(TextUtil.LineSeparate(Resources.ToolDescription_VerifyAnnotations_This_tool_requires_the_use_of_the_following_annotations_which_are_not_enabled_for_this_document, string.Empty, TextUtil.LineSeparate(new Collection <string> { sampleId.GetKey() }), string.Empty, Resources.ToolDescription_VerifyAnnotations_Please_enable_these_annotations_and_fill_in_the_appropriate_data_in_order_to_use_the_tool_), dlg.Message); dlg.OkDialog(); }); // Test running the tool with a missing annotation Settings.Default.AnnotationDefList = new AnnotationDefList(); WaitForCondition(3 * 1000, () => Settings.Default.AnnotationDefList.Count == 0); RunDlg <MessageDlg>(() => SkylineWindow.RunTool(4), dlg => { Assert.AreEqual(TextUtil.LineSeparate(Resources.ToolDescription_VerifyAnnotations_This_tool_requires_the_use_of_the_following_annotations_which_are_missing_or_improperly_formatted, string.Empty, TextUtil.LineSeparate(new Collection <string> { sampleId.GetKey() }), string.Empty, Resources.ToolDescription_VerifyAnnotations_Please_re_install_the_tool_and_try_again_), dlg.Message); dlg.OkDialog(); }); // Clean-up RunDlg <ConfigureToolsDlg>(() => SkylineWindow.ShowConfigureToolsDlg(), dlg => { dlg.RemoveAllTools(); dlg.OkDialog(); }); }
//For Functional Testing. public void PopulateListMacroArguments() { bool isWebPage = ToolDescription.IsWebPageCommand(textCommand.Text); PopulateMacroDropdown(MacroListArguments, contextMenuMacroArguments, isWebPage); }