Ejemplo n.º 1
0
 public void SetVisibility(string value)
 {
     if (value != Visibility.TextValue && (value == "Visible" || value == "Collapsed"))
     {
         Visibility.TextValue = value;
         StartOffset.SetVisibility(value);
         EndOffset.SetVisibility(value);
     }
 }
Ejemplo n.º 2
0
        public int CompareTo(IndexEntry other)
        {
            if (StartOffset == other.StartOffset)
            {
                return(EndOffset.CompareTo(other.EndOffset));
            }

            return(StartOffset.CompareTo(other.StartOffset));
        }
        public override int GetHashCode()
        {
            int hash = StartOffset.GetHashCode() ^ EndOffset.GetHashCode();

            if (IsString)
            {
                return(hash ^ StringValue.GetHashCode());
            }

            return(hash ^ ExtensionValue.GetHashCode());
        }
        public override int GetHashCode()
        {
            unchecked {
                int hash = ExtensionType.GetHashCode() ^
                           StartOffset.GetHashCode() ^
                           EndOffset.GetHashCode();

                foreach (var value in PositionalArguments)
                {
                    hash ^= value.GetHashCode();
                }

                foreach (var pair in NamedArguments)
                {
                    hash = hash ^ pair.Key.GetHashCode() ^ pair.Value.GetHashCode();
                }

                return(hash);
            }
        }
Ejemplo n.º 5
0
        internal void ValidateCollapsedLineSections()
        {
            if (!isFolded)
            {
                RemoveCollapsedLineSection();
                return;
            }
            // It is possible that StartOffset/EndOffset get set to invalid values via the property setters in TextSegment,
            // so we coerce those values into the valid range.
            DocumentLine startLine = manager.document.GetLineByOffset(StartOffset.CoerceValue(0, manager.document.TextLength));
            DocumentLine endLine   = manager.document.GetLineByOffset(EndOffset.CoerceValue(0, manager.document.TextLength));

            if (startLine == endLine)
            {
                RemoveCollapsedLineSection();
            }
            else
            {
                if (collapsedSections == null)
                {
                    collapsedSections = new CollapsedLineSection[manager.textViews.Count];
                }
                // Validate collapsed line sections
                DocumentLine startLinePlusOne = startLine.NextLine;
                for (int i = 0; i < collapsedSections.Length; i++)
                {
                    var collapsedSection = collapsedSections[i];
                    if (collapsedSection == null || collapsedSection.Start != startLinePlusOne || collapsedSection.End != endLine)
                    {
                        // recreate this collapsed section
                        if (collapsedSection != null)
                        {
                            //Debug.WriteLine("CollapsedLineSection validation - recreate collapsed section from " + startLinePlusOne + " to " + endLine);
                            collapsedSection.Uncollapse();
                        }
                        collapsedSections[i] = manager.textViews[i].CollapseLines(startLinePlusOne, endLine);
                    }
                }
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Writes the Subinterval's offsets to the console/
 /// </summary>
 public override string ToString()
 {
     return(string.Format(CultureInfo.CurrentCulture, @"Subinterval Start:{0}, End:{1}", StartOffset?.ToString(CultureInfo.CurrentCulture), EndOffset?.ToString(CultureInfo.CurrentCulture)));
 }
Ejemplo n.º 7
0
 /// <inheritdoc cref="object"/>
 public override int GetHashCode()
 => StartOffset.GetHashCode() * 397 ^ EndOffset.GetHashCode() * 397 ^ Count.GetHashCode() * 397;