public void Aliases() { Suggest.Aliases(new Feed { Name = "My App:", EntryPoints = { new EntryPoint { Command = Command.NameRun, NeedsTerminal = true }, new EntryPoint { Command = Command.NameRunGui }, new EntryPoint { Command = "cli1:", NeedsTerminal = true }, new EntryPoint { Command = "cli2:", NeedsTerminal = true, BinaryName = "custom" } } }).Should().Equal( new AppAlias { Name = "my-app-", Command = Command.NameRun }, new AppAlias { Name = "cli1-", Command = "cli1:" }, new AppAlias { Name = "custom", Command = "cli2:" }); }
public void SingleMenuEntry() { Suggest.MenuEntries(new Feed { Name = "My App:", EntryPoints = { new EntryPoint { Command = Command.NameRun } } }).Should().Equal( new MenuEntry { Name = "My App-", Command = Command.NameRun }); }
public void SingleMenuEntryWithCategory() { Suggest.MenuEntries(new Feed { Name = "My App:", Categories = { "My Category:" }, EntryPoints = { new EntryPoint { Command = Command.NameRun } } }).Should().Equal( new MenuEntry { Category = "My Category-", Name = "My App-", Command = Command.NameRun }); }
public void AutoStart() { Suggest.AutoStart(new Feed { Name = "My App:", EntryPoints = { new EntryPoint { Command = "a" }, new EntryPoint { Command = "b", SuggestAutoStart = true } } }).Should().Equal( new AutoStart { Name = "My App- b", Command = "b" }); }
public void SendTo() { Suggest.SendTo(new Feed { Name = "My App:", EntryPoints = { new EntryPoint { Command = "a" }, new EntryPoint { Command = "b", SuggestSendTo = true } } }).Should().Equal( new SendTo { Name = "My App- b", Command = "b" }); }
public void DesktopIcons() { Suggest.DesktopIcons(new Feed { Name = "My App:", EntryPoints = { new EntryPoint { Command = Command.NameRun }, new EntryPoint { Command = "extra", Names ={ "Extra" } } } }).Should().Equal( new DesktopIcon { Name = "My App-", Command = Command.NameRun }); }
public void MultipleMenuEntries() { Suggest.MenuEntries(new Feed { Name = "My App:", EntryPoints = { new EntryPoint { Command = Command.NameRun }, new EntryPoint { Command = "extra" } } }).Should().Equal( new MenuEntry { Category = "My App-", Name = "My App-", Command = Command.NameRun }, new MenuEntry { Category = "My App-", Name = "My App- extra", Command = "extra" }); }
//--------------------// #region Add /// <inheritdoc/> public void AddAccessPointCategories(AppEntry appEntry, Feed feed, params string[] categories) { #region Sanity checks if (appEntry == null) { throw new ArgumentNullException(nameof(appEntry)); } if (feed == null) { throw new ArgumentNullException(nameof(feed)); } if (categories == null) { throw new ArgumentNullException(nameof(categories)); } #endregion // Parse categories list bool capabilities = categories.Contains(CapabilityRegistration.CategoryName); bool menu = categories.Contains(MenuEntry.CategoryName); bool desktop = categories.Contains(DesktopIcon.CategoryName); bool sendTo = categories.Contains(SendTo.CategoryName); bool alias = categories.Contains(AppAlias.CategoryName); bool autoStart = categories.Contains(AutoStart.CategoryName); bool defaults = categories.Contains(DefaultAccessPoint.CategoryName); // Build capability list var accessPointsToAdd = new List <AccessPoint>(); if (capabilities) { accessPointsToAdd.Add(new CapabilityRegistration()); } if (menu) { accessPointsToAdd.AddRange(Suggest.MenuEntries(feed)); } if (desktop) { accessPointsToAdd.AddRange(Suggest.DesktopIcons(feed)); } if (sendTo) { accessPointsToAdd.AddRange(Suggest.SendTo(feed)); } if (alias) { accessPointsToAdd.AddRange(Suggest.Aliases(feed)); } if (autoStart) { accessPointsToAdd.AddRange(Suggest.AutoStart(feed)); } if (defaults) { // Add AccessPoints for all suitable Capabilities accessPointsToAdd.AddRange(( from capability in appEntry.CapabilityLists.CompatibleCapabilities().OfType <DefaultCapability>() where !capability.WindowsMachineWideOnly || MachineWide || !WindowsUtils.IsWindows where !capability.ExplicitOnly select capability.ToAcessPoint())); } try { AddAccessPointsInternal(appEntry, feed, accessPointsToAdd); if (menu && MachineWide) { ToggleIconsVisible(appEntry, true); } } catch (KeyNotFoundException ex) { // Wrap exception since only certain exception types are allowed throw new InvalidDataException(ex.Message, ex); } finally { Finish(); } }