public LargeTextSourceDocument(StreamReader reader, int chunkMaxLength, Encoding encoding, RazorSourceDocumentProperties properties)
    {
        if (reader == null)
        {
            throw new ArgumentNullException(nameof(reader));
        }

        if (encoding == null)
        {
            throw new ArgumentNullException(nameof(encoding));
        }

        if (properties == null)
        {
            throw new ArgumentNullException(nameof(properties));
        }

        _chunkMaxLength = chunkMaxLength;
        Encoding        = encoding;
        FilePath        = properties.FilePath;
        RelativePath    = properties.RelativePath;

        ReadChunks(reader, _chunkMaxLength, out _length, out _chunks);
        _lines = new DefaultRazorSourceLineCollection(this);
    }
Exemple #2
0
        public TextSnapshotSourceDocument(ITextSnapshot snapshot, string filePath)
        {
            if (snapshot == null)
            {
                throw new ArgumentNullException(nameof(snapshot));
            }

            if (filePath == null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            _buffer  = snapshot;
            FilePath = filePath;

            _lines = new DefaultRazorSourceLineCollection(this);
        }
    public StringSourceDocument(string content, Encoding encoding, RazorSourceDocumentProperties properties)
    {
        if (content == null)
        {
            throw new ArgumentNullException(nameof(content));
        }

        if (encoding == null)
        {
            throw new ArgumentNullException(nameof(encoding));
        }

        if (properties == null)
        {
            throw new ArgumentNullException(nameof(properties));
        }

        _content     = content;
        Encoding     = encoding;
        FilePath     = properties.FilePath;
        RelativePath = properties.RelativePath;

        _lines = new DefaultRazorSourceLineCollection(this);
    }