当前位置: 首页>>代码示例>>C#>>正文


C# ITextDocument.LoadChars方法代码示例

本文整理汇总了C#中ITextDocument.LoadChars方法的典型用法代码示例。如果您正苦于以下问题:C# ITextDocument.LoadChars方法的具体用法?C# ITextDocument.LoadChars怎么用?C# ITextDocument.LoadChars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITextDocument的用法示例。


在下文中一共展示了ITextDocument.LoadChars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FileCompiler

        /// <summary>
        /// Common internal implementation for all 4 constructors above
        /// </summary>
        private FileCompiler(string libraryName, string textName, CobolFile loadedCobolFile, SourceFileProvider sourceFileProvider, IProcessedTokensDocumentProvider documentProvider, ColumnsLayout columnsLayout, ITextDocument textDocument, TypeCobolOptions compilerOptions, CodeModel.SymbolTable customSymbols, bool isCopyFile)
        {
            // 1.a Find the Cobol source file
            CobolFile sourceFile = null;
            if (textName != null)
            {
                if (sourceFileProvider.TryGetFile(libraryName, textName, out sourceFile))
                {
                    CobolFile = sourceFile;
                }
                else
                {
                    throw new Exception(String.Format("Could not find a Cobol source file named {0}", textName));
                }
            }
            // 1.b Register a Cobol source file which was already loaded
            else if(loadedCobolFile != null)
            {
                CobolFile = loadedCobolFile;
            }

            // 2.a Load it in a new text document in memory
            if (textDocument == null)
            {
                TextDocument = new ReadOnlyTextDocument(sourceFile.Name, sourceFile.Encoding, columnsLayout, sourceFile.ReadChars());
            }
            // 2.b Load it in an existing text document in memory
            else if (sourceFile != null)
            {
                TextDocument = textDocument;
                textDocument.LoadChars(sourceFile.ReadChars());
            }
            // 2.c Use a pre-existing text document
            //     - not yet associated with a Cobol source file
            //     - with a Cobol source file already loaded
            else if (sourceFile == null || loadedCobolFile != null)
            {
                TextDocument = textDocument;
            }

            // 3. Prepare the data structures used by the different steps of the compiler
            if (isCopyFile) {
                CompilationResultsForCopy = new CompilationDocument(TextDocument.Source, TextDocument.Lines, compilerOptions, documentProvider);
                CompilationResultsForCopy.CustomSymbols = customSymbols;
            } else {
                CompilationResultsForProgram = new CompilationUnit(TextDocument.Source, TextDocument.Lines, compilerOptions, documentProvider);
                CompilationResultsForProgram.CustomSymbols = customSymbols;
            }
            CompilerOptions = compilerOptions;
        }
开发者ID:laurentprudhon,项目名称:TypeCobol,代码行数:53,代码来源:FileCompiler.cs


注:本文中的ITextDocument.LoadChars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。