コード例 #1
0
ファイル: WixTool.cs プロジェクト: fyisa/wix3
        /// <summary>
        /// Perform unordered verification of the list of WixMessages
        /// </summary>
        /// <param name="output">The standard output</param>
        /// <returns>A list of errors encountered during verification</returns>
        private List <string> UnorderedWixMessageVerification(string output)
        {
            List <string> errors = new List <string>();

            if (null == this.ExpectedWixMessages)
            {
                return(errors);
            }

            List <WixMessage> actualWixMessages = this.FindActualWixMessages(output);

            for (int i = 0; i < this.ExpectedWixMessages.Count; i++)
            {
                // If the expectedMessage does not have any specified MessageText then ignore it in a comparison
                bool ignoreText = String.IsNullOrEmpty(this.ExpectedWixMessages[i].MessageText);

                // Flip this bool to true if the expected message is in the list of actual message that were printed
                bool expectedMessageWasFound = false;

                for (int j = 0; j < actualWixMessages.Count; j++)
                {
                    if (null != actualWixMessages[j] && 0 == WixMessage.Compare(actualWixMessages[j], this.ExpectedWixMessages[i], ignoreText))
                    {
                        // Invalidate the message from the list of found errors by setting it to null
                        actualWixMessages[j] = null;

                        expectedMessageWasFound = true;
                    }
                }

                // Check if the expected message was found in the list of actual messages
                if (!expectedMessageWasFound)
                {
                    errors.Add(String.Format("Could not find the expected message: {0}", this.ExpectedWixMessages[i].ToString()));

                    if (String.IsNullOrEmpty(this.ExpectedWixMessages[i].MessageText))
                    {
                        errors.Add("  When unordered WixMessage verification is performed, WixMessage text is not ignored");
                    }
                }
            }

            if (!this.IgnoreExtraWixMessages)
            {
                // Now go through the messages that were found but that weren't expected
                foreach (WixMessage actualWixMessage in actualWixMessages)
                {
                    if (null != actualWixMessage)
                    {
                        errors.Add(String.Format("Found an unexpected message: {0}", actualWixMessage.ToString()));
                    }
                }
            }

            return(errors);
        }
コード例 #2
0
ファイル: DarkStaticMethods.cs プロジェクト: zooba/wix3
        public static string Decompile(
            string inputFile,
            string binaryPath = null,
            WixMessage[] expectedWixMessages = null,
            string[] extensions = null,
            bool noTidy = false,
            bool noLogo = false,
            string otherArguments = null,
            bool setOutputFileIfNotSpecified = true,
            bool suppressDroppingEmptyTables = false,
            bool suppressRelativeActionSequences = false,
            bool suppressUITables = false,
            int[] suppressWarnings = null,
            bool treatWarningsAsErrors = false,
            bool verbose = false,
            bool xmlOutput = false)
        {
            Dark dark = new Dark();

            // set the passed arrguments
            dark.InputFile = inputFile;
            dark.BinaryPath = binaryPath;
            if (null != expectedWixMessages)
            {
                dark.ExpectedWixMessages.AddRange(expectedWixMessages);
            }
            if (null != extensions)
            {
                dark.Extensions.AddRange(extensions);
            }
            dark.NoTidy = noTidy;
            dark.NoLogo = noLogo;
            dark.OtherArguments = otherArguments;
            dark.SetOutputFileIfNotSpecified = setOutputFileIfNotSpecified;
            dark.SuppressDroppingEmptyTables = suppressDroppingEmptyTables;
            dark.SuppressRelativeActionSequences = suppressRelativeActionSequences;
            dark.SuppressUITables = suppressUITables;
            if (null != suppressWarnings)
            {
                dark.SuppressWarnings.AddRange(suppressWarnings);
            }
            dark.TreatWarningsAsErrors = treatWarningsAsErrors;
            dark.Verbose = verbose;
            dark.XmlOutput = xmlOutput;

            dark.Run();

            return dark.OutputFile;
        }
コード例 #3
0
ファイル: WixUnit.cs プロジェクト: lukaswinzenried/WixCustBa
        /// <summary>
        /// Helper method for finding WixUnit errors and warnings in the output
        /// </summary>
        /// <param name="output">The text to search</param>
        /// <returns>A list of WixMessages in the output</returns>
        private List <string> FindWixUnitWixMessages(string output)
        {
            List <string> wixUnitWixMessages = new List <string>();

            foreach (string line in output.Split('\n', '\r'))
            {
                WixMessage wixUnitWixMessage = WixMessage.FindWixMessage(line, WixTools.Wixunit);

                if (null != wixUnitWixMessage)
                {
                    wixUnitWixMessages.Add(wixUnitWixMessage.ToString());
                }
            }

            return(wixUnitWixMessages);
        }
コード例 #4
0
ファイル: WixTool.cs プロジェクト: fyisa/wix3
        /// <summary>
        /// Helper method for finding all the errors and all the warnings in the output
        /// </summary>
        /// <returns>A list of WixMessages in the output</returns>
        private List <WixMessage> FindActualWixMessages(string output)
        {
            List <WixMessage> actualWixMessages = new List <WixMessage>();

            foreach (string line in output.Split('\n', '\r'))
            {
                WixMessage actualWixMessage = WixMessage.FindWixMessage(line);

                if (null != actualWixMessage)
                {
                    actualWixMessages.Add(actualWixMessage);
                }
            }

            return(actualWixMessages);
        }
コード例 #5
0
ファイル: WixTool.cs プロジェクト: fyisa/wix3
        /// <summary>
        /// Perform ordered verification of the list of WixMessages
        /// </summary>
        /// <param name="output">The standard output</param>
        /// <returns>A list of errors encountered during verification</returns>
        private List <string> OrderedWixMessageVerification(string output)
        {
            List <string> errors = new List <string>();

            if (null == this.ExpectedWixMessages)
            {
                return(errors);
            }

            List <WixMessage> actualWixMessages = this.FindActualWixMessages(output);

            for (int i = 0; i < this.ExpectedWixMessages.Count; i++)
            {
                // If the expectedMessage does not have any specified MessageText then ignore it in a comparison
                bool ignoreText = String.IsNullOrEmpty(this.ExpectedWixMessages[i].MessageText);

                if (i >= this.ExpectedWixMessages.Count)
                {
                    // there are more actual WixMessages than expected
                    break;
                }
                else if (i >= actualWixMessages.Count || 0 != WixMessage.Compare(actualWixMessages[i], this.ExpectedWixMessages[i], ignoreText))
                {
                    errors.Add(String.Format("Ordered WixMessage verification failed when trying to find the expected message {0}", expectedWixMessages[i]));
                    break;
                }
                else
                {
                    // the expected WixMessage was found
                    actualWixMessages[i] = null;
                }
            }

            if (!this.IgnoreExtraWixMessages)
            {
                // Now go through the messages that were found but that weren't expected
                foreach (WixMessage actualWixMessage in actualWixMessages)
                {
                    if (null != actualWixMessage)
                    {
                        errors.Add(String.Format("Found an unexpected message: {0}", actualWixMessage.ToString()));
                    }
                }
            }

            return(errors);
        }
コード例 #6
0
        /// <summary>
        /// Check if a line of text contains a WiX message
        /// </summary>
        /// <param name="text">The text to search</param>
        /// <param name="tool">Specifies which tool the message is expected to come from</param>
        /// <returns>A WixMessage if one exists in the text. Otherwise, return null.</returns>
        public static WixMessage FindWixMessage(string text, WixTool.WixTools tool)
        {
            Match messageMatch = WixMessage.GetToolWixMessageRegex(tool).Match(text);

            if (messageMatch.Success)
            {
                int    messageNumber = Convert.ToInt32(messageMatch.Groups["messageNumber"].Value);
                string messageText   = messageMatch.Groups["messageText"].Value;
                Message.MessageTypeEnum messageType = Message.ConvertToMessageTypeEnum(messageMatch.Groups["messageType"].Value);

                return(new WixMessage(messageNumber, messageText, messageType));
            }
            else
            {
                return(null);
            }
        }
コード例 #7
0
ファイル: CandleStaticMethods.cs プロジェクト: zooba/wix3
        public static string[] Compile(
            string[] sourceFiles,
            bool fips = false,        
            WixMessage[] expectedWixMessages = null,
            string[] extensions = null,
            string[] includeSearchPaths = null,
            bool onlyValidateDocuments =false,
            string otherArguments = null,
            bool pedantic = false, 
            string preProcessFile = null,
            Dictionary<string, string> preProcessorParams = null,
            bool setOutputFileIfNotSpecified = true,
            bool suppressAllWarnings = false,
            bool suppressMarkingVitalDefault = false,
            bool suppressSchemaValidation = false,
            int[] suppressWarnings = null,
            bool trace = false,
            int[] treatWarningsAsErrors = null,
            bool treatAllWarningsAsErrors =false,         
            bool verbose = false)
        {
            Candle candle = new Candle();

            if (null == sourceFiles || sourceFiles.Length == 0)
            {
                throw new ArgumentException("sourceFiles cannot be null or empty");
            }

            // set the passed arrguments
            candle.SourceFiles.AddRange(sourceFiles);
            if (null != expectedWixMessages)
            {
                candle.ExpectedWixMessages.AddRange(expectedWixMessages);
            }
            if (null != extensions)
            {
                candle.Extensions.AddRange(extensions);
            }
            candle.FIPS = fips;
            if (null != includeSearchPaths)
            {
                candle.IncludeSearchPaths.AddRange(includeSearchPaths);
            }
            candle.OnlyValidateDocuments = onlyValidateDocuments;
            candle.OtherArguments = otherArguments;
            candle.Pedantic = pedantic;
            candle.PreProcessFile = preProcessFile;
            if (null != preProcessorParams)
            {
                candle.PreProcessorParams = preProcessorParams;
            }
            candle.SetOutputFileIfNotSpecified = setOutputFileIfNotSpecified;
            candle.SuppressAllWarnings = suppressAllWarnings;
            candle.SuppressMarkingVitalDefault = suppressMarkingVitalDefault;
            candle.SuppressSchemaValidation = suppressSchemaValidation;
            if (null != suppressWarnings)
            {
                candle.SuppressWarnings.AddRange(suppressWarnings);
            }
            candle.Trace = trace;
            if (null != treatWarningsAsErrors)
            {
                candle.TreatWarningsAsErrors.AddRange(treatWarningsAsErrors);
            }
            candle.TreatAllWarningsAsErrors = treatAllWarningsAsErrors;
            candle.Verbose= verbose;

            candle.Run();

            return candle.ExpectedOutputFiles.ToArray();
        }
コード例 #8
0
ファイル: LightStaticMethods.cs プロジェクト: Jeremiahf/wix3
        //public static string Link(string sourceFile, string otherArguments)
        //{
        //    return Light.Link(new string[] { sourceFile }, ootherArguments);
        //}
        //public static string Link(string sourceFile, string otherArguments, WixMessage[] expectedMessages)
        //{
        //    return Light.Link(new string[] { sourceFile }, otherArguments, expectedMessages);
        //}
        //public static string Link(string[] sourceFiles, string otherArguments)
        //{
        //    return Light.Link(sourceFiles, otherArguments, null);
        //}
        //public static string Link(string[] sourceFiles, string otherArguments, WixMessage[] expectedMessages)
        //{
        //    return Light.Link(sourceFiles, otherArguments, false, expectedMessages);
        //}
        public static string Link(
          string[] objectFiles,
          bool allowIdenticalRows = false,
          bool allowUnresolvedVariables = false,
          string bindPath = null,
          bool bindFiles = false,
          int cabbingThreads = 0,
          string cachedCabsPath = null,
          string cultures = null,
          WixMessage[] expectedWixMessages = null,
          string[] extensions = null,
          bool fileVersion = false,
          string[] ices = null,
          string[] locFiles = null,
          bool noTidy = false,
          string otherArguments = null,
          bool pedantic = false,
          bool reuseCab = false,
          bool setOutputFileIfNotSpecified = true,
          bool suppressACL = false,
          bool suppressAdmin = false,
          bool suppressADV = false,
          bool suppressAllWarnings = false,
          bool suppressAssemblies = false,
          bool suppressDroppingUnrealTables = false,
          string[] suppressedICEs = null,
          bool suppressFiles = false,
          bool suppressFileInfo = false,
          bool suppressIntermediateFileVersionCheck = false,
          bool suppressLayout = false,
          bool suppressMSIAndMSMValidation = false,
          bool suppressProcessingMSIAsmTable = false,
          bool suppressSchemaValidation = false,
          bool suppressUI = false,
          string[] suppressWarnings = null,
          bool tagSectionId = false,
          bool tagSectionIdAndGenerateWhenNull = false,
          bool treatAllWarningsAsErrors = false,
          int[] treatWarningsAsErrors = null,
          string unreferencedSymbolsFile = null,
          bool verbose = false,
          StringDictionary wixVariables = null,
          bool xmlOutput = false)
        {
            Light light = new Light();

            if (null == objectFiles || objectFiles.Length == 0)
            {
                throw new ArgumentException("objectFiles cannot be null or empty");
            }

            // set the passed arrguments
            light.ObjectFiles.AddRange(objectFiles);
            light.AllowIdenticalRows = allowIdenticalRows;
            light.AllowUnresolvedVariables = allowUnresolvedVariables;
            light.BindPath = bindPath;
            light.BindFiles = bindFiles;
            light.CabbingThreads = cabbingThreads;
            light.CachedCabsPath = cachedCabsPath;
            light.Cultures = cultures;
            if (null != expectedWixMessages)
            {
                light.ExpectedWixMessages.AddRange(expectedWixMessages);
            }
            if (null != extensions)
            {
                light.Extensions.AddRange(extensions);
            }
            light.FileVersion = fileVersion;
            if (null != ices)
            {
                light.ICEs.AddRange(ices);
            }
            if (null != locFiles)
            {
                light.LocFiles.AddRange(locFiles);
            }
            light.NoTidy = noTidy;
            light.OtherArguments = otherArguments;
            light.Pedantic = pedantic;
            light.ReuseCab = reuseCab;
            light.SetOutputFileIfNotSpecified = setOutputFileIfNotSpecified;
            light.SuppressACL = suppressACL;
            light.SuppressAdmin = suppressAdmin;
            light.SuppressADV = suppressADV;
            light.SuppressAllWarnings = suppressAllWarnings;
            light.SuppressAssemblies = suppressAssemblies;
            light.SuppressDroppingUnrealTables = suppressDroppingUnrealTables;
            if (null != suppressedICEs)
            {
                light.SuppressedICEs.AddRange(suppressedICEs);
            }
            light.SuppressFiles = suppressFiles;
            light.SuppressFileInfo = suppressFileInfo;
            light.SuppressIntermediateFileVersionCheck = suppressIntermediateFileVersionCheck;
            light.SuppressLayout = suppressLayout;
            light.SuppressMSIAndMSMValidation = suppressMSIAndMSMValidation;
            light.SuppressProcessingMSIAsmTable = suppressProcessingMSIAsmTable;
            light.SuppressSchemaValidation = suppressSchemaValidation;
            light.SuppressUI = suppressUI;
            if (null != suppressWarnings)
            {
                light.SuppressWarnings.AddRange(suppressWarnings);
            }
            light.TagSectionId = tagSectionId;
            light.TagSectionIdAndGenerateWhenNull = tagSectionIdAndGenerateWhenNull;
            light.TreatAllWarningsAsErrors = treatAllWarningsAsErrors;
            if (null != treatWarningsAsErrors)
            {
                light.TreatWarningsAsErrors.AddRange(treatWarningsAsErrors);
            }
            light.UnreferencedSymbolsFile = unreferencedSymbolsFile;
            light.Verbose = verbose;
            if (null != wixVariables)
            {
                foreach (string key in wixVariables.Keys)
                {
                    if (!light.WixVariables.ContainsKey(key))
                    {
                        light.WixVariables.Add(key, wixVariables[key]);
                    }
                    else
                    {
                        light.WixVariables[key] = wixVariables[key];
                    }
                }
            }
            light.XmlOutput = xmlOutput;

            light.Run();

            return light.OutputFile;
        }
コード例 #9
0
 /// <summary>
 /// Check if a line of text contains a WiX message
 /// </summary>
 /// <param name="text">The text to search</param>
 /// <returns>A WixMessage if one exists in the text. Otherwise, return null.</returns>
 public static WixMessage FindWixMessage(string text)
 {
     return(WixMessage.FindWixMessage(text, WixTool.WixTools.Any));
 }