From 6f503c9d33f06b87a0663fffd1716f0010ea4ae6 Mon Sep 17 00:00:00 2001 From: Richard Simpson Date: Tue, 29 Sep 2015 09:56:37 -0500 Subject: [PATCH] Added xml docs to List and Count. --- src/chocolatey/GetChocolatey.cs | 48 ++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/src/chocolatey/GetChocolatey.cs b/src/chocolatey/GetChocolatey.cs index 7c58d2fd99..69039e87e7 100644 --- a/src/chocolatey/GetChocolatey.cs +++ b/src/chocolatey/GetChocolatey.cs @@ -185,6 +185,36 @@ public void RunConsole(string[] args) runner.run(args, configuration, _container); } + /// + /// Run chocolatey after setting the options, and list the results. + /// + /// The typer of results you're expecting back. + public IEnumerable List() + { + extract_resources(); + var configuration = create_configuration(new List()); + configuration.RegularOutput = true; + var runner = new GenericRunner(); + return runner.list(configuration, _container, isConsole: false, parseArgs: null); + } + + /// + /// Run chocolatey after setting the options, + /// and get the count of items that would be returned if you listed the results. + /// + /// + /// Is intended to be more efficient then simply calling List and then Count() on the returned list. + /// It also returns the full count as is ignores paging. + /// + public int Count() + { + extract_resources(); + var configuration = create_configuration(new List()); + configuration.RegularOutput = true; + var runner = new GenericRunner(); + return runner.count(configuration, _container, isConsole: false, parseArgs: null); + } + private ChocolateyConfiguration create_configuration(IList args) { var configuration = new ChocolateyConfiguration(); @@ -213,24 +243,6 @@ private void extract_resources() AssemblyFileExtractor.extract_all_resources_to_relative_directory(_container.GetInstance(), Assembly.GetAssembly(typeof(ChocolateyResourcesAssembly)), ApplicationParameters.InstallLocation, folders, ApplicationParameters.ChocolateyFileResources); } - - public IEnumerable List() - { - extract_resources(); - var configuration = create_configuration(new List()); - configuration.RegularOutput = true; - var runner = new GenericRunner(); - return runner.list(configuration, _container, isConsole: false, parseArgs: null); - } - - public int Count() - { - extract_resources(); - var configuration = create_configuration(new List()); - configuration.RegularOutput = true; - var runner = new GenericRunner(); - return runner.count(configuration, _container, isConsole: false, parseArgs: null); - } } // ReSharper restore InconsistentNaming