//-----------------------------------------------------------------------
// <copyright file="DarkArguments.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license.
//
// You must not remove this notice, or any other, from this software.
// </copyright>
// <summary>
// Fields, properties and methods for working with Dark arguments
// </summary>
//-----------------------------------------------------------------------
namespace Microsoft.Tools.WindowsInstallerXml.Test{
using System;
using System.Collections.Generic;
using System.Text;
/// <summary>
/// The different command line arguments that Dark supports.
/// </summary>
public partial class Dark : WixTool
{
#region Fields
/// <summary>
/// The path to export the binaries to.
/// </summary>
private string binaryPath;
/// <summary>
/// The extensions to use with the ext option.
/// </summary>
private List<string> extensions;
/// <summary>
/// -notidy option.
/// </summary>
private bool noTidy;
/// <summary>
/// The decompiled output file.
/// </summary>
private string outputFile;
/// <summary>
/// The msi Input file.
/// </summary>
private string inputFile;
/// <summary>
/// -sdet option.
/// </summary>
private bool suppressDroppingEmptyTables;
/// <summary>
/// -sras option.
/// </summary>
private bool suppressRelativeActionSequences;
/// <summary>
/// -sui option.
/// </summary>
private bool suppressUITables;
/// <summary>
/// The list of warning IDs to be ignored.
/// </summary>
private List<int> suppressWarnings;
/// <summary>
/// -wx option.
/// </summary>
private bool treatWarningsAsErrors;
/// <summary>
/// -v option.
/// </summary>
private bool verbose;
/// <summary>
/// -xo option.
/// </summary>
private bool xmlOutput;
#endregion
#region Properties
/// <summary>
/// Gets the arguments as they would be passed on the command line.
/// </summary>
/// <remarks>
/// To allow for negative testing, checking for invalid combinations
/// of arguments is not performed.
/// </remarks>
public override string Arguments
{
get
{
StringBuilder arguments = new StringBuilder(base.Arguments);
// InputFile
if (!string.IsNullOrEmpty(this.InputFile))
{
arguments.AppendFormat(@" ""{0}""", this.InputFile);
}
// OutputFile
if (!string.IsNullOrEmpty(this.OutputFile))
{
arguments.AppendFormat(@" ""{0}""", this.OutputFile);
}
// Extensions
foreach (string extension in this.Extensions)
{
arguments.AppendFormat(@" -ext ""{0}""", extension);
}
// NoTidy
if (this.NoTidy)
{
arguments.Append(" -notidy");
}
// SDET
if (this.SuppressDroppingEmptyTables)
{
arguments.Append(" -sdet");
}
// SRAS
if (this.SuppressRelativeActionSequences)
{
arguments.Append(" -sras");
}
// SUI
if (this.SuppressUITables)
{
arguments.Append(" -sui");
}
// SW
foreach (int warning in this.SuppressWarnings)
{
arguments.AppendFormat(@" -sw""{0}""", warning);
}
// V
if (this.Verbose)
{
arguments.Append(" -v");
}
// WX
if (this.TreatWarningsAsErrors)
{
arguments.Append(" -wx");
}
// X
if (!string.IsNullOrEmpty(this.BinaryPath))
{
arguments.AppendFormat(@" -x ""{0}""", this.BinaryPath);
}
// XO
if (this.XmlOutput)
{
arguments.Append(" -xo");
}
return arguments.ToString();
}
}
/// <summary>
/// Gets or sets the path where the binaries will be exported.
/// </summary>
public string BinaryPath
{
get
{
return this.binaryPath;
}
set
{
this.binaryPath = value;
}
}
/// <summary>
/// Gets or sets the extensions to use with the ext option.
/// </summary>
public List<string> Extensions
{
get
{
return this.extensions;
}
set
{
this.extensions = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether -notidy option is used or not.
/// </summary>
public bool NoTidy
{
get
{
return this.noTidy;
}
set
{
this.noTidy = value;
}
}
/// <summary>
/// Gets or sets the decompiled output file.
/// </summary>
public string OutputFile
{
get
{
return this.outputFile;
}
set
{
this.outputFile = value;
}
}
/// <summary>
/// Gets or sets the msi input file.
/// </summary>
public string InputFile
{
get
{
return this.inputFile;
}
set
{
this.inputFile = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether -sdet option is used or not.
/// </summary>
public bool SuppressDroppingEmptyTables
{
get
{
return this.suppressDroppingEmptyTables;
}
set
{
this.suppressDroppingEmptyTables = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether -sras option is used or not.
/// </summary>
public bool SuppressRelativeActionSequences
{
get
{
return this.suppressRelativeActionSequences;
}
set
{
this.suppressRelativeActionSequences = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether -sui option is used or not.
/// </summary>
public bool SuppressUITables
{
get
{
return this.suppressUITables;
}
set
{
this.suppressUITables = value;
}
}
/// <summary>
/// Gets or sets the warning numbers that should be ignored.
/// </summary>
public List<int> SuppressWarnings
{
get
{
return this.suppressWarnings;
}
set
{
this.suppressWarnings = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether -wx option is used or not.
/// </summary>
public bool TreatWarningsAsErrors
{
get
{
return this.treatWarningsAsErrors;
}
set
{
this.treatWarningsAsErrors = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether -v option is used or not.
/// </summary>
public bool Verbose
{
get
{
return this.verbose;
}
set
{
this.verbose = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether -xo option is used or not.
/// </summary>
public bool XmlOutput
{
get
{
return this.xmlOutput;
}
set
{
this.xmlOutput = value;
}
}
#endregion
/// <summary>
/// Clears all of the assigned arguments and resets them to the default values.
/// </summary>
public override void SetDefaultArguments()
{
this.BinaryPath = string.Empty;
this.Extensions = new List<string>();
this.NoTidy = false;
this.InputFile = string.Empty;
this.SuppressDroppingEmptyTables = false;
this.SuppressRelativeActionSequences = false;
this.SuppressUITables = false;
this.SuppressWarnings = new List<int>();
this.TreatWarningsAsErrors = false;
this.Verbose = false;
this.XmlOutput = false;
}
}
}
|