pascalabcnet/ICSharpCode.TextEditorLinux/Src/Util/TextUtility.cs
Mikhalkovich Stanislav 3072383106 Для Linux-версии исправлен DockContent, редактор (показ всплывающего окна)
Сделан новый проект VisualPABCLinux
И пришлось склонировать PluginsSupport, поскольку он вносит зависимость по редактору
Компоненты WeifenLuo для Linux надо после перекомпиляции скопировать в Libraries - подшить их к основному проекту просто не получилось
2022-06-30 09:47:11 +03:00

82 lines
2 KiB
C#

// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision: 915 $</version>
// </file>
using System;
using ICSharpCode.TextEditor.Document;
namespace ICSharpCode.TextEditor.Util
{
public class TextUtility
{
public static bool RegionMatches(IDocument document, int offset, int length, string word)
{
if (length != word.Length || document.TextLength < offset + length) {
return false;
}
for (int i = 0; i < length; ++i) {
if (document.GetCharAt(offset + i) != word[i]) {
return false;
}
}
return true;
}
public static bool RegionMatches(IDocument document, bool casesensitive, int offset, int length, string word)
{
if (casesensitive) {
return RegionMatches(document, offset, length, word);
}
if (length != word.Length || document.TextLength < offset + length) {
return false;
}
for (int i = 0; i < length; ++i) {
if (Char.ToUpper(document.GetCharAt(offset + i)) != Char.ToUpper(word[i])) {
return false;
}
}
return true;
}
public static bool RegionMatches(IDocument document, int offset, int length, char[] word)
{
if (length != word.Length || document.TextLength < offset + length) {
return false;
}
for (int i = 0; i < length; ++i) {
if (document.GetCharAt(offset + i) != word[i]) {
return false;
}
}
return true;
}
public static bool RegionMatches(IDocument document, bool casesensitive, int offset, int length, char[] word)
{
if (casesensitive) {
return RegionMatches(document, offset, length, word);
}
if (length != word.Length || document.TextLength < offset + length) {
return false;
}
for (int i = 0; i < length; ++i) {
if (Char.ToUpper(document.GetCharAt(offset + i)) != Char.ToUpper(word[i])) {
return false;
}
}
return true;
}
}
}