예제 #1
0
        static OffsetAndCachedColors()
        {
            var coll = new CachedTextColorsCollection();

            coll.Freeze();
            Default = new OffsetAndCachedColors(0, coll);
        }
예제 #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="text">Text</param>
 /// <param name="colorCollection">Colors</param>
 /// <param name="referenceCollection">References</param>
 /// <param name="customDataDict">Custom data dictionary</param>
 internal DocumentViewerContent(string text, CachedTextColorsCollection colorCollection, SpanDataCollection <ReferenceInfo> referenceCollection, Dictionary <string, object> customDataDict)
 {
     if (text == null)
     {
         throw new ArgumentNullException(nameof(text));
     }
     if (colorCollection == null)
     {
         throw new ArgumentNullException(nameof(colorCollection));
     }
     if (referenceCollection == null)
     {
         throw new ArgumentNullException(nameof(referenceCollection));
     }
     if (customDataDict == null)
     {
         throw new ArgumentNullException(nameof(customDataDict));
     }
     colorCollection.Freeze();
     Text                = text;
     ColorCollection     = colorCollection;
     ReferenceCollection = referenceCollection;
     this.customDataDict = customDataDict;
     MethodDebugInfos    = GetCustomData <ReadOnlyCollection <MethodDebugInfo> >(DocumentViewerContentDataIds.DebugInfo) ?? emptyMethodDebugInfos;
 }
예제 #3
0
파일: LogEditor.cs 프로젝트: net10010/dnSpy
 void SetNewDocument()
 {
     cachedTextColorsCollection = new CachedTextColorsCollection();
     wpfTextView.TextBuffer.Replace(new Span(0, wpfTextView.TextBuffer.CurrentSnapshot.Length), string.Empty);
     ClearUndoRedoHistory();
     cachedColorsList.Clear();
     cachedColorsList.Add(0, cachedTextColorsCollection);
 }
예제 #4
0
        DocumentViewerOutput()
        {
            this.cachedTextColorsCollection = new CachedTextColorsCollection();
            this.stringBuilder    = new StringBuilder();
            this.referenceBuilder = SpanDataCollectionBuilder <ReferenceInfo> .CreateBuilder();

            this.canBeCached    = true;
            this.customDataDict = new Dictionary <string, object>(StringComparer.Ordinal);
        }
예제 #5
0
 void AddNewDocument()
 {
     docVersion++;
     prevCommandTextChangedState?.Cancel();
     subBuffers.Clear();
     scriptOutputCachedTextColorsCollection = null;
     cachedColorsList.Clear();
     OffsetOfPrompt = null;
     wpfTextView.TextBuffer.Replace(new Span(0, wpfTextView.TextBuffer.CurrentSnapshot.Length), string.Empty);
     ClearUndoRedoHistory();
 }
예제 #6
0
        DocumentViewerOutput()
        {
            state = State.GeneratingContent;
            cachedTextColorsCollection = new CachedTextColorsCollection();
            stringBuilder    = new StringBuilder();
            referenceBuilder = SpanDataCollectionBuilder <ReferenceInfo> .CreateBuilder();

            canBeCached    = true;
            customDataDict = new Dictionary <string, object>(StringComparer.Ordinal);
            indenter       = new Indenter(4, 4, true);
        }
예제 #7
0
 public void Reset()
 {
     ClearPendingOutput();
     ClearUndoRedoHistory();
     CreateEmptyLastLineIfNeededAndMoveCaret();
     if (OffsetOfPrompt != null)
     {
         AddCodeSubBuffer();
     }
     scriptOutputCachedTextColorsCollection = null;
     WriteOffsetOfPrompt(null, true);
 }
예제 #8
0
 public void AddOrUpdate(int docOffset, CachedTextColorsCollection newCachedTextColorsCollection)
 {
     for (int i = 0; i < cachedColorsList.Count; i++)
     {
         int mi   = (previousReturnedIndex + i) % cachedColorsList.Count;
         var info = cachedColorsList[mi];
         if (info.Offset == docOffset)
         {
             cachedColorsList[mi] = new OffsetAndCachedColors(docOffset, newCachedTextColorsCollection);
             return;
         }
     }
     Add(docOffset, newCachedTextColorsCollection);
 }
예제 #9
0
 void WriteOffsetOfPrompt(int?newValue, bool force = false)
 {
     if (force || OffsetOfPrompt.HasValue != newValue.HasValue)
     {
         if (newValue == null)
         {
             Debug.Assert(scriptOutputCachedTextColorsCollection == null);
             scriptOutputCachedTextColorsCollection = new CachedTextColorsCollection();
             Debug.Assert(LastLine.Length == 0);
             cachedColorsList.AddOrUpdate(wpfTextView.TextSnapshot.Length, scriptOutputCachedTextColorsCollection);
         }
         else
         {
             Debug.Assert(scriptOutputCachedTextColorsCollection != null);
             scriptOutputCachedTextColorsCollection = null;
         }
     }
     OffsetOfPrompt = newValue;
 }
예제 #10
0
 public OffsetAndCachedColors(int offset, CachedTextColorsCollection cachedColors)
 {
     Offset       = offset;
     CachedColors = cachedColors;
 }
예제 #11
0
 public void Add(int offset, CachedTextColorsCollection cachedTextColorsCollection)
 {
     Debug.Assert((cachedColorsList.Count == 0 && offset == 0) || (cachedColorsList.Count > 0 && cachedColorsList.Last().Offset + cachedColorsList.Last().CachedColors.TextLength <= offset));
     cachedColorsList.Add(new OffsetAndCachedColors(offset, cachedTextColorsCollection));
 }
예제 #12
0
 public CachedTextColorsCollectionBuilder(ReplEditor owner, int totalLength)
 {
     this.owner = owner;
     this.cachedTextColorsCollection = new CachedTextColorsCollection();
     this.totalLength = totalLength;
 }
예제 #13
0
 public TextBlockColorOutput()
 {
     this.cachedTextColorsCollection = new CachedTextColorsCollection();
     this.sb = new StringBuilder();
 }