コード例 #1
0
        public override bool Execute()
        {
            if (!File.Exists(ChangelogFilePath))
            {
                Log.LogError($"Could not found changelog file {ChangelogFilePath}");
                return(false);
            }

            using var inputStream   = new FileStream(ChangelogFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
            using var inputMdStream = new MarkdownStream(inputStream);

            if (OutputType.Equals("PlainText", StringComparison.OrdinalIgnoreCase))
            {
                ChangelogSectionContent = GetResult(
                    new MarkdownToPlainTextConverter().ExtractVersionSectionPlainText(inputMdStream));
            }
            else if (OutputType.Equals("Markdown", StringComparison.OrdinalIgnoreCase))
            {
                ChangelogSectionContent = GetResult(
                    new MarkdownToMarkdownConverter().ExtractVersionSection(inputMdStream));
            }
            else
            {
                Log.LogError($"Couldn't parse OutputType = {OutputType}");
                return(false);
            }

            return(true);
        }
コード例 #2
0
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }
            KomahubOutput other = (KomahubOutput)obj;

            return(type.Equals(other.type) && name.Equals(other.name) && fuseCurrent == other.fuseCurrent);
        }
コード例 #3
0
        //
        // Call MarkupCompiler to do the real compilation work.
        //
        private void DoLocalReferenceMarkupCompilation(FileUnit localApplicationFile, FileUnit[] localXamlPageFileList, ArrayList referenceList)
        {
            // When code goes here, the MarkupCompilation is really required, so don't need
            // to do more further validation inside this private method.

            Log.LogMessageFromResources(MessageImportance.Low, SRID.DoCompilation);

            AppDomain       appDomain       = null;
            CompilerWrapper compilerWrapper = null;

            try
            {
                compilerWrapper = TaskHelper.CreateCompilerWrapper(AlwaysCompileMarkupFilesInSeparateDomain, ref appDomain);

                if (compilerWrapper != null)
                {
                    compilerWrapper.OutputPath = OutputPath;

                    compilerWrapper.TaskLogger               = Log;
                    compilerWrapper.UnknownErrorID           = UnknownErrorID;
                    compilerWrapper.XamlDebuggingInformation = XamlDebuggingInformation;

                    compilerWrapper.TaskFileService = _taskFileService;

                    if (OutputType.Equals(SharedStrings.Exe) || OutputType.Equals(SharedStrings.WinExe))
                    {
                        compilerWrapper.ApplicationMarkup = localApplicationFile;
                    }

                    compilerWrapper.References = referenceList;

                    compilerWrapper.LocalizationDirectivesToLocFile = (int)_localizationDirectives;

                    // This is for Pass2 compilation
                    compilerWrapper.DoCompilation(AssemblyName, Language, RootNamespace, localXamlPageFileList, true);

                    //
                    // If no any xaml file with local-types wants to reference an internal type from
                    // current assembly and friend assembly, and InternalTypeHelperFile is set in the
                    // cache file, now it is the time to remove the content of InternalTypeHelper File.
                    //
                    // We still keep the empty file to make other parts of the build system happy.
                    //
                    if (!String.IsNullOrEmpty(_internalTypeHelperFile) && !compilerWrapper.HasInternals)
                    {
                        if (TaskFileService.Exists(_internalTypeHelperFile))
                        {
                            // Make empty content for this file.

                            MemoryStream memStream = new MemoryStream();

                            using (StreamWriter writer = new StreamWriter(memStream, new UTF8Encoding(false)))
                            {
                                writer.WriteLine(String.Empty);
                                writer.Flush();
                                TaskFileService.WriteFile(memStream.ToArray(), _internalTypeHelperFile);
                            }

                            Log.LogMessageFromResources(MessageImportance.Low, SRID.InternalTypeHelperNotRequired, _internalTypeHelperFile);
                        }
                    }
                }
            }
            finally
            {
                if (compilerWrapper != null && compilerWrapper.ErrorTimes > 0)
                {
                    _nErrors += compilerWrapper.ErrorTimes;
                }

                if (appDomain != null)
                {
                    AppDomain.Unload(appDomain);
                    compilerWrapper = null;
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Displays the given <see cref="string"/> associated to the given <see cref="OutputType"/> in the current line.
 /// </summary>
 /// <param name="output">
 /// A <see cref="string"/> to be displayed.
 /// </param>
 /// <param name="outputType">
 /// An <see cref="OutputType"/> indicating the way the <paramref name="output"/> should be displayed. If the <paramref name="outputType"/> differs from the <see cref="OutputType"/> of the current
 /// line, <see cref="WriteLine(string, OutputType)"/> is called.
 /// </param>
 internal static void Write(string output, OutputType outputType)
 {
     if ((Console.outputStrings.Count == 0 || Console.outputTypes.Count == 0) || !outputType.Equals(Console.outputTypes.Last <OutputType>()))
     {
         Console.WriteLine(output, outputType);
     }
     else
     {
         string newOutputLine = Console.outputStrings.Last <string>() + output;
         Console.outputStrings[Console.outputStrings.Count - 1] = newOutputLine;
     }
 }