ZeroInstall.Publish.FeedBuilder.GenerateCommands C# (CSharp) Method

GenerateCommands() public method

Generates Commands and EntryPoints bases on Candidates and MainCandidate.
is null.
public GenerateCommands ( ) : void
return void
        public void GenerateCommands()
        {
            if (MainCandidate == null) throw new InvalidOperationException(Resources.EntryPointNotFound);

            Commands.Clear();
            EntryPoints.Clear();

            var mainCommand = MainCandidate.CreateCommand();
            mainCommand.Name = Command.NameRun;
            Commands.Add(mainCommand);

            EntryPoints.Add(new EntryPoint
            {
                Command = Command.NameRun,
                BinaryName = Path.GetFileNameWithoutExtension(MainCandidate.RelativePath)
            });

            foreach (var candidate in _candidates.Except(MainCandidate))
            {
                var command = candidate.CreateCommand();
                Commands.Add(command);

                var entryPoint = new EntryPoint
                {
                    Command = command.Name,
                    BinaryName = Path.GetFileNameWithoutExtension(candidate.RelativePath),
                    NeedsTerminal = candidate.NeedsTerminal
                };
                if (!string.IsNullOrEmpty(candidate.Name)) entryPoint.Names.Add(candidate.Name);
                if (!string.IsNullOrEmpty(candidate.Summary)) entryPoint.Summaries.Add(candidate.Summary);
                EntryPoints.Add(entryPoint);
            }
        }
        #endregion

Usage Example

 public void TestGenerateCommands()
 {
     _builder.MainCandidate = new WindowsExe
     {
         RelativePath = "test",
         Name         = "TestApp",
         Summary      = "a test app",
         Version      = new ImplementationVersion("1.0"),
         Architecture = new Architecture(OS.Windows, Cpu.All)
     };
     _builder.GenerateCommands();
 }