#region Using Directives using System; using System.Runtime.InteropServices; #endregion Using Directives namespace ScintillaNET_FindReplaceDialog { /// /// Specifies a range of characters. If the cpMin and cpMax members are equal, the range is empty. /// The range includes everything if cpMin is 0 and cpMax is –1. /// [StructLayout(LayoutKind.Sequential)] public class CharacterRange { /// /// Character position index immediately preceding the first character in the range. /// public int CpMin { get; set; }=0; /// /// Character position immediately following the last character in the range. /// public int CpMax { get; set; }=0; /// /// 所在行开始的位置 /// public int LinePos { get; set; } = -1; /// /// 所在行数 /// public int LineNum { get; set; }=-1; /// /// 所在行文本 /// public string LineText { get; set; } = ""; /// /// 所在行文本 /// public string RangeText { get; set; } =""; /// /// 选择区域是否是空 /// /// public bool IsEmpty() { return CpMin == CpMax; } public override bool Equals(object obj) { if(obj == null) return false; if(this == obj) return true; if(obj is CharacterRange x2) { if(x2.CpMin== CpMin && x2.CpMax==CpMax) { return true; } else { return false; } } return false; } public override int GetHashCode() { return base.GetHashCode(); } /// /// Specifies a range of characters. If the cpMin and cpMax members are equal, the range is empty. /// The range includes everything if cpMin is 0 and cpMax is –1. /// /// The minimum, or start position. /// The maximum, or end position. public CharacterRange(int Min, int Max) { this.CpMin = Min; this.CpMax = Max; } /// /// Specifies a range of characters. If the cpMin and cpMax members are equal, the range is empty. /// The range includes everything if cpMin is 0 and cpMax is –1. /// /// The minimum, or start position. /// The maximum, or end position. public CharacterRange() { } } }