Example #1
0
        /// <summary>
        /// Writes the response file for <c>midl.exe</c>.
        /// </summary>
        private void WriteResponseFile(TextWriter writer)
        {
            // suppresses display of the sign-on banner
            writer.WriteLine("/nologo");

            writer.WriteLine("/env " + _env);

            if (_acf != null)
            {
                writer.WriteLine("/acf {0}", _acf);
            }
            if (_align != null)
            {
                writer.WriteLine("/align {0}", _align);
            }
            if (_appConfig)
            {
                writer.WriteLine("/app_config");
            }
            if (_char != null)
            {
                writer.WriteLine("/char {0}", _char);
            }
            if (_client != null)
            {
                writer.WriteLine("/client {0}", _client);
            }
            if (_cstub != null)
            {
                writer.WriteLine("/cstub {0}", _cstub);
            }
            if (_dlldata != null)
            {
                writer.WriteLine("/dlldata \"{0}\"", DllData.FullName);
            }
            if (_Oi != null)
            {
                writer.WriteLine("/Oi" + _Oi);
            }
            if (Tlb != null)
            {
                writer.WriteLine("/tlb \"{0}\"", Tlb.FullName);
            }
            if (_header != null)
            {
                writer.WriteLine("/header \"{0}\"", Header.FullName);
            }
            if (Iid != null)
            {
                writer.WriteLine("/iid \"{0}\"", Iid.FullName);
            }
            if (Proxy != null)
            {
                writer.WriteLine("/proxy \"{0}\"", Proxy.FullName);
            }

            foreach (Option define in Defines)
            {
                if (!define.IfDefined || define.UnlessDefined)
                {
                    continue;
                }

                if (define.Value == null)
                {
                    writer.WriteLine("/D " + ArgumentUtils.FixTrailingBackslash(define.OptionName));
                }
                else
                {
                    writer.WriteLine("/D " + define.OptionName + "=" + ArgumentUtils.FixTrailingBackslash(define.Value));
                }
            }

            foreach (Option undefine in Undefines)
            {
                if (!undefine.IfDefined || undefine.UnlessDefined)
                {
                    continue;
                }

                writer.WriteLine("/U " + ArgumentUtils.QuoteArgumentValue(
                                     undefine.OptionName, BackslashProcessingMethod.Fix));
            }

            foreach (Option option in _options)
            {
                if (IfDefined && !UnlessDefined)
                {
                    if (option.Value == null)
                    {
                        writer.WriteLine(option.OptionName);
                    }
                    else
                    {
                        writer.WriteLine(option.OptionName + " " + option.Value);
                    }
                }
            }

            // append user provided include directories
            foreach (string include in IncludeDirs.DirectoryNames)
            {
                writer.WriteLine("/I {0}", ArgumentUtils.QuoteArgumentValue(
                                     include, BackslashProcessingMethod.Clean));
            }

            writer.WriteLine("\"{0}\"", Filename.FullName);
        }