44 references to From
BuildValidator (1)
LocalSourceResolver.cs (1)
51var sourceText = SourceText.From(fileStream, encoding: sourceTextInfo.SourceTextEncoding, checksumAlgorithm: sourceTextInfo.HashAlgorithm, canBeEmbedded: false);
Microsoft.CodeAnalysis (3)
EncodedStringText.cs (1)
156return SourceText.From(data, encoding, checksumAlgorithm, throwIfBinaryDetected, canBeEmbedded);
Text\SourceText.cs (2)
144=> From(stream, encoding, checksumAlgorithm, throwIfBinaryDetected, canBeEmbedded: false); 414/// <see cref="From(Stream, Encoding, SourceHashAlgorithm, bool, bool)"/>, then the canBeEmbedded arg must have
Microsoft.CodeAnalysis.CodeStyle (1)
EncodedStringText.cs (1)
156return SourceText.From(data, encoding, checksumAlgorithm, throwIfBinaryDetected, canBeEmbedded);
Microsoft.CodeAnalysis.CSharp.Scripting (1)
CSharpScript.cs (1)
54return Script.CreateInitialScript<T>(CSharpScriptCompiler.Instance, SourceText.From(code, options?.FileEncoding), options, globalsType, assemblyLoader);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (2)
314var sourceText = SourceText.From(new MemoryStream(encoding.GetBytesWithPreamble(source.content)), encoding, checksumAlgorithm); 369return SourceText.From(stream, Encoding.UTF8, SourceHashAlgorithms.Default);
Microsoft.CodeAnalysis.Features (1)
EditAndContinue\CommittedSolution.cs (1)
450var sourceText = SourceText.From(fileStream, encoding, checksumAlgorithm);
Microsoft.CodeAnalysis.Rebuild (1)
CompilationOptionsReader.cs (1)
236var embeddedText = SourceText.From(stream, encoding: sourceTextInfo.SourceTextEncoding, checksumAlgorithm: sourceTextInfo.HashAlgorithm, canBeEmbedded: true);
Microsoft.CodeAnalysis.Scripting (1)
Script.cs (1)
130return new Script<TResult>(Compiler, Builder, SourceText.From(code, options.FileEncoding), options, GlobalsType, this);
Microsoft.CodeAnalysis.UnitTests (28)
EmbeddedTextTests.cs (2)
43Assert.Throws<ArgumentException>("text", () => EmbeddedText.FromSource("path", SourceText.From(new MemoryStream(new byte[0]), Encoding.UTF8, canBeEmbedded: false))); 236SourceText.From(new MemoryStream(bytes), Encoding.ASCII, SourceHashAlgorithm.Sha1, canBeEmbedded: true) :
Text\LargeTextTests.cs (1)
123var text = SourceText.From(stream);
Text\SourceTextTests.cs (18)
30TestIsEmpty(SourceText.From(new MemoryStream())); 54Assert.Same(s_unicode, SourceText.From(stream, s_unicode).Encoding); 55Assert.Equal(utf8NoBOM, SourceText.From(stream, null).Encoding); 68Assert.Equal(utf8BOM, SourceText.From(stream, s_unicode).Encoding); 69Assert.Equal(utf8BOM, SourceText.From(stream, null).Encoding); 81Assert.Equal(SourceHashAlgorithm.Sha1, SourceText.From(stream).ChecksumAlgorithm); 95Assert.Equal(algorithm, SourceText.From(stream, checksumAlgorithm: algorithm).ChecksumAlgorithm); 131VerifyChecksum(SourceText.From(streamNoBOM, null, checksumAlgorithm), checksumNoBOM); 132VerifyChecksum(SourceText.From(streamNoBOM, encodingNoBOM, checksumAlgorithm), checksumNoBOM); 133VerifyChecksum(SourceText.From(streamNoBOM, encodingBOM, checksumAlgorithm), checksumNoBOM); 136VerifyChecksum(SourceText.From(streamBOM, null, checksumAlgorithm), checksumBOM); 137VerifyChecksum(SourceText.From(streamBOM, encodingNoBOM, checksumAlgorithm), checksumBOM); 138VerifyChecksum(SourceText.From(streamBOM, encodingBOM, checksumAlgorithm), checksumBOM); 162VerifyChecksum(FromChanges(SourceText.From(streamNoBOM, encodingNoBOM, checksumAlgorithm)), checksumNoBOM); 163VerifyChecksum(FromChanges(SourceText.From(streamNoBOM, encodingBOM, checksumAlgorithm)), checksumBOM); 166VerifyChecksum(FromChanges(SourceText.From(streamBOM, encodingNoBOM, checksumAlgorithm)), checksumBOM); 167VerifyChecksum(FromChanges(SourceText.From(streamBOM, encodingBOM, checksumAlgorithm)), checksumBOM); 243Assert.Throws<InvalidDataException>(() => SourceText.From(stream, throwIfBinaryDetected: true));
Text\StringTextTest.cs (7)
75Assert.Throws<ArgumentNullException>(() => SourceText.From((Stream)null, Encoding.UTF8)); 76Assert.Throws<ArgumentException>(() => SourceText.From(new TestStream(canRead: false, canSeek: true), Encoding.UTF8)); 77Assert.Throws<NotImplementedException>(() => SourceText.From(new TestStream(canRead: true, canSeek: false), Encoding.UTF8)); 234var source = SourceText.From(new MemoryStream(bytes), Encoding.ASCII); 249var source = SourceText.From(new MemoryStream(bytes), Encoding.ASCII); 261var source = SourceText.From(new MemoryStream(bytes)); 276var source = SourceText.From(stream, Encoding.ASCII);
Microsoft.CodeAnalysis.Workspaces (1)
EncodedStringText.cs (1)
156return SourceText.From(data, encoding, checksumAlgorithm, throwIfBinaryDetected, canBeEmbedded);
Microsoft.VisualStudio.LanguageServices (1)
Implementation\AbstractEditorFactory.cs (1)
407return SourceText.From(stream);
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
ProjectSystemShim\TempPECompiler.TempPEProject.vb (1)
36Return SyntaxFactory.ParseSyntaxTree(SourceText.From(stream), options:=_parseOptions, path:=path)
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Implementation\LanguageServer\Handler\Definitions\GoToDefinitionHandler.cs (1)
130var sourceText = SourceText.From(fileStream);
Roslyn.VisualStudio.DiagnosticsWindow (1)
Panels\WorkspacePanel.xaml.cs (1)
95var fileText = SourceText.From(fileStream, snapshotText.Encoding, snapshotText.ChecksumAlgorithm);