menu

WinForms

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

    Show / Hide Table of Contents

    Class ChangesStream

    Represents a class that provides data for the stream, that tracks changes.

    Inheritance
    System.Object
    System.MarshalByRefObject
    System.IO.Stream
    ChangesStream
    Implements
    System.IDisposable
    IChangesStream
    IStream
    Inherited Members
    System.IO.Stream.BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
    System.IO.Stream.BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
    System.IO.Stream.CanTimeout
    System.IO.Stream.CopyTo(System.IO.Stream, System.Int32)
    System.IO.Stream.CopyToAsync(System.IO.Stream)
    System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32)
    System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32, System.Threading.CancellationToken)
    System.IO.Stream.CreateWaitHandle()
    System.IO.Stream.Dispose(System.Boolean)
    System.IO.Stream.EndRead(System.IAsyncResult)
    System.IO.Stream.EndWrite(System.IAsyncResult)
    System.IO.Stream.FlushAsync()
    System.IO.Stream.FlushAsync(System.Threading.CancellationToken)
    System.IO.Stream.Null
    System.IO.Stream.ObjectInvariant()
    System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32)
    System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
    System.IO.Stream.ReadTimeout
    System.IO.Stream.Synchronized(System.IO.Stream)
    System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32)
    System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
    System.IO.Stream.WriteTimeout
    System.MarshalByRefObject.CreateObjRef(System.Type)
    System.MarshalByRefObject.GetLifetimeService()
    System.MarshalByRefObject.InitializeLifetimeService()
    System.MarshalByRefObject.MemberwiseClone(System.Boolean)
    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 ChangesStream : Stream, IDisposable, IChangesStream, IStream

    Constructors

    ChangesStream(Stream)

    Initializes a new instance of the ChangesStream class.

    Declaration
    public ChangesStream(Stream input)
    Parameters
    Type Name Description
    System.IO.Stream input

    Source stream, must support Read and Seek operations

    ChangesStream(String, FileMode, FileAccess)

    Initializes a new instance of the ChangesStream class.

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

    Name of the file.

    System.IO.FileMode mode

    Mode of file opening.

    System.IO.FileAccess access

    File access type.

    Fields

    DATA_WINDOW_SEARCH_COMPARER

    Comparer for DataWindows.

    Declaration
    protected static IComparer DATA_WINDOW_SEARCH_COMPARER
    Field Value
    Type
    System.Collections.IComparer

    DEF_BUFFER_SIZE

    Default buffer size.

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

    DEF_FLUSH_BLOCK_LENGTH

    Length of the block of data for flushing.

    Declaration
    protected const int DEF_FLUSH_BLOCK_LENGTH = 51200
    Field Value
    Type
    System.Int32

    Properties

    AutoPush

    Gets or sets the count of changes that can be done before state will be automatically pushed to stack.

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

    CanRead

    Gets a value indicating whether the user can read data from stream.

    Declaration
    public override bool CanRead { get; }
    Property Value
    Type
    System.Boolean
    Overrides
    System.IO.Stream.CanRead

    CanRedo

    Gets a value indicating whether the user can redo some actions in stream or not.

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

    CanSeek

    Gets a value indicating whether the user can seek position in stream.

    Declaration
    public override bool CanSeek { get; }
    Property Value
    Type
    System.Boolean
    Overrides
    System.IO.Stream.CanSeek

    CanUndo

    Gets a value indicating whether the user can Undo some actions in stream or not.

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

    CanWrite

    Gets a value indicating whether the user can write the data to stream.

    Declaration
    public override bool CanWrite { get; }
    Property Value
    Type
    System.Boolean
    Overrides
    System.IO.Stream.CanWrite

    Changes

    Gets list of changes.

    Declaration
    protected ArrayList Changes { get; }
    Property Value
    Type
    System.Collections.ArrayList

    DataWindows

    Gets list of active windows.

    Declaration
    protected ArrayList DataWindows { get; }
    Property Value
    Type
    System.Collections.ArrayList

    LastSavedChangesCount

    Looks for the last saved count of changes in the stack of Saved States

    Declaration
    protected int LastSavedChangesCount { get; }
    Property Value
    Type Description
    System.Int32

    Integer value of count or -1 if stack is empty

    LastSavedDataWindows

    Looks for the last saved list of DataWindows in the stack of Saved States

    Declaration
    protected IList LastSavedDataWindows { get; }
    Property Value
    Type Description
    System.Collections.IList

    List of data windows or null if stack is empty

    Length

    Gets the length of the stream

    Declaration
    public override long Length { get; }
    Property Value
    Type
    System.Int64
    Overrides
    System.IO.Stream.Length

    Position

    Gets or sets the current position in the stream.

    Declaration
    public override long Position { get; set; }
    Property Value
    Type
    System.Int64
    Overrides
    System.IO.Stream.Position

    SyncObject

    Gets synchronization object.

    Declaration
    protected object SyncObject { get; }
    Property Value
    Type
    System.Object

    Methods

    AddChange(ChangeContext)

    Applies change in current position.

    Declaration
    public void AddChange(ChangeContext context)
    Parameters
    Type Name Description
    ChangeContext context

    Context of the change.

    AddChange(Int64, ChangeContext)

    Add change to the specified position.

    Declaration
    public void AddChange(long position, ChangeContext context)
    Parameters
    Type Name Description
    System.Int64 position

    Position in stream, where change is to be applied.

    ChangeContext context

    Context of the change.

    ChangeDelete(Int32, DataWindow, Int64, Int64, ref Int64, ChangeContext)

    Make update of DataWindows according to Delete operation type logic

    Declaration
    protected void ChangeDelete(int index, DataWindow change, long start, long end, ref long posChange, ChangeContext context)
    Parameters
    Type Name Description
    System.Int32 index

    Index of first DataWindow in update range

    DataWindow change

    DataWindow with chages

    System.Int64 start

    Start position of update region

    System.Int64 end

    End position of update region

    System.Int64 posChange

    influence on current stream position

    ChangeContext context

    Changes to context object

    ChangeInsert(Int32, DataWindow, Int64, Int64, ref Int64, DataWindow)

    Make update of DataWindows according to Insert operation type logic

    Declaration
    protected void ChangeInsert(int index, DataWindow change, long start, long end, ref long posChange, DataWindow firstPart)
    Parameters
    Type Name Description
    System.Int32 index

    Index of first DataWindow in update range

    DataWindow change

    DataWindow with chages

    System.Int64 start

    Start position of update region

    System.Int64 end

    End position of update region

    System.Int64 posChange

    influence on current stream position

    DataWindow firstPart

    DataWindow to which start position belong

    ChangeReplace(Int32, DataWindow, Int64, Int64, ref Int64, DataWindow, ChangeContext)

    Make update of DataWindows according to Replace operation type logic

    Declaration
    protected void ChangeReplace(int index, DataWindow change, long start, long end, ref long posChange, DataWindow firstPart, ChangeContext context)
    Parameters
    Type Name Description
    System.Int32 index

    Index of first DataWindow in update range

    DataWindow change

    DataWindow with chages

    System.Int64 start

    Start position of update region

    System.Int64 end

    End position of update region

    System.Int64 posChange

    influence on current stream position

    DataWindow firstPart

    DataWindow to which start position belong

    ChangeContext context

    Changes to context object

    Close()

    Implemented for avoiding PEVerify warnings.

    Declaration
    public override void Close()
    Overrides
    System.IO.Stream.Close()

    CopyTo(Stream)

    Writes current stream data to output stream.

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

    Output stream.

    Dispose()

    Frees used memory.

    Declaration
    public void Dispose()

    ExtractLastState()

    Restores datawindows and changes to the last state, saved in stack. WARNING: Method always must be called in lock( m_sync ) scope!!!

    Declaration
    protected void ExtractLastState()

    Finalize()

    Declaration
    protected void Finalize()

    Flush()

    Saves output stream to input stream.

    Declaration
    public override void Flush()
    Overrides
    System.IO.Stream.Flush()

    FlushChanges()

    Saves all changes.

    Declaration
    public void FlushChanges()

    GetDataWindowsInRange(Int64, Int64)

    Searches for all data windwos in specified range.

    Declaration
    protected ArrayList GetDataWindowsInRange(long start, long end)
    Parameters
    Type Name Description
    System.Int64 start

    Start position

    System.Int64 end

    End position

    Returns
    Type Description
    System.Collections.ArrayList

    Array of DataWindows which contains data from start to end points

    OnPositionChanged()

    Method, that is raised on every change of m_position. It means that cache must be reloaded.

    Declaration
    protected virtual void OnPositionChanged()

    PopState()

    Restores datawindows and changes to the last state, saved in stack. Last saved state is removed from stack.

    Declaration
    public void PopState()

    PushState()

    Saves current datawindows and changes to stack.

    Declaration
    public void PushState()

    RaiseDataChangedEvent()

    Raiser for DataChanged event.

    Declaration
    protected virtual void RaiseDataChangedEvent()

    RaiseDataPositionChanged(Int64, Int64)

    Raiser for DataPositionChanged event

    Declaration
    protected virtual void RaiseDataPositionChanged(long OldPosition, long NewPosition)
    Parameters
    Type Name Description
    System.Int64 OldPosition

    Old position.

    System.Int64 NewPosition

    New position.

    RaiseRedoBufferFlushedEvent()

    Raises RedoBufferFlushed event.

    Declaration
    protected virtual void RaiseRedoBufferFlushedEvent()

    RaiseUndoBufferFlushedEvent()

    Raises UndoBufferFlushed event.

    Declaration
    protected virtual void RaiseUndoBufferFlushedEvent()

    Read(Byte[], Int32, Int32)

    Reads data from stream to buffer. Reading is started from the current position.

    Declaration
    public override int Read(byte[] buffer, int offset, int count)
    Parameters
    Type Name Description
    System.Byte[] buffer

    Array of bytes, where data must be put.

    System.Int32 offset

    Offset in buffer.

    System.Int32 count

    Count of bytes to be read.

    Returns
    Type Description
    System.Int32

    Count of bytes, actually read.

    Overrides
    System.IO.Stream.Read(System.Byte[], System.Int32, System.Int32)

    ReadByte()

    Implemented for avoiding PEVerify warnings.

    Declaration
    public override int ReadByte()
    Returns
    Type Description
    System.Int32

    Parent value.

    Overrides
    System.IO.Stream.ReadByte()

    Redo()

    Performs Redo operation to last undone change.

    Declaration
    public void Redo()

    ResetCache()

    Resets cache. Cache will be reloaded on next position change or read from stream.

    Declaration
    protected void ResetCache()

    Seek(Int64, SeekOrigin)

    Sets the current position in the stream.

    Declaration
    public override long Seek(long offset, SeekOrigin origin)
    Parameters
    Type Name Description
    System.Int64 offset

    Offset, that position must be moved for.

    System.IO.SeekOrigin origin

    Specifies point, where offset must be applied.

    Returns
    Type Description
    System.Int64

    Current position.

    Overrides
    System.IO.Stream.Seek(System.Int64, System.IO.SeekOrigin)

    SetLength(Int64)

    Sets the length of the stream.

    Declaration
    public override void SetLength(long value)
    Parameters
    Type Name Description
    System.Int64 value

    new length of stream

    Overrides
    System.IO.Stream.SetLength(System.Int64)

    SetNewLineStyle(NewLineStyle)

    Sets new line style to the underlying stream.

    Declaration
    public void SetNewLineStyle(NewLineStyle style)
    Parameters
    Type Name Description
    NewLineStyle style

    Style of new line.

    SplitDataWindow(DataWindow, Int64)

    Divides one window into two in some position.

    Declaration
    protected DataWindow SplitDataWindow(DataWindow window, long position)
    Parameters
    Type Name Description
    DataWindow window

    Window to be divided

    System.Int64 position

    Position in stream of division point

    Returns
    Type Description
    DataWindow

    Second data window, that is cut

    TrimDataWindows(Int32, Int64, DataWindow)

    Trims datawindows in specified range.

    Declaration
    protected void TrimDataWindows(int index, long position, DataWindow change)
    Parameters
    Type Name Description
    System.Int32 index

    Index of the first datawindow, that must be cut. Can be 0, then scan of entire list will occure.

    System.Int64 position

    Start position of trimming.

    DataWindow change

    DataWindow, which size will be used for trimming.

    Undo()

    Undo last change. WARNING: it simply redos all operation except the last one.

    Declaration
    public void Undo()

    UpdateDataWindowsPositions()

    Updates all window's positions. Length is also updated.

    Declaration
    protected void UpdateDataWindowsPositions()

    UpdateDataWindowsPositions(Int32)

    Updates all window's positions starting from some index. Length is also updated.

    Declaration
    protected void UpdateDataWindowsPositions(int start)
    Parameters
    Type Name Description
    System.Int32 start

    Index of the first windwo to be updated

    Write(Byte[], Int32, Int32)

    Writes data to stream from current position. It executes AddChange method with Insert change type.

    Declaration
    public override void Write(byte[] buffer, int offset, int count)
    Parameters
    Type Name Description
    System.Byte[] buffer

    Data to be written.

    System.Int32 offset

    Offset of data to be written in buffer.

    System.Int32 count

    Count of bytes to be written.

    Overrides
    System.IO.Stream.Write(System.Byte[], System.Int32, System.Int32)

    WriteByte(Byte)

    Implemented for avoiding PEVerify warnings.

    Declaration
    public override void WriteByte(byte value)
    Parameters
    Type Name Description
    System.Byte value

    Byte to write.

    Overrides
    System.IO.Stream.WriteByte(System.Byte)

    Events

    AutoPushChanged

    Occurs when AutoPush property value is changed.

    Declaration
    public event ValueChangedEventHandler AutoPushChanged
    Event Type
    Type
    ValueChangedEventHandler

    DataChanged

    Occurs after the data has changed in stream.

    Declaration
    public event EventHandler DataChanged
    Event Type
    Type
    System.EventHandler

    DataPositionChanged

    Occurs when position of some data was changed. Example: if some data was deleted, data, that is after deleted block, will be moved back for the length of deleted data, so it`s position will be changed.

    Declaration
    public event ValueChangedEventHandler DataPositionChanged
    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

    Implements

    System.IDisposable
    IChangesStream
    IStream

    Extension Methods

    ExtensionMethods.GetBytes(Stream)
    ExtensionMethods.CopyTo(Stream, Stream)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved