87 lines
2.8 KiB
C#
87 lines
2.8 KiB
C#
|
#region Using Directives
|
|||
|
|
|||
|
using System;
|
|||
|
using System.Runtime.InteropServices;
|
|||
|
|
|||
|
#endregion Using Directives
|
|||
|
|
|||
|
|
|||
|
namespace ScintillaNET_FindReplaceDialog
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 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.
|
|||
|
/// </summary>
|
|||
|
[StructLayout(LayoutKind.Sequential)]
|
|||
|
public class CharacterRange
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Character position index immediately preceding the first character in the range.
|
|||
|
/// </summary>
|
|||
|
public int CpMin { get; set; }=0;
|
|||
|
/// <summary>
|
|||
|
/// Character position immediately following the last character in the range.
|
|||
|
/// </summary>
|
|||
|
public int CpMax { get; set; }=0;
|
|||
|
/// <summary>
|
|||
|
/// 所在行开始的位置
|
|||
|
/// </summary>
|
|||
|
public int LinePos { get; set; } = -1;
|
|||
|
/// <summary>
|
|||
|
/// 所在行数
|
|||
|
/// </summary>
|
|||
|
public int LineNum { get; set; }=-1;
|
|||
|
/// <summary>
|
|||
|
/// 所在行文本
|
|||
|
/// </summary>
|
|||
|
public string LineText { get; set; } = "";
|
|||
|
/// <summary>
|
|||
|
/// 所在行文本
|
|||
|
/// </summary>
|
|||
|
public string RangeText { get; set; } ="";
|
|||
|
/// <summary>
|
|||
|
/// 选择区域是否是空
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
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();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 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.
|
|||
|
/// </summary>
|
|||
|
/// <param name="Min">The minimum, or start position.</param>
|
|||
|
/// <param name="Max">The maximum, or end position.</param>
|
|||
|
public CharacterRange(int Min, int Max)
|
|||
|
{
|
|||
|
this.CpMin = Min;
|
|||
|
this.CpMax = Max;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 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.
|
|||
|
/// </summary>
|
|||
|
/// <param name="Min">The minimum, or start position.</param>
|
|||
|
/// <param name="Max">The maximum, or end position.</param>
|
|||
|
public CharacterRange()
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
}
|