CandleArguments.cs :  » Installers-Generators » WiX » Microsoft » Tools » WindowsInstallerXml » Test » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Installers Generators » WiX 
WiX » Microsoft » Tools » WindowsInstallerXml » Test » CandleArguments.cs
//-----------------------------------------------------------------------
// <copyright file="CandleArguments.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 Candle arguments
// </summary>
//-----------------------------------------------------------------------

namespace Microsoft.Tools.WindowsInstallerXml.Test{
    using System;
    using System.Collections.Generic;
    using System.Text;

    /// <summary>
    /// Fields, properties and methods for working with Candle arguments.
    /// </summary>
    public partial class Candle
    {
        #region Private Members

        /// <summary>
        /// -ext
        /// </summary>
        private List<string> extensions;

        /// <summary>
        /// -zs
        /// </summary>
        private bool onlyValidateDocuments;

        /// <summary>
        /// -out outputFile
        /// </summary>
        private string outputFile;

        /// <summary>
        /// -pedantic
        /// </summary>
        private bool pedantic;

        /// <summary>
        /// <![CDATA[-p<file>]]>
        /// </summary>
        private string preProcessFile;

        /// <summary>
        /// <![CDATA[-d<name>=<value>]]>
        /// </summary>
        private Dictionary<string, string> preProcessorParams;

        /// <summary>
        ///  <![CDATA[-I<dir>]]>
        /// </summary>
        private List<string> includeSearchPaths;

        /// <summary>
        /// sourceFile [sourceFile ...]
        /// </summary>
        private List<string> sourceFiles;

        /// <summary>
        ///  Suppress all warnings
        /// </summary>
        private bool suppressAllWarnings;

        /// <summary>
        /// -ss
        /// </summary>
        private bool suppressSchemaValidation;

        /// <summary>
        ///  -sw[N]
        /// </summary>
        private List<int> suppressWarnings;

        /// <summary>
        /// -trace
        /// </summary>
        private bool trace;

        /// <summary>
        /// -wx[N]
        /// </summary>
        private List<int> treatWarningsAsErrors;

        /// <summary>
        /// Treat all warnings as errors
        /// </summary>
        private bool treatAllWarningsAsErrors;

        /// <summary>
        /// -v
        /// </summary>
        private bool verboseOutput;

        #endregion

        #region Public Properties

        /// <summary>
        /// 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);

                // Extensions
                foreach (string extension in this.Extensions)
                {
                    arguments.AppendFormat(@" -ext ""{0}""", extension);
                }

                // OnlyValidateDocuments
                if (this.OnlyValidateDocuments)
                {
                    arguments.Append(" -zs");
                }

                // OutputFile
                if (!String.IsNullOrEmpty(this.OutputFile))
                {
                    // WiX requires that we add extra backslashes to the end of a directory path
                    if (this.OutputFile.EndsWith(@"\") && !this.OutputFile.EndsWith(@"\\"))
                    {
                        arguments.AppendFormat(@" -out ""{0}\""", this.OutputFile);
                    }
                    else
                    {
                        arguments.AppendFormat(@" -out ""{0}""", this.OutputFile);
                    }
                }

                // Pedantic
                if (this.Pedantic)
                {
                    arguments.Append(" -pedantic");
                }

                // PreProcessFile
                if (!String.IsNullOrEmpty(this.PreProcessFile))
                {
                    arguments.AppendFormat(@" -p""{0}""", this.PreProcessFile);
                }

                // PreProcessorParams
                foreach (string key in this.PreProcessorParams.Keys)
                {
                    arguments.AppendFormat(" -d{0}={1}", key, this.PreProcessorParams[key]);
                }

                // IncludeSearchPaths
                foreach (string searchPath in this.IncludeSearchPaths)
                {
                    arguments.AppendFormat(@" -I""{0}""", searchPath);
                }

                // SourceFiles
                foreach (string sourceFile in this.SourceFiles)
                {
                    arguments.AppendFormat(@" ""{0}""", sourceFile);
                }

                // SuppressAllWarnings
                if (this.SuppressAllWarnings)
                {
                    arguments.Append(" -sw");
                }

                // SuppressSchemaValidation
                if (true == this.suppressSchemaValidation)
                {
                    arguments.Append(" -ss");
                }

                // SuppressWarnings
                foreach (int warning in this.SuppressWarnings)
                {
                    arguments.AppendFormat(" -sw{0}", warning.ToString());
                }

                // Trace
                if (this.Trace)
                {
                    arguments.Append(" -trace");
                }

                // TreatAllWarningsAsErrors
                if (this.TreatAllWarningsAsErrors)
                {
                    arguments.Append(" -wx");
                }

                // Treat specific warnings as errors
                foreach (int warning in this.TreatWarningsAsErrors)
                {
                    arguments.AppendFormat(" -wx{0}", warning.ToString());
                }
                
                // VerboseOutput
                if (this.VerboseOutput)
                {
                    arguments.Append(" -v");
                }

                return arguments.ToString();
            }
        }

        /// <summary>
        /// -ext
        /// </summary>
        public List<string> Extensions
        {
            get { return this.extensions; }
            set { this.extensions = value; }
        }

        /// <summary>
        /// -zs
        /// </summary>
        public bool OnlyValidateDocuments
        {
            get { return this.onlyValidateDocuments; }
            set { this.onlyValidateDocuments = value; }
        }

        /// <summary>
        /// -out outputFile
        /// </summary>
        public string OutputFile
        {
            get { return this.outputFile; }
            set { this.outputFile = value; }
        }

        /// <summary>
        /// -pedantic
        /// </summary>
        public bool Pedantic
        {
            get { return this.pedantic; }
            set { this.pedantic = value; }
        }

        /// <summary>
        /// <![CDATA[-p<file>]]>
        /// </summary>
        public string PreProcessFile
        {
            get { return this.preProcessFile; }
            set { this.preProcessFile = value; }
        }

        /// <summary>
        /// <![CDATA[-d<name>=<value>]]>  
        /// </summary>
        public Dictionary<string, string> PreProcessorParams
        {
            get { return this.preProcessorParams; }
            set { this.preProcessorParams = value; }
        }

        /// <summary>
        /// <![CDATA[-I<dir>]]> 
        /// </summary>
        public List<string> IncludeSearchPaths
        {
            get { return this.includeSearchPaths; }
            set { this.includeSearchPaths = value; }
        }

        /// <summary>
        /// sourceFile [sourceFile ...]
        /// </summary>
        public List<string> SourceFiles
        {
            get { return this.sourceFiles; }
            set { this.sourceFiles = value; }
        }

        /// <summary>
        ///  Suppress all warnings.
        /// </summary>
        public bool SuppressAllWarnings
        {
            get { return this.suppressAllWarnings; }
            set { this.suppressAllWarnings = value; }
        }

        /// <summary>
        /// -ss
        /// </summary>
        public bool SuppressSchemaValidation
        {
            get { return this.suppressSchemaValidation; }
            set { this.suppressSchemaValidation = value; }
        }

        /// <summary>
        /// -sw[N]
        /// </summary>
        public List<int> SuppressWarnings
        {
            get { return this.suppressWarnings; }
            set { this.suppressWarnings = value; }
        }

        /// <summary>
        /// -trace
        /// </summary>
        public bool Trace
        {
            get { return this.trace; }
            set { this.trace = value; }
        }

        /// <summary>
        /// Treat all warnings as errors.
        /// </summary>
        public bool TreatAllWarningsAsErrors
        {
            get { return this.treatAllWarningsAsErrors; }
            set { this.treatAllWarningsAsErrors = value; }
        }

        /// <summary>
        /// -wx[N]
        /// </summary>
        public List<int> TreatWarningsAsErrors
        {
            get { return this.treatWarningsAsErrors; }
            set { this.treatWarningsAsErrors = value; }
        }

        /// <summary>
        /// -v
        /// </summary>
        public bool VerboseOutput
        {
            get { return this.verboseOutput; }
            set { this.verboseOutput = value; }
        }

        #endregion

        /// <summary>
        /// Clears all of the assigned arguments and resets them to the default values.
        /// </summary>
        public override void SetDefaultArguments()
        {
            this.Extensions = new List<string>();
            this.OnlyValidateDocuments = false;
            this.OutputFile = String.Empty;
            this.Pedantic = false;
            this.PreProcessFile = String.Empty;
            this.PreProcessorParams = new Dictionary<string, string>();
            this.IncludeSearchPaths = new List<string>();
            this.SourceFiles = new List<string>();
            this.SuppressAllWarnings = false;
            this.SuppressSchemaValidation = false;
            this.SuppressWarnings = new List<int>();
            this.Trace = false;
            this.TreatAllWarningsAsErrors = false;
            this.TreatWarningsAsErrors = new List<int>();
            this.VerboseOutput = false;
        }
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.