本文整理汇总了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;
}