menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class StreamsWrapper - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class StreamsWrapper

    Represents a class that helps to manages the co-operational work of the ChangesStream, RegexTokenizer and ParsePointManager.

    Inheritance
    System.Object
    StreamsWrapper
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Windows.Forms.Edit.Implementation.IO
    Assembly: Syncfusion.Edit.Windows.dll
    Syntax
    public class StreamsWrapper

    Constructors

    StreamsWrapper(Stream, NewLineStyle)

    Initializes a new instance of the StreamsWrapper class.

    Declaration
    public StreamsWrapper(Stream input, NewLineStyle newLineStyle)
    Parameters
    Type Name Description
    System.IO.Stream input

    Input data Stream

    NewLineStyle newLineStyle

    Style of new line.

    StreamsWrapper(Stream, NewLineStyle, Encoding)

    Initializes a new instance of the StreamsWrapper class.

    Declaration
    public StreamsWrapper(Stream input, NewLineStyle newLineStyle, Encoding encoding)
    Parameters
    Type Name Description
    System.IO.Stream input

    Input data Stream

    NewLineStyle newLineStyle

    Style of new line.

    System.Text.Encoding encoding

    Encoding to use.

    StreamsWrapper(String)

    Initializes a new instance of the StreamsWrapper class that must receive a file name and try to open it.

    Declaration
    public StreamsWrapper(string fileName)
    Parameters
    Type Name Description
    System.String fileName

    File name.

    StreamsWrapper(String, FileMode)

    Initializes a new instance of the StreamsWrapper class that should allow to control mode of file open operation

    Declaration
    public StreamsWrapper(string fileName, FileMode mode)
    Parameters
    Type Name Description
    System.String fileName

    File name.

    System.IO.FileMode mode

    A FileMode constant that determines how to open or create the file.

    StreamsWrapper(String, FileMode, FileAccess)

    Initializes a new instance of the StreamsWrapper class that should allow to control File open mode and access flags

    Declaration
    public StreamsWrapper(string fileName, FileMode mode, FileAccess access)
    Parameters
    Type Name Description
    System.String fileName

    File name.

    System.IO.FileMode mode

    A FileMode constant that determines how to open or create the file.

    System.IO.FileAccess access

    A FileAccess constant that determines how the file can be accessed by the TokenStream object. This gets the CanRead and CanWrite properties of the FileStream object. CanSeek is true if path specifies a disk file.

    StreamsWrapper(String, FileMode, FileAccess, FileShare)

    Initializes a new instance of the StreamsWrapper class that should allow to specify parameter of stream open

    Declaration
    public StreamsWrapper(string fileName, FileMode mode, FileAccess access, FileShare share)
    Parameters
    Type Name Description
    System.String fileName

    File name

    System.IO.FileMode mode

    A FileMode constant that determines how to open or create the file.

    System.IO.FileAccess access

    A FileAccess constant that determines how the file can be accessed by the TokenStream object. This gets the CanRead and CanWrite properties of the FileStream object. CanSeek is true if path specifies a disk file

    System.IO.FileShare share

    A FileShare constant that determines how the file will be shared by processes

    Fields

    DEF_BUFFER_SIZE

    Stream buffer used for optimizing speed of read/write operations

    Declaration
    protected const int DEF_BUFFER_SIZE = 8192
    Field Value
    Type
    System.Int32

    DEF_SEARCH_DATA_GROUP

    Holds the name of the data group for search.

    Declaration
    public const string DEF_SEARCH_DATA_GROUP = "Grp_4A719BA8B7594cb08B1779B91851604D"
    Field Value
    Type
    System.String

    Properties

    AutoPush

    Gets or sets AutoPush property of the ChangesStream.

    Declaration
    public int AutoPush { get; set; }
    Property Value
    Type
    System.Int32

    CanRedo

    Gets a value indicating whether redo operation can be performed or not.

    Declaration
    public bool CanRedo { get; }
    Property Value
    Type
    System.Boolean

    CanUndo

    Gets a value indicating whether undo operation can be performed or not.

    Declaration
    public bool CanUndo { get; }
    Property Value
    Type
    System.Boolean

    CanWrite

    Gets a value indicating whether the stream supports write operation or not.

    Declaration
    public bool CanWrite { get; }
    Property Value
    Type
    System.Boolean

    CaseSensitive

    Gets or sets a value indicating whether the stream is case sensitivity or not.

    Declaration
    public bool CaseSensitive { get; set; }
    Property Value
    Type
    System.Boolean

    Encoding

    Gets the currently used encoding.

    Declaration
    public Encoding Encoding { get; }
    Property Value
    Type
    System.Text.Encoding

    IsEOF

    Gets a value indicating whether we have reached end of file or not.

    Declaration
    public bool IsEOF { get; }
    Property Value
    Type
    System.Boolean

    Length

    Gets the total length of the stream.

    Declaration
    public long Length { get; }
    Property Value
    Type
    System.Int64

    LikeVisualStudioEditorSearch

    Gets or sets a value indicating whether the searching text is same as like in visual studio editor

    Declaration
    public bool LikeVisualStudioEditorSearch { get; set; }
    Property Value
    Type
    System.Boolean

    LinesCount

    Gets the lines count in stream.

    Declaration
    public int LinesCount { get; }
    Property Value
    Type
    System.Int32

    MultiCharTokens

    Gets or sets the array of tokens, that consists of more than one splitters.

    Declaration
    public Split[] MultiCharTokens { get; set; }
    Property Value
    Type
    Split[]

    NewLineSize

    Gets the size (in bytes) of the new-line symbol.

    Declaration
    public int NewLineSize { get; }
    Property Value
    Type
    System.Int32

    NewLineStr

    Gets or sets the line end symbols (/r, /n, /r/n)

    Declaration
    public string NewLineStr { get; set; }
    Property Value
    Type
    System.String

    NewLineStyle

    Gets or sets the style of new line of underlying stream.

    Declaration
    public NewLineStyle NewLineStyle { get; set; }
    Property Value
    Type
    NewLineStyle

    NewLineStyleDetected

    Gets a value indicating whether new line style was detected or not.

    Declaration
    public bool NewLineStyleDetected { get; }
    Property Value
    Type
    System.Boolean

    ParsePointsCount

    Gets the count of the parse point.

    Declaration
    public int ParsePointsCount { get; }
    Property Value
    Type
    System.Int32

    Position

    Gets or sets the current position in the stream.

    Declaration
    public long Position { get; set; }
    Property Value
    Type
    System.Int64

    Version

    Gets the current version of the wrapper. It is incremented on every insert, delete or replace.

    Declaration
    public int Version { get; }
    Property Value
    Type
    System.Int32

    Methods

    CalculateTextData(ref String, out Int32, out Int32)

    Calculates parameters of the text.

    Declaration
    public virtual void CalculateTextData(ref string str, out int LinesCount, out int LastLineCharsCount)
    Parameters
    Type Name Description
    System.String str

    Text to process.

    System.Int32 LinesCount

    OUT count of lines in text.

    System.Int32 LastLineCharsCount

    OUT length of the last line.

    Close(Boolean)

    Closes internal stream. It is no longer accessible.

    Declaration
    public void Close(bool closeInput)
    Parameters
    Type Name Description
    System.Boolean closeInput

    ConvertNewLines(String)

    Converts all new-line symbols in string. All new line symbols are converted to \n.

    Declaration
    public string ConvertNewLines(string str)
    Parameters
    Type Name Description
    System.String str

    String to be converted.

    Returns
    Type Description
    System.String

    Converted string.

    DeleteText(IParsePoint, IParsePoint)

    Deletes the text within the specified range. Start and end are not included into the deletion range.

    Declaration
    public int DeleteText(IParsePoint start, IParsePoint end)
    Parameters
    Type Name Description
    IParsePoint start

    Start ParsePoint.

    IParsePoint end

    End ParsePoint.

    Returns
    Type Description
    System.Int32

    Number of deleted bytes.

    FindNext(IParsePoint, Regex, Boolean)

    Searches the text specified by regular expression in stream.

    Declaration
    public FindResult FindNext(IParsePoint start, Regex expression, bool searchUp)
    Parameters
    Type Name Description
    IParsePoint start

    Start position of the search.

    System.Text.RegularExpressions.Regex expression

    Regular expression, used for search.

    System.Boolean searchUp

    Indicates whether search should be performed bottom-up.

    Returns
    Type Description
    FindResult

    Result of the search. Never can be null.

    Remarks

    If you want to treat as found sub-string just some part of the text, than you have to wrap this search part in to a named group with name "data".

    FindNext(IParsePoint, Regex, Boolean, Boolean)

    Searches text as like in visual studio editor.

    Declaration
    public FindResult FindNext(IParsePoint start, Regex expression, bool searchUp, bool isSelection)
    Parameters
    Type Name Description
    IParsePoint start

    Start position of the search.

    System.Text.RegularExpressions.Regex expression

    Regular expression, used for search.

    System.Boolean searchUp

    Indicates whether search should be performed bottom-up.

    System.Boolean isSelection

    isSelection

    Returns
    Type Description
    FindResult

    Result of the search. Never can be null.

    Remarks

    If you want to treat as found sub-string just some part of the text, than you have to wrap this search part in to a named group with name "data".

    FlushChanges()

    Flushes all changes.

    Declaration
    public void FlushChanges()

    ForceFileRescan()

    Rescans line count in file and updates line-start ParsePoints

    Declaration
    public void ForceFileRescan()

    FromString(String)

    Initializes StreamsWrapper from string input

    Declaration
    public static StreamsWrapper FromString(string buffer)
    Parameters
    Type Name Description
    System.String buffer

    String with input data

    Returns
    Type Description
    StreamsWrapper

    StreamsWrapper Object

    GetFirstRedoItem()

    Gets the first (the highest) redo item from the undo stack.

    Declaration
    public WrapperUndoItem GetFirstRedoItem()
    Returns
    Type Description
    WrapperUndoItem

    First redo item.

    GetFirstUndoItem()

    Gets the first (the highest) undo item from the undo stack.

    Declaration
    public WrapperUndoItem GetFirstUndoItem()
    Returns
    Type Description
    WrapperUndoItem

    First undo item.

    GetParsePoint(Int32, Int32)

    Gets parse point by given physical coordinates.

    Declaration
    public ParsePoint GetParsePoint(int x, int y)
    Parameters
    Type Name Description
    System.Int32 x

    X-coordinate of point to retrieve.

    System.Int32 y

    X-coordinate of point to retrieve.

    Returns
    Type Description
    Syncfusion.Windows.Forms.Edit.Implementation.IO.ParsePoint

    Parse point with given coordinates.

    GetParsePoint(Int32, Int32, out IParsePoint, out IParsePoint, Boolean)

    Searches for the ParsePoint in given position. If there is no ParsePoint, but such position exists in file, new ParsePoint will be created.

    Declaration
    public IParsePoint GetParsePoint(int line, int column, out IParsePoint leftNearest, out IParsePoint rightNearest, bool create)
    Parameters
    Type Name Description
    System.Int32 line

    Positions line

    System.Int32 column

    Positions column

    IParsePoint leftNearest

    Nearest ParsePoint from the left

    IParsePoint rightNearest

    Nearest ParsePoint from the right

    System.Boolean create

    If false, you have not remove returned ParsePoint after usage. Also newly created ParsePoint will not be added to update list if thi parameter is false.

    Returns
    Type Description
    IParsePoint

    IParsePoint interface of the found/created ParsePoint

    GetParsePoint(Int32, Int32, out IParsePoint, out IParsePoint, Boolean, Boolean)

    Searches for the ParsePoint in given position. If there is no ParsePoint, but such position exists in file, new ParsePoint will be created.

    Declaration
    public IParsePoint GetParsePoint(int line, int column, out IParsePoint leftNearest, out IParsePoint rightNearest, bool create, bool bAllowVirtualSpace)
    Parameters
    Type Name Description
    System.Int32 line

    Positions line

    System.Int32 column

    Positions column

    IParsePoint leftNearest

    Nearest ParsePoint from the left

    IParsePoint rightNearest

    Nearest ParsePoint from the right

    System.Boolean create

    If false, you have not remove returned ParsePoint after usage. Also newly created ParsePoint will not be added to update list if thi parameter is false.

    System.Boolean bAllowVirtualSpace

    Indicates whether virtual space is allowed. If false, exeption is thrown if given column is in virtual space.

    Returns
    Type Description
    IParsePoint

    IParsePoint interface of the found/created ParsePoint

    GetParsePoint(Int32, Int32, Boolean)

    Searches for the ParsePoint in given position. If there is no ParsePoint, but such position exists in file, new ParsePoint will be created.

    Declaration
    public IParsePoint GetParsePoint(int line, int column, bool create)
    Parameters
    Type Name Description
    System.Int32 line

    Positions line

    System.Int32 column

    Positions column

    System.Boolean create

    If false, you have not remove returned ParsePoint after usage. Also newly created ParsePoint will not be added to update list if thi parameter is false.

    Returns
    Type Description
    IParsePoint

    IParsePoint interface of the found/created ParsePoint

    GetParsePoint(Int64)

    Retrieves ParsePoint by given offset in stream.

    Declaration
    public IParsePoint GetParsePoint(long streamOffset)
    Parameters
    Type Name Description
    System.Int64 streamOffset

    Needed offset in stream.

    Returns
    Type Description
    IParsePoint

    IParsePoint that coresponds to the needed offset.

    GetParsePoint(Object, IComparer)

    Looks for ParsePoint, that is left to the given value.

    Declaration
    public IParsePoint GetParsePoint(object value, IComparer comparer)
    Parameters
    Type Name Description
    System.Object value

    Value, to be found

    System.Collections.IComparer comparer

    Comparer, that is used to find needed value

    Returns
    Type Description
    IParsePoint

    ParsePoint, that is on given Value or left to it

    GetParsePointEnumerator()

    Gets the enumerator for all parse points.

    Declaration
    public IEnumerator GetParsePointEnumerator()
    Returns
    Type Description
    System.Collections.IEnumerator

    Enumerator. Every element is IParsePoint.

    GetParsePointEnumerator(IParsePoint)

    Gets the enumerator for all parse point in range from specified one to the last one.

    Declaration
    public IEnumerator GetParsePointEnumerator(IParsePoint startPoint)
    Parameters
    Type Name Description
    IParsePoint startPoint

    Start of the range.

    Returns
    Type Description
    System.Collections.IEnumerator

    Enumerator. Every element is IParsePoint.

    GetParsePointEnumerator(IParsePoint, IParsePoint)

    Gets the enumerator for all parse point in specified range.

    Declaration
    public IEnumerator GetParsePointEnumerator(IParsePoint startPoint, IParsePoint endPoint)
    Parameters
    Type Name Description
    IParsePoint startPoint

    Start of the range.

    IParsePoint endPoint

    End of the range.

    Returns
    Type Description
    System.Collections.IEnumerator

    Enumerator. Every element is IParsePoint.

    GetTextInRange(IParsePoint, IParsePoint, Boolean)

    Reads text from specified range.

    Declaration
    public string GetTextInRange(IParsePoint start, IParsePoint end, bool bConvert)
    Parameters
    Type Name Description
    IParsePoint start

    Start of the range.

    IParsePoint end

    End of the range.

    System.Boolean bConvert

    Flag, that specifies whether all new-line symbols have to be converted to /n.

    Returns
    Type Description
    System.String

    Text from the stream.

    InsertText(IParsePoint, String)

    Writes string to the stream starting from the given position.

    Declaration
    public int InsertText(IParsePoint position, string str)
    Parameters
    Type Name Description
    IParsePoint position

    ParsePoint of the starting position

    System.String str

    Text to write.

    Returns
    Type Description
    System.Int32

    Number of inserted bytes.

    PeekToken()

    Reads token from stream, but does not advances it's position.

    Declaration
    public string PeekToken()
    Returns
    Type Description
    System.String

    Token.

    RaiseRedoBufferFlushedEvent()

    Raises RedoBufferFlushed event.

    Declaration
    protected virtual void RaiseRedoBufferFlushedEvent()

    RaiseUndoBufferFlushedEvent()

    Raises UndoBufferFlushed event.

    Declaration
    protected virtual void RaiseUndoBufferFlushedEvent()

    RangeChanged(Int64, Int64)

    Checks whether data between given parse points has been changed.

    Declaration
    public bool RangeChanged(long startOffset, long endOffset)
    Parameters
    Type Name Description
    System.Int64 startOffset

    Offset of the beginning of range to check.

    System.Int64 endOffset

    Offset of the end of range to check.

    Returns
    Type Description
    System.Boolean

    Bool indicating whether data in given range has been changed.

    ReadToken()

    Reads token from current stream position.

    Declaration
    public string ReadToken()
    Returns
    Type Description
    System.String

    Token

    ReadToken(IParsePoint)

    Reads token from given position.

    Declaration
    public string ReadToken(IParsePoint position)
    Parameters
    Type Name Description
    IParsePoint position

    ParsePoint with position in the stream.

    Returns
    Type Description
    System.String

    Token.

    Redo()

    Redoes the last undone action.

    Declaration
    public WrapperUndoItem Redo()
    Returns
    Type Description
    WrapperUndoItem

    Undo item that was redone.

    ResetTokensCache()

    Resets tokens cache after any text changes.

    Declaration
    public void ResetTokensCache()

    Save()

    Saves changes to file.

    Declaration
    public void Save()

    SaveTo(Stream)

    Saves data to given stream.

    Declaration
    public void SaveTo(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    Output stream.

    SetNewLinesCount(Int32)

    Sets new value of lines count property and raises LinesCountChanged event.

    Declaration
    protected virtual void SetNewLinesCount(int newValue)
    Parameters
    Type Name Description
    System.Int32 newValue

    New value of the LinesCount property.

    SetPositionAndResetCache(Int64)

    Sets position and resets tokenizer cache.

    Declaration
    public void SetPositionAndResetCache(long pos)
    Parameters
    Type Name Description
    System.Int64 pos

    Position to set.

    SetPositionToParsePoint(IParsePoint)

    Sets current position to the given ParsePoint

    Declaration
    public void SetPositionToParsePoint(IParsePoint point)
    Parameters
    Type Name Description
    IParsePoint point

    IParsePoint interface to the ParsePoint

    Undo()

    Undoes the last action.

    Declaration
    public WrapperUndoItem Undo()
    Returns
    Type Description
    WrapperUndoItem

    Undo item, that was undone.

    Events

    AfterTextChange

    Occurs after updating parsepoints offsets.

    Declaration
    public event EventHandler AfterTextChange
    Event Type
    Type
    System.EventHandler

    BeforeTextChange

    Occurs before updating parse points offsets.

    Declaration
    public event EventHandler BeforeTextChange
    Event Type
    Type
    System.EventHandler

    LineDeleted

    Occurs when lines have been deleted.

    Declaration
    public event LineDeletedEventHandler LineDeleted
    Event Type
    Type
    LineDeletedEventHandler

    LineInserted

    Occurs when lines have been inserted.

    Declaration
    public event LineInsertedEventHandler LineInserted
    Event Type
    Type
    LineInsertedEventHandler

    LinesCountChanged

    Occurs when count of lines has been changed.

    Declaration
    public event ValueChangedEventHandler LinesCountChanged
    Event Type
    Type
    ValueChangedEventHandler

    RedoBufferFlushed

    Occurs when redo buffer is flushed.

    Declaration
    public event EventHandler RedoBufferFlushed
    Event Type
    Type
    System.EventHandler

    UndoBufferFlushed

    Occurs when undo buffer is flushed.

    Declaration
    public event EventHandler UndoBufferFlushed
    Event Type
    Type
    System.EventHandler
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved