Example #1
0
        public static VSWhereSettings RemoveRequires(this VSWhereSettings toolSettings, IEnumerable <string> requires)
        {
            toolSettings = toolSettings.NewInstance();
            var hashSet = new HashSet <string>(requires);

            toolSettings.RequiresInternal.RemoveAll(x => hashSet.Contains(x));
            return(toolSettings);
        }
Example #2
0
        public static VSWhereSettings RemoveProducts(this VSWhereSettings toolSettings, params string[] products)
        {
            toolSettings = toolSettings.NewInstance();
            var hashSet = new HashSet <string>(products);

            toolSettings.ProductsInternal.RemoveAll(x => hashSet.Contains(x));
            return(toolSettings);
        }
Example #3
0
        private static List <VSWhereResult> GetResult(IProcess process, VSWhereSettings toolSettings)
        {
            if (!(toolSettings.UTF8 ?? false) || toolSettings.Format != VSWhereFormat.json || toolSettings.Property != null)
            {
                return(null);
            }

            var output = process.Output.EnsureOnlyStd().Select(x => x.Text).JoinNewLine();

            return(SerializationTasks.JsonDeserialize <VSWhereResult[]>(output).ToList());
        }
Example #4
0
 public static VSWhereSettings AddRequires(this VSWhereSettings toolSettings, IEnumerable <string> requires)
 {
     toolSettings = toolSettings.NewInstance();
     toolSettings.RequiresInternal.AddRange(requires);
     return(toolSettings);
 }
Example #5
0
 public static VSWhereSettings AddRequires(this VSWhereSettings toolSettings, params string[] requires)
 {
     toolSettings = toolSettings.NewInstance();
     toolSettings.RequiresInternal.AddRange(requires);
     return(toolSettings);
 }
Example #6
0
 public static VSWhereSettings SetAll(this VSWhereSettings toolSettings, bool?all)
 {
     toolSettings     = toolSettings.NewInstance();
     toolSettings.All = all;
     return(toolSettings);
 }
Example #7
0
 public static VSWhereSettings SetProperty(this VSWhereSettings toolSettings, string property)
 {
     toolSettings          = toolSettings.NewInstance();
     toolSettings.Property = property;
     return(toolSettings);
 }
Example #8
0
 public static VSWhereSettings DisableAll(this VSWhereSettings toolSettings)
 {
     toolSettings     = toolSettings.NewInstance();
     toolSettings.All = false;
     return(toolSettings);
 }
Example #9
0
 public static VSWhereSettings SetVersion(this VSWhereSettings toolSettings, string version)
 {
     toolSettings         = toolSettings.NewInstance();
     toolSettings.Version = version;
     return(toolSettings);
 }
Example #10
0
 public static VSWhereSettings SetProducts(this VSWhereSettings toolSettings, IEnumerable <string> products)
 {
     toolSettings = toolSettings.NewInstance();
     toolSettings.ProductsInternal = products.ToList();
     return(toolSettings);
 }
Example #11
0
 public static VSWhereSettings SetRequiresAny(this VSWhereSettings toolSettings, bool?requiresAny)
 {
     toolSettings             = toolSettings.NewInstance();
     toolSettings.RequiresAny = requiresAny;
     return(toolSettings);
 }
Example #12
0
 public static VSWhereSettings TogglePrerelease(this VSWhereSettings toolSettings)
 {
     toolSettings            = toolSettings.NewInstance();
     toolSettings.Prerelease = !toolSettings.Prerelease;
     return(toolSettings);
 }
Example #13
0
 public static VSWhereSettings SetProducts(this VSWhereSettings toolSettings, params string[] products)
 {
     toolSettings = toolSettings.NewInstance();
     toolSettings.ProductsInternal = products.ToList();
     return(toolSettings);
 }
Example #14
0
 public static VSWhereSettings ResetPrerelease(this VSWhereSettings toolSettings)
 {
     toolSettings            = toolSettings.NewInstance();
     toolSettings.Prerelease = null;
     return(toolSettings);
 }
Example #15
0
 public static VSWhereSettings SetPrerelease(this VSWhereSettings toolSettings, bool?prerelease)
 {
     toolSettings            = toolSettings.NewInstance();
     toolSettings.Prerelease = prerelease;
     return(toolSettings);
 }
Example #16
0
 public static VSWhereSettings ToggleAll(this VSWhereSettings toolSettings)
 {
     toolSettings     = toolSettings.NewInstance();
     toolSettings.All = !toolSettings.All;
     return(toolSettings);
 }
Example #17
0
 public static VSWhereSettings ClearRequires(this VSWhereSettings toolSettings)
 {
     toolSettings = toolSettings.NewInstance();
     toolSettings.RequiresInternal.Clear();
     return(toolSettings);
 }
Example #18
0
 public static VSWhereSettings DisableRequiresAny(this VSWhereSettings toolSettings)
 {
     toolSettings             = toolSettings.NewInstance();
     toolSettings.RequiresAny = false;
     return(toolSettings);
 }
Example #19
0
 public static VSWhereSettings AddProducts(this VSWhereSettings toolSettings, params string[] products)
 {
     toolSettings = toolSettings.NewInstance();
     toolSettings.ProductsInternal.AddRange(products);
     return(toolSettings);
 }
Example #20
0
 public static VSWhereSettings ResetAll(this VSWhereSettings toolSettings)
 {
     toolSettings     = toolSettings.NewInstance();
     toolSettings.All = null;
     return(toolSettings);
 }
Example #21
0
 public static VSWhereSettings ResetRequiresAny(this VSWhereSettings toolSettings)
 {
     toolSettings             = toolSettings.NewInstance();
     toolSettings.RequiresAny = null;
     return(toolSettings);
 }
Example #22
0
 public static VSWhereSettings AddProducts(this VSWhereSettings toolSettings, IEnumerable <string> products)
 {
     toolSettings = toolSettings.NewInstance();
     toolSettings.ProductsInternal.AddRange(products);
     return(toolSettings);
 }
Example #23
0
 public static VSWhereSettings ToggleRequiresAny(this VSWhereSettings toolSettings)
 {
     toolSettings             = toolSettings.NewInstance();
     toolSettings.RequiresAny = !toolSettings.RequiresAny;
     return(toolSettings);
 }
Example #24
0
 public static VSWhereSettings ClearProducts(this VSWhereSettings toolSettings)
 {
     toolSettings = toolSettings.NewInstance();
     toolSettings.ProductsInternal.Clear();
     return(toolSettings);
 }
Example #25
0
 public static VSWhereSettings ResetVersion(this VSWhereSettings toolSettings)
 {
     toolSettings         = toolSettings.NewInstance();
     toolSettings.Version = null;
     return(toolSettings);
 }
Example #26
0
 public static VSWhereSettings SetRequires(this VSWhereSettings toolSettings, params string[] requires)
 {
     toolSettings = toolSettings.NewInstance();
     toolSettings.RequiresInternal = requires.ToList();
     return(toolSettings);
 }
Example #27
0
 public static VSWhereSettings ResetProperty(this VSWhereSettings toolSettings)
 {
     toolSettings          = toolSettings.NewInstance();
     toolSettings.Property = null;
     return(toolSettings);
 }
Example #28
0
 public static VSWhereSettings SetRequires(this VSWhereSettings toolSettings, IEnumerable <string> requires)
 {
     toolSettings = toolSettings.NewInstance();
     toolSettings.RequiresInternal = requires.ToList();
     return(toolSettings);
 }
Example #29
0
 /// <summary>
 ///   <p>VSWhere is designed to be a redistributable, single-file executable that can be used in build or deployment scripts to find where Visual Studio - or other products in the Visual Studio family - is located.</p>
 ///   <p>For more details, visit the <a href="https://github.com/Microsoft/vswhere">official website</a>.</p>
 /// </summary>
 /// <remarks>
 ///   <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p>
 ///   <ul>
 ///     <li><c>-all</c> via <see cref="VSWhereSettings.All"/></li>
 ///     <li><c>-format</c> via <see cref="VSWhereSettings.Format"/></li>
 ///     <li><c>-latest</c> via <see cref="VSWhereSettings.Latest"/></li>
 ///     <li><c>-legacy</c> via <see cref="VSWhereSettings.Legacy"/></li>
 ///     <li><c>-nologo</c> via <see cref="VSWhereSettings.NoLogo"/></li>
 ///     <li><c>-prerelease</c> via <see cref="VSWhereSettings.Prerelease"/></li>
 ///     <li><c>-products</c> via <see cref="VSWhereSettings.Products"/></li>
 ///     <li><c>-property</c> via <see cref="VSWhereSettings.Property"/></li>
 ///     <li><c>-requires</c> via <see cref="VSWhereSettings.Requires"/></li>
 ///     <li><c>-requiresAny</c> via <see cref="VSWhereSettings.RequiresAny"/></li>
 ///     <li><c>-utf8</c> via <see cref="VSWhereSettings.UTF8"/></li>
 ///     <li><c>-version</c> via <see cref="VSWhereSettings.Version"/></li>
 ///   </ul>
 /// </remarks>
 public static (List <VSWhereResult> Result, IReadOnlyCollection <Output> Output) VSWhere(VSWhereSettings toolSettings = null)
 {
     toolSettings      = toolSettings ?? new VSWhereSettings();
     using var process = ProcessTasks.StartProcess(toolSettings);
     process.AssertZeroExitCode();
     return(GetResult(process, toolSettings), process.Output);
 }
Example #30
0
 public static VSWhereSettings ToggleLegacy(this VSWhereSettings toolSettings)
 {
     toolSettings        = toolSettings.NewInstance();
     toolSettings.Legacy = !toolSettings.Legacy;
     return(toolSettings);
 }