SuperDesign/Source/RySmartEditor/Controls/Highlight/CharacterRange.cs
zilinsoft 993f1ca1a9 ### 2024-12-20 星期五更新
------
#### SuperDesign    V3.0.2412.2001
- *.[新增]新增程序更新日志设置和自动发布功能。
- *.[修复]修复Post数据格式不正确时双击文本框会导致软件闪退的BUG。
2024-12-20 08:15:19 +08:00

87 lines
2.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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()
{
}
}
}