### 2024-12-20 星期五更新

------
#### SuperDesign    V3.0.2412.2001
- *.[新增]新增程序更新日志设置和自动发布功能。
- *.[修复]修复Post数据格式不正确时双击文本框会导致软件闪退的BUG。
This commit is contained in:
zilinsoft committed 2024-12-20 08:15:19 +08:00
1 parent 03bcb8c5fd
commit 993f1ca1a9
349 files changed
+81977 -13873

No files matched your search

@@ -0,0 +1 @@
{"RootPath":"E:\\My Datas\\My Codes\\毕方项目\\CSharp\\SuperDesign\\Source\\RySmartEditor","ProjectFileName":"RySmartEditor.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"API\\JsBeautifier\\Beautifier.cs"},{"SourceFile":"API\\JsBeautifier\\BeautifierFlags.cs"},{"SourceFile":"API\\JsBeautifier\\BeautifierOptions.cs"},{"SourceFile":"API\\JsBeautifier\\BraceStyle.cs"},{"SourceFile":"Controls\\FrmTitle.cs"},{"SourceFile":"Controls\\FrmTitle.Designer.cs"},{"SourceFile":"Controls\\Highlight\\AutoComplete\\AutocompleteItem.cs"},{"SourceFile":"Controls\\Highlight\\AutoComplete\\AutocompleteItems.cs"},{"SourceFile":"Controls\\Highlight\\AutoComplete\\AutocompleteListView.cs"},{"SourceFile":"Controls\\Highlight\\AutoComplete\\AutocompleteMenu.cs"},{"SourceFile":"Controls\\Highlight\\AutoComplete\\AutocompleteMenuHost.cs"},{"SourceFile":"Controls\\Highlight\\AutoComplete\\Colors.cs"},{"SourceFile":"Controls\\Highlight\\AutoComplete\\EventArgs.cs"},{"SourceFile":"Controls\\Highlight\\AutoComplete\\IAutocompleteListView.cs"},{"SourceFile":"Controls\\Highlight\\AutoComplete\\ITextBoxWrapper.cs"},{"SourceFile":"Controls\\Highlight\\AutoComplete\\Range.cs"},{"SourceFile":"Controls\\Highlight\\AutoComplete\\ScintillaWrapper.cs"},{"SourceFile":"Controls\\Highlight\\AutoComplete\\TextBoxWrapper.cs"},{"SourceFile":"Controls\\Highlight\\CharacterRange.cs"},{"SourceFile":"Controls\\Highlight\\ContextMenuStripHighlightText2.cs"},{"SourceFile":"Controls\\Highlight\\ContextMenuStripHighlightText2.Designer.cs"},{"SourceFile":"Controls\\Highlight\\FindAllResults\\FindAllResultsPanel.cs"},{"SourceFile":"Controls\\Highlight\\FindAllResults\\FindAllResultsPanel.Designer.cs"},{"SourceFile":"Controls\\Highlight\\FindReplace\\FindConfig.cs"},{"SourceFile":"Controls\\Highlight\\FindReplace\\FindConfig.Designer.cs"},{"SourceFile":"Controls\\Highlight\\FindReplace\\FindOption.cs"},{"SourceFile":"Controls\\Highlight\\FindReplace\\FindReplace.cs"},{"SourceFile":"Controls\\Highlight\\FindReplace\\FindReplaceDialog.cs"},{"SourceFile":"Controls\\Highlight\\FindReplace\\FindReplaceDialog.Designer.cs"},{"SourceFile":"Controls\\Highlight\\FindReplace\\FrmFinding.cs"},{"SourceFile":"Controls\\Highlight\\FindReplace\\FrmFinding.Designer.cs"},{"SourceFile":"Controls\\Highlight\\FindReplace\\IncrementalSearcher.cs"},{"SourceFile":"Controls\\Highlight\\FindReplace\\IncrementalSearcher.Designer.cs"},{"SourceFile":"Controls\\Highlight\\FindReplace\\ToolStripIncrementalSearcher.cs"},{"SourceFile":"Controls\\Highlight\\GoTo\\GoTo.cs"},{"SourceFile":"Controls\\Highlight\\GoTo\\GoToDialog.cs"},{"SourceFile":"Controls\\Highlight\\GoTo\\GoToDialog.Designer.cs"},{"SourceFile":"Controls\\Highlight\\HighlightEditor.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerBatch.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerCommon.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerCpp.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerCs.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerCss.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerHtml.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerIni.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerInnoSetup.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerJava.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerJavaScript.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerJson.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerNsis.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerNull.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerPascal.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerPhp.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerPowerShell.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerPython.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerSql.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerVb.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerXml.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecificLexer\\CreateLexerYaml.cs"},{"SourceFile":"Controls\\Highlight\\VPKSoft.ScintillaLexers\\CreateSpecLine truncated
+62
View File
@@ -0,0 +1,62 @@
using 开发辅助工具.Tools.SmartEditor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace RySmartEditor
{
public class Init
{
public static void Show(string[] args)
{
if (args.Length >= 2)
{
if (args[0] == "edit")
{
string ProjectPath = args[1];
OpenEditor(ProjectPath);
}
}
else if(args.Length == 1)
{
if (args[0] == "edit" || System.IO.File.Exists(args[0]))
{
OpenEditor(args[0]);
}
else
{
OpenEditor("edit");
}
}
else
{
OpenEditor("edit");
//Application.Run(new FrmMainEditor());
}
}
static void OpenEditor(string path)
{
object mainHandle = QuickMsg.RyMemoryShare.ReadFromMemory(1024, typeof(Int64), "SmartEditor");
if (mainHandle != null && (long)mainHandle != 0)
{
var handle = new IntPtr((long)mainHandle);
if (path == "edit")
{
ryControls.Win32.SendMessage(handle, 17189, 100, 100);//让界面显示
}
else
{
ryConfig.MsgManager.SendMsg(handle, 1666, path);
}
return;
}
else
{
Application.Run(new FrmMainEditor(path == "edit" ? "" : path));
}
}
}
}
+364
View File
@@ -0,0 +1,364 @@
using ryCommon;
using ryCommonDb;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using static ryCommonDb.DataProvider;
namespace 开发辅助工具.Manager
{
public class Itrycn_Db
{
public static bool IsCloseConfirm = true;
public static string Sys_SQLConn = "<app>\\SysDb\\Tools.dat|";
public static string User_SQLConn = "<app>\\UserDb\\MyDb.dat|";
public static string History_SQLConn = "<app>\\UserDb\\history.dat|";
public static ryCommonDb.DataProvider.DataProviderType dataType = ryCommonDb.DataProvider.DataProviderType.SQLiteDataProvider;
public static IDbInterface CreateDataProvider(DataProviderType dataProviderType)
{
switch (dataProviderType)
{
//case DataProviderType.OdbcDataProvider:
// return new OdbcDataProvider();
//case DataProviderType.OleDbDataProvider:
// return new OleDbDataProvider();
//case DataProviderType.OracleDataProvider:
// return new OracleDataProvider();
case DataProviderType.SQLiteDataProvider:
return new SQLiteDataProvider();
default:
return null;
}
}
/// <summary>
/// 判断WinSCP是否在运行
/// </summary>
/// <returns></returns>
public static bool WinSCP_IsRunning() {
var exist = false;
try {
var proc_list = Process.GetProcessesByName("WinSCP");
for (int i = 0; i < proc_list.Length; i++) {
var path = proc_list[i].GetPath();
if (path.Length > 0) {
if (path.IndexOfEx(Application.StartupPath) < 0) {
exist = true; break;
}
}
}
}
catch {
}
if (!exist) {
//RyForm.get
}
return exist;
}
public static void DeleteFiles(string dir, string filter)
{
var files = System.IO.Directory.GetFiles(dir, filter);
for (int i = 0; i < files.Length; i++)
{
ryCommon.RyFiles.DeleteFile(files[i]);
}
ryCommon.RyFiles.DeleteFile(dir + "\\" + filter);
var dirs = System.IO.Directory.GetDirectories(dir);
for (int i = 0; i < dirs.Length; i++)
{
DeleteFiles(dirs[i], filter);
}
}
public static void CreateSysTable()
{
IDbInterface db = CreateDataProvider(dataType);
if (db.ConnDb(Sys_SQLConn) == 1)
{
#region 工具表
RyQuickSQL mySQL = new RyQuickSQL("Tools");
mySQL.AddField("Name", "");
mySQL.AddField("Des", "");
mySQL.AddField("Keys", "");
mySQL.AddField("Addr", "");
mySQL.AddField("PY", "");
mySQL.AddField("Sort", 0);
mySQL.AddField("addTime",DateTime.Now);
db.CreateDb(mySQL);
#endregion
//
}
}
/// <summary>
/// 获取设置
/// </summary>
/// <param name="name"></param>
/// <param name="defValue"></param>
/// <returns></returns>
public static string GetSetting(string name, string defValue)
{
var result = defValue;
IDbInterface db = CreateDataProvider(dataType);
if (db.ConnDb(User_SQLConn) == 1)
{
RyQuickSQL mySQL = new RyQuickSQL("Settings");
mySQL.AddField("Name", name);
var ds = db.ReadData("select * from Settings where Name=@Name", mySQL);
if (ds.HaveData())
{
result = ds.GetRow(0)["Value"].ToString();
}
ds.Dispose();
}
db.Free();
return result;
}
/// <summary>
/// 设置设置
/// </summary>
/// <param name="name"></param>
/// <param name="defValue"></param>
/// <returns></returns>
public static int SetSetting(string name, string value)
{
var result = 0;
IDbInterface db = CreateDataProvider(dataType);
if (db.ConnDb(User_SQLConn) == 1)
{
RyQuickSQL mySQL = new RyQuickSQL("Settings");
mySQL.AddField("Name", name);
mySQL.AddField("Value", value);
result= db.ExecuteNonQuery(mySQL.GetUpdateSQL()+ " where Name=@Name", mySQL);
if (result==0)
{
mySQL.AddField("addTime", DateTime.Now);
result = db.ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL);
}
}
db.Free();
return result;
}
public static void CreateDb()
{
CreateSysTable();
CreateUserTable();
CreateHistoryTable();
}
public static void CreateUserTable()
{
IDbInterface db = CreateDataProvider(dataType);
if (db.ConnDb(User_SQLConn) == 1)
{
#region Url表
RyQuickSQL mySQL = new RyQuickSQL("Urls");
mySQL.AddField("Name", "");
mySQL.AddField("Url", "");
mySQL.AddField("Cookie", "");
mySQL.AddField("Postdata", "");
mySQL.AddField("Method", "");
mySQL.AddField("Header", "");
mySQL.AddField("Referer", "");
mySQL.AddField("ContentType", "");
mySQL.AddField("Encoding", "");
mySQL.AddField("IsFav", 0);
mySQL.AddField("Des", "");
mySQL.AddField("ClickCount", 0);//点击次数
mySQL.AddField("editTime", DateTime.Now);
mySQL.AddField("addTime", DateTime.Now);
db.CreateDb(mySQL);
#endregion
#region 启动表
mySQL.Clear();
mySQL.TableName = "Starts"; ;
mySQL.AddField("Addr", "");
mySQL.AddField("Name", "");
mySQL.AddField("ClickCount", 0);//点击次数
mySQL.AddField("editTime", DateTime.Now);
mySQL.AddField("addTime", DateTime.Now);
db.CreateDb(mySQL);
#endregion
#region 变量表
mySQL.Clear();
mySQL.TableName = "VarInfo"; ;
mySQL.AddField("VarName", "");
mySQL.AddField("VarValue", "");
mySQL.AddField("Des", "");//备注
mySQL.AddField("editTime", DateTime.Now);
mySQL.AddField("addTime", DateTime.Now);
db.CreateDb(mySQL);
#endregion
#region API表
mySQL.Clear();
mySQL.TableName = "api";
mySQL.AddField("Name", "");
mySQL.AddField("Url", "");
mySQL.AddField("APIName", "");
mySQL.AddField("Postdata", "");
mySQL.AddField("desc", "");
mySQL.AddField("ClickCount", 0);//点击次数
mySQL.AddField("editTime", DateTime.Now);
mySQL.AddField("addTime", DateTime.Now);
if (db.CreateDb(mySQL) == 1)
{
db.ExecuteNonQuery("CREATE INDEX index_APIName ON api(APIName); ");
db.ExecuteNonQuery("CREATE INDEX index_APIUrl ON api(Url); ");
}
#endregion
#region FTP表
mySQL.Clear();
mySQL.TableName = "FTP";
mySQL.AddField("name", "");
mySQL.AddField("ip", "");
mySQL.AddField("port", 0);
mySQL.AddField("remoteDir", "");
mySQL.AddField("username", "");
mySQL.AddField("pwd", "");
mySQL.AddField("encrypt", 0);
mySQL.AddField("des", "");
mySQL.AddField("addTime", DateTime.Now);
mySQL.AddField("editTime", DateTime.Now);
db.CreateDb(mySQL);
#endregion
#region Site表
mySQL.Clear();
mySQL.TableName = "Site";
mySQL.AddField("name", "");
mySQL.AddField("localPath", "");
mySQL.AddField("ftpId", 0);
mySQL.AddField("ftpDir", "");
mySQL.AddField("addTime", DateTime.Now);
mySQL.AddField("editTime", DateTime.Now);
db.CreateDb(mySQL);
#endregion
#region FavGroup表
mySQL.Clear();
mySQL.TableName = "FavGroup";
mySQL.AddField("name", "");
mySQL.AddField("addTime", DateTime.Now);
mySQL.AddField("editTime", DateTime.Now);
db.CreateDb(mySQL);
#endregion
#region FavFiles表
mySQL.Clear();
mySQL.TableName = "FavFiles";
mySQL.AddField("name", "");
mySQL.AddField("FilePath", "");
mySQL.AddField("FindText", "");
mySQL.AddField("GroupId", 1);
mySQL.AddField("addTime", DateTime.Now);
mySQL.AddField("editTime", DateTime.Now);
db.CreateDb(mySQL);
#endregion
#region 设置表
mySQL.Clear();
mySQL.TableName = "Settings";
mySQL.AddField("Name", "");
mySQL.AddField("Value", "");//值
mySQL.AddField("addTime", DateTime.Now);
if (db.CreateDb(mySQL) == 1)
{
db.ExecuteNonQuery("CREATE INDEX index_Name ON Settings(Name); ");
}
#endregion
}
}
public static void CreateHistoryTable()
{
IDbInterface db = CreateDataProvider(dataType);
if (db.ConnDb(History_SQLConn) == 1)
{
#region 标签文件表
RyQuickSQL mySQL = new RyQuickSQL("Files");
mySQL.AddField("FilePath", "");
mySQL.AddField("editTime", DateTime.Now);
mySQL.AddField("addTime", DateTime.Now);
if (db.CreateDb(mySQL) == 1)
{
db.ExecuteNonQuery("CREATE INDEX index_FilePath ON Files(FilePath); ");
}
#endregion
#region 历史记录表
mySQL.Clear();
mySQL.TableName = "History"; ;
mySQL.AddField("fileid", 0);
mySQL.AddField("name", "");
mySQL.AddField("size", 0L);
mySQL.AddField("content", "");
mySQL.AddField("addTime", DateTime.Now);
db.CreateDb(mySQL);
#endregion
#region 设置表
mySQL.Clear();
mySQL.TableName = "Settings";
mySQL.AddField("Name", "");
mySQL.AddField("Value", "");//值
mySQL.AddField("addTime", DateTime.Now);
if (db.CreateDb(mySQL) == 1)
{
db.ExecuteNonQuery("CREATE INDEX index_Name ON Settings(Name); ");
}
#endregion
}
}
/// <summary>
/// 添加历史记录
/// </summary>
/// <param name="path"></param>
/// <param name="content"></param>
public static void AddHistory(string path, string content)
{
new Thread(Start).Start();
void Start()
{
IDbInterface db = CreateDataProvider(dataType);
if (db.ConnDb(History_SQLConn) == 1)
{
var isadd = false;
RyQuickSQL mySQL = new RyQuickSQL("Files");
mySQL.AddField("FilePath", path);
mySQL.AddField("editTime", DateTime.Now);
if (db.ExecuteNonQuery(mySQL.GetUpdateSQL() + " where FilePath=@FilePath", mySQL) == 0)
{
mySQL.AddField("addTime", DateTime.Now);
db.Insert(mySQL);
isadd = true;
}
var ds = db.ReadData("select * from Files where FilePath=@FilePath", mySQL);
if (ds.HaveData())
{
var fileid = ds.GetFirstRowData()["id"].ToInt();
var issame = false;
if (!isadd)
{
var ds_his = db.ReadData("select * from History where fileid=" + fileid + " order by addTime desc limit 1");
if (ds_his.HaveData())
{
if (ds_his.GetFirstRowData()["content"].ToString() == content)
{
issame = true;
}
}
ds_his.Dispose();
}
if (!issame)
{
mySQL.Clear();
mySQL.TableName = "History";
mySQL.AddField("fileid", fileid);
mySQL.AddField("size", content.Length);
mySQL.AddField("content", content);
mySQL.AddField("addTime", DateTime.Now);
db.Insert(mySQL);
}
}
ds.Dispose();
}
db.Free();
}
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,74 @@
#region License
// MIT License
//
// Copyright (c) 2018 Denis Ivanov
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion
namespace Jsbeautifier
{
using System;
public class BeautifierFlags
{
public BeautifierFlags(string mode)
{
PreviousMode = "BLOCK";
Mode = mode;
VarLine = false;
VarLineTainted = false;
VarLineReindented = false;
InHtmlComment = false;
IfLine = false;
ChainExtraIndentation = 0;
InCase = false;
InCaseStatement = false;
CaseBody = false;
IndentationLevel = 0;
TernaryDepth = 0;
}
public string PreviousMode { get; set; }
public string Mode { get; set; }
public bool VarLine { get; set; }
public bool VarLineTainted { get; set; }
public bool VarLineReindented { get; set; }
public bool InHtmlComment { get; set; }
public bool IfLine { get; set; }
public int ChainExtraIndentation { get; set; }
public bool InCase { get; set; }
public bool InCaseStatement { get; set; }
public bool CaseBody { get; set; }
public int IndentationLevel { get; set; }
public int TernaryDepth { get; set; }
}
}
@@ -0,0 +1,69 @@
#region License
// MIT License
//
// Copyright (c) 2018 Denis Ivanov
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion
namespace Jsbeautifier
{
public class BeautifierOptions
{
public BeautifierOptions()
{
IndentSize = 4;
IndentChar = ' ';
IndentWithTabs = false;
PreserveNewlines = true;
MaxPreserveNewlines = 10.0f;
JslintHappy = false;
BraceStyle = BraceStyle.Collapse;
KeepArrayIndentation = false;
KeepFunctionIndentation = false;
EvalCode = false;
WrapLineLength = 0;
BreakChainedMethods = false;
}
public uint IndentSize { get; set; }
public char IndentChar { get; set; }
public bool IndentWithTabs { get; set; }
public bool PreserveNewlines { get; set; }
public float MaxPreserveNewlines { get; set; }
public bool JslintHappy { get; set; }
public BraceStyle BraceStyle { get; set; }
public bool KeepArrayIndentation { get; set; }
public bool KeepFunctionIndentation { get; set; }
public bool EvalCode { get; set; }
public int WrapLineLength { get; set; }
public bool BreakChainedMethods { get; set; }
}
}
@@ -0,0 +1,31 @@
#region License
// MIT License
//
// Copyright (c) 2018 Denis Ivanov
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion
namespace Jsbeautifier
{
public enum BraceStyle
{
Expand, Collapse, EndExpand
}
}
+113
View File
@@ -0,0 +1,113 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Windows.Forms;
using ryCommon;
using QuickMsg;
using System.Runtime.CompilerServices;
using System.Threading;
namespace ryConfig
{
/// <summary>
/// 流程软件通信类
/// </summary>
public class MsgManager
{
[DllImport("user32.dll", EntryPoint = "GetParent", SetLastError = true)]
private static extern IntPtr GetParent(IntPtr hWnd);
[DllImport("user32.dll", EntryPoint = "GetWindowThreadProcessId")]
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, ref uint lpdwProcessId);
[DllImport("user32.dll", EntryPoint = "IsWindow")]
private static extern bool IsWindow(IntPtr hWnd);
private const int WM_COPYDATA = 0x004A;
public struct COPYDATASTRUCT
{
public IntPtr dwData;
public int cData;
[MarshalAs(UnmanagedType.LPStr)]
public string lpData;
}
[DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(IntPtr hwnd, int msg, int wParam, ref COPYDATASTRUCT IParam);
/// <summary>
/// 向指定句柄发送消息
/// </summary>
/// <param name="handle"></param>
/// <param name="wParam"></param>
/// <param name="str">要发送的文字内容</param>
public static void SendMsg(IntPtr handle, int wParam, string str)
{
byte[] arr = System.Text.Encoding.Default.GetBytes(str);
int len = arr.Length;
COPYDATASTRUCT cdata;
cdata.dwData = (IntPtr)100;
cdata.lpData = str;
cdata.cData = len + 1;
SendMessage(handle, WM_COPYDATA, wParam, ref cdata);
}
/// <summary>
/// 发送消息到文本编辑器
/// </summary>
/// <param name="wParam">附带信息</param>
/// <param name="str">要发送的文字内容</param>
public static void SendMsgToEditor(string str)
{
object mainHandle = QuickMsg.RyMemoryShare.ReadFromMemory(1024, typeof(Int64), "SmartEditor");
if (mainHandle != null)
{
SendMsg((IntPtr)mainHandle.ToInt64(), 0, str);
}
}
/// <summary>
/// 发送消息到指定的内存ID窗口
/// </summary>
/// <param name="MemoryId">内存ID</param>
/// <param name="wParam">附带信息标识</param>
/// <param name="str">发送的内容</param>
public static void SendMsg(string MemoryId, int wParam, string str)
{
if (MemoryId == null || MemoryId.Length == 0)
{
return;
}
else
{
object mainHandle = QuickMsg.RyMemoryShare.ReadFromMemory(1024, typeof(Int64), MemoryId);
if (mainHandle != null && (long)mainHandle != 0)
{
SendMsg((IntPtr)mainHandle.ToInt64(), wParam, str);
}
}
}
/// <summary>
/// 获取消息字符串内容
/// </summary>
/// <param name="m"></param>
/// <returns></returns>
public static string GetMsg(Message m)
{
COPYDATASTRUCT cdata = new COPYDATASTRUCT();
Type mytype = cdata.GetType();
cdata = (COPYDATASTRUCT)m.GetLParam(mytype);
return cdata.lpData;
}
/// <summary>
/// 通知已打开的编辑器,显示界面
/// </summary>
public static void ShowEditorUI()
{
object mainHandle = QuickMsg.RyMemoryShare.ReadFromMemory(1024, typeof(Int64), "SmartEditor");
if (mainHandle != null && (long)mainHandle != 0)
{
ryControls.Win32.SendMessage(new IntPtr((long)mainHandle), 17189, 100, 100);//让界面显示
return;
}
}
}
}
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
@@ -0,0 +1,520 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.TextEditor;
using System.Diagnostics;
using System.IO;
namespace XmlPad
{
public partial class FindAndReplaceForm : Form
{
public FindAndReplaceForm()
{
InitializeComponent();
_search = new TextEditorSearcher();
}
TextEditorSearcher _search;
FastColoredTextBoxNS.FastColoredTextBox _editor;
FastColoredTextBoxNS.FastColoredTextBox Editor
{
get { return _editor; }
set
{
_editor = value;
_search.Document = _editor.Document;
UpdateTitleBar();
}
}
private void UpdateTitleBar()
{
string text = ReplaceMode ? "查找和替换" : "查找";
if (_editor != null && _editor.FileName != null)
text += " - " + Path.GetFileName(_editor.FileName);
if (_search.HasScanRegion)
text += " (只可选)";
this.Text = text;
}
public void ShowFor(FastColoredTextBoxNS.FastColoredTextBox editor, bool replaceMode)
{
Editor = editor;
_search.ClearScanRegion();
SelectionManager sm = editor.ActiveTextAreaControl.SelectionManager;
if (sm.HasSomethingSelected && sm.SelectionCollection.Count == 1)
{
ISelection sel = sm.SelectionCollection[0];
if (sel.StartPosition.Y == sel.EndPosition.Y)
txtLookFor.Text = sm.SelectedText;
else
_search.SetScanRegion(sel);
}
else
{
// Get the current word that the caret is on
Caret caret = editor.ActiveTextAreaControl.Caret;
int start = TextUtilities.FindWordStart(editor.Document, caret.Offset);
int endAt = TextUtilities.FindWordEnd(editor.Document, caret.Offset);
txtLookFor.Text = editor.Document.GetText(start, endAt - start);
}
ReplaceMode = replaceMode;
this.Owner = (Form)editor.TopLevelControl;
this.Show();
txtLookFor.SelectAll();
txtLookFor.Focus();
}
public bool ReplaceMode
{
get { return txtReplaceWith.Visible; }
set
{
btnReplace.Visible = btnReplaceAll.Visible = value;
lblReplaceWith.Visible = txtReplaceWith.Visible = value;
btnFindAllHighlightAll.Visible = !value;
this.AcceptButton = value ? btnReplace : btnFindNext;
UpdateTitleBar();
}
}
private void BtnFindPrevious_Click(object sender, EventArgs e)
{
FindNext(false, true, "内容没有找到!");
}
private void BtnFindNext_Click(object sender, EventArgs e)
{
FindNext(false, false, "内容没有找到");
}
public bool _lastSearchWasBackward = false;
public bool _lastSearchLoopedAround;
public TextRange FindNext(bool viaF3, bool searchBackward, string messageIfNotFound)
{
if (string.IsNullOrEmpty(txtLookFor.Text))
{
MessageBox.Show("没有指定要查找的内容!", "提示");
return null;
}
_lastSearchWasBackward = searchBackward;
_search.LookFor = txtLookFor.Text;
_search.MatchCase = chkMatchCase.Checked;
_search.MatchWholeWordOnly = chkMatchWholeWord.Checked;
Caret caret = _editor.ActiveTextAreaControl.Caret;
if (viaF3 && _search.HasScanRegion && !Globals.IsInRange(caret.Offset, _search.BeginOffset, _search.EndOffset))
{
// user moved outside of the originally selected region
_search.ClearScanRegion();
UpdateTitleBar();
}
int startFrom = caret.Offset - (searchBackward ? 1 : 0);
TextRange range = _search.FindNext(startFrom, searchBackward, out _lastSearchLoopedAround);
if (range != null)
SelectResult(range);
else if (messageIfNotFound != null)
MessageBox.Show(messageIfNotFound, "提示");
return range;
}
private void SelectResult(TextRange range)
{
TextLocation p1 = _editor.Document.OffsetToPosition(range.Offset);
TextLocation p2 = _editor.Document.OffsetToPosition(range.Offset + range.Length);
_editor.ActiveTextAreaControl.SelectionManager.SetSelection(p1, p2);
//_editor.ActiveTextAreaControl.ScrollTo(p1.Line, p1.Column);
// Also move the caret to the end of the selection, because when the user
// presses F3, the caret is where we start searching next time.
_editor.ActiveTextAreaControl.Caret.Position =
_editor.Document.OffsetToPosition(range.Offset + range.Length);
}
Dictionary<TextEditorControl, HighlightGroup> _highlightGroups = new Dictionary<TextEditorControl, HighlightGroup>();
private void btnHighlightAll_Click(object sender, EventArgs e)
{
if (!_highlightGroups.ContainsKey(_editor))
_highlightGroups[_editor] = new HighlightGroup(_editor);
HighlightGroup group = _highlightGroups[_editor];
if (string.IsNullOrEmpty(LookFor))
// Clear highlights
group.ClearMarkers();
else
{
_search.LookFor = txtLookFor.Text;
_search.MatchCase = chkMatchCase.Checked;
_search.MatchWholeWordOnly = chkMatchWholeWord.Checked;
bool looped = false;
int offset = 0, count = 0;
for (; ; )
{
TextRange range = _search.FindNext(offset, false, out looped);
if (range == null || looped)
break;
offset = range.Offset + range.Length;
count++;
TextMarker m = new TextMarker(range.Offset, range.Length,
TextMarkerType.SolidBlock, Color.Yellow, Color.Black);
group.AddMarker(m);
}
if (count == 0)
MessageBox.Show("没有找到你要查找的内容", "提示");
else
Close();
}
}
private void FindAndReplaceForm_FormClosing(object sender, FormClosingEventArgs e)
{ // Prevent dispose, as this form can be re-used
if (e.CloseReason != CloseReason.FormOwnerClosing)
{
if (this.Owner != null)
this.Owner.Select(); // prevent another app from being activated instead
e.Cancel = true;
Hide();
// Discard search region
_search.ClearScanRegion();
_editor.Refresh(); // must repaint manually
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
Close();
}
private void btnReplace_Click(object sender, EventArgs e)
{
SelectionManager sm = _editor.ActiveTextAreaControl.SelectionManager;
if (string.Equals(sm.SelectedText, txtLookFor.Text, StringComparison.OrdinalIgnoreCase))
InsertText(txtReplaceWith.Text);
FindNext(false, _lastSearchWasBackward, "内容没有找到!");
}
private void btnReplaceAll_Click(object sender, EventArgs e)
{
int count = 0;
// BUG FIX: if the replacement string contains the original search string
// (e.g. replace "red" with "very red") we must avoid looping around and
// replacing forever! To fix, start replacing at beginning of region (by
// moving the caret) and stop as soon as we loop around.
_editor.ActiveTextAreaControl.Caret.Position =
_editor.Document.OffsetToPosition(_search.BeginOffset);
//_editor.Document.UndoStack.StartUndoGroup();
//try
//{
lock (_editor.Document.UndoStack)
{
while (FindNext(false, false, null) != null)
{
if (_lastSearchLoopedAround)
break;
// Replace
count++;
InsertText(txtReplaceWith.Text);
}
}
//}
//finally
//{
// _editor.Document.UndoStack.EndUndoGroup();
//}
if (count == 0)
MessageBox.Show(string.Format("没有找到目标内容: {0}!", txtLookFor.Text), "提示");
else
{
MessageBox.Show(string.Format("替换了 {0} 处内容!", count), "提示");
Close();
}
}
private void InsertText(string text)
{
TextArea textArea = _editor.ActiveTextAreaControl.TextArea;
//textArea.Document.UndoStack.StartUndoGroup();
//try
//{
lock (textArea.Document.UndoStack)
{
if (textArea.SelectionManager.HasSomethingSelected)
{
textArea.Caret.Position = textArea.SelectionManager.SelectionCollection[0].StartPosition;
textArea.SelectionManager.RemoveSelectedText();
}
textArea.InsertString(text);
}
//}
//finally
//{
// textArea.Document.UndoStack.EndUndoGroup();
//}
}
public string LookFor { get { return txtLookFor.Text; } }
}
public class TextRange : AbstractSegment
{
IDocument _document;
public TextRange(IDocument document, int offset, int length)
{
_document = document;
this.offset = offset;
this.length = length;
}
}
/// <summary>This class finds occurrances of a search string in a text
/// editor's IDocument... it's like Find box without a GUI.</summary>
public class TextEditorSearcher : IDisposable
{
IDocument _document;
public IDocument Document
{
get { return _document; }
set
{
if (_document != value)
{
ClearScanRegion();
_document = value;
}
}
}
// I would have used the TextAnchor class to represent the beginning and
// end of the region to scan while automatically adjusting to changes in
// the document--but for some reason it is sealed and its constructor is
// internal. Instead I use a TextMarker, which is perhaps even better as
// it gives me the opportunity to highlight the region. Note that all the
// markers and coloring information is associated with the text document,
// not the editor control, so TextEditorSearcher doesn't need a reference
// to the TextEditorControl. After adding the marker to the document, we
// must remember to remove it when it is no longer needed.
TextMarker _region = null;
/// <summary>Sets the region to search. The region is updated
/// automatically as the document changes.</summary>
public void SetScanRegion(ISelection sel)
{
SetScanRegion(sel.Offset, sel.Length);
}
/// <summary>Sets the region to search. The region is updated
/// automatically as the document changes.</summary>
public void SetScanRegion(int offset, int length)
{
Color bkgColor = _document.HighlightingStrategy.GetColorFor("Default").BackgroundColor;
_region = new TextMarker(offset, length, TextMarkerType.SolidBlock,
Globals.HalfMix(bkgColor, Color.FromArgb(160, 160, 160)));
_document.MarkerStrategy.AddMarker(_region);
}
public bool HasScanRegion
{
get { return _region != null; }
}
public void ClearScanRegion()
{
if (_region != null)
{
_document.MarkerStrategy.RemoveMarker(_region);
_region = null;
}
}
public void Dispose() { ClearScanRegion(); GC.SuppressFinalize(this); }
~TextEditorSearcher() { Dispose(); }
/// <summary>Begins the start offset for searching</summary>
public int BeginOffset
{
get
{
if (_region != null)
return _region.Offset;
else
return 0;
}
}
/// <summary>Begins the end offset for searching</summary>
public int EndOffset
{
get
{
if (_region != null)
return _region.EndOffset;
else
return _document.TextLength;
}
}
public bool MatchCase;
public bool MatchWholeWordOnly;
string _lookFor;
string _lookFor2; // uppercase in case-insensitive mode
public string LookFor
{
get { return _lookFor; }
set { _lookFor = value; }
}
/// <summary>Finds next instance of LookFor, according to the search rules
/// (MatchCase, MatchWholeWordOnly).</summary>
/// <param name="beginAtOffset">Offset in Document at which to begin the search</param>
/// <remarks>If there is a match at beginAtOffset precisely, it will be returned.</remarks>
/// <returns>Region of document that matches the search string</returns>
public TextRange FindNext(int beginAtOffset, bool searchBackward, out bool loopedAround)
{
Debug.Assert(!string.IsNullOrEmpty(_lookFor));
loopedAround = false;
int startAt = BeginOffset, endAt = EndOffset;
int curOffs = Globals.InRange(beginAtOffset, startAt, endAt);
_lookFor2 = MatchCase ? _lookFor : _lookFor.ToUpperInvariant();
TextRange result;
if (searchBackward)
{
result = FindNextIn(startAt, curOffs, true);
if (result == null)
{
loopedAround = true;
result = FindNextIn(curOffs, endAt, true);
}
}
else
{
result = FindNextIn(curOffs, endAt, false);
if (result == null)
{
loopedAround = true;
result = FindNextIn(startAt, curOffs, false);
}
}
return result;
}
public delegate TResult Func<T1, T2, TResult>(T1 arg1, T2 arg2);
public delegate TResult Func<T, TResult>(T arg);
private TextRange FindNextIn(int offset1, int offset2, bool searchBackward)
{
Debug.Assert(offset2 >= offset1);
offset2 -= _lookFor.Length;
// Make behavior decisions before starting search loop
Func<char, char, bool> matchFirstCh;
Func<int, bool> matchWord;
if (MatchCase)
matchFirstCh = delegate(char lookFor, char c)
{
return lookFor == c;
};
else
matchFirstCh = delegate(char lookFor, char c)
{
return lookFor == Char.ToUpperInvariant(c);
};
if (MatchWholeWordOnly)
matchWord = IsWholeWordMatch;
else
matchWord = IsPartWordMatch;
// Search
char lookForCh = _lookFor2[0];
if (searchBackward)
{
for (int offset = offset2; offset >= offset1; offset--)
{
if (matchFirstCh(lookForCh, _document.GetCharAt(offset))
&& matchWord(offset))
return new TextRange(_document, offset, _lookFor.Length);
}
}
else
{
for (int offset = offset1; offset <= offset2; offset++)
{
if (matchFirstCh(lookForCh, _document.GetCharAt(offset))
&& matchWord(offset))
return new TextRange(_document, offset, _lookFor.Length);
}
}
return null;
}
private bool IsWholeWordMatch(int offset)
{
if (IsWordBoundary(offset) && IsWordBoundary(offset + _lookFor.Length))
return IsPartWordMatch(offset);
else
return false;
}
private bool IsWordBoundary(int offset)
{
return offset <= 0 || offset >= _document.TextLength ||
!IsAlphaNumeric(offset - 1) || !IsAlphaNumeric(offset);
}
private bool IsAlphaNumeric(int offset)
{
char c = _document.GetCharAt(offset);
return Char.IsLetterOrDigit(c) || c == '_';
}
private bool IsPartWordMatch(int offset)
{
string substr = _document.GetText(offset, _lookFor.Length);
if (!MatchCase)
substr = substr.ToUpperInvariant();
return substr == _lookFor2;
}
}
/// <summary>Bundles a group of markers together so that they can be cleared
/// together.</summary>
public class HighlightGroup : IDisposable
{
List<TextMarker> _markers = new List<TextMarker>();
TextEditorControl _editor;
IDocument _document;
public HighlightGroup(TextEditorControl editor)
{
_editor = editor;
_document = editor.Document;
}
public void AddMarker(TextMarker marker)
{
_markers.Add(marker);
_document.MarkerStrategy.AddMarker(marker);
}
public void ClearMarkers()
{
foreach (TextMarker m in _markers)
_document.MarkerStrategy.RemoveMarker(m);
_markers.Clear();
_editor.Refresh();
}
public void Dispose() { ClearMarkers(); GC.SuppressFinalize(this); }
~HighlightGroup() { Dispose(); }
public IList<TextMarker> Markers { get { return _markers.AsReadOnly(); } }
}
}
@@ -0,0 +1,235 @@
namespace XmlPad
{
partial class FindAndReplaceForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.lblReplaceWith = new System.Windows.Forms.Label();
this.txtLookFor = new System.Windows.Forms.TextBox();
this.txtReplaceWith = new System.Windows.Forms.TextBox();
this.btnFindNext = new System.Windows.Forms.Button();
this.btnReplace = new System.Windows.Forms.Button();
this.btnReplaceAll = new System.Windows.Forms.Button();
this.chkMatchWholeWord = new System.Windows.Forms.CheckBox();
this.chkMatchCase = new System.Windows.Forms.CheckBox();
this.btnFindAllHighlightAll = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnFindPrevious = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(77, 12);
this.label1.TabIndex = 0;
this.label1.Text = "查找内容(&N):";
//
// lblReplaceWith
//
this.lblReplaceWith.AutoSize = true;
this.lblReplaceWith.Location = new System.Drawing.Point(12, 36);
this.lblReplaceWith.Name = "lblReplaceWith";
this.lblReplaceWith.Size = new System.Drawing.Size(65, 12);
this.lblReplaceWith.TabIndex = 2;
this.lblReplaceWith.Text = "替换为(&P):";
//
// txtLookFor
//
this.txtLookFor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtLookFor.Location = new System.Drawing.Point(95, 6);
this.txtLookFor.Name = "txtLookFor";
this.txtLookFor.Size = new System.Drawing.Size(232, 21);
this.txtLookFor.TabIndex = 1;
//
// txtReplaceWith
//
this.txtReplaceWith.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtReplaceWith.Location = new System.Drawing.Point(95, 33);
this.txtReplaceWith.Name = "txtReplaceWith";
this.txtReplaceWith.Size = new System.Drawing.Size(232, 21);
this.txtReplaceWith.TabIndex = 3;
//
// btnFindNext
//
this.btnFindNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnFindNext.Location = new System.Drawing.Point(228, 137);
this.btnFindNext.Name = "btnFindNext";
this.btnFindNext.Size = new System.Drawing.Size(100, 30);
this.btnFindNext.TabIndex = 6;
this.btnFindNext.Text = "查找下一个(&F)";
this.btnFindNext.UseVisualStyleBackColor = true;
this.btnFindNext.Click += new System.EventHandler(this.BtnFindNext_Click);
//
// btnReplace
//
this.btnReplace.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnReplace.Location = new System.Drawing.Point(12, 174);
this.btnReplace.Name = "btnReplace";
this.btnReplace.Size = new System.Drawing.Size(100, 30);
this.btnReplace.TabIndex = 7;
this.btnReplace.Text = "替换(&R)";
this.btnReplace.UseVisualStyleBackColor = true;
this.btnReplace.Click += new System.EventHandler(this.btnReplace_Click);
//
// btnReplaceAll
//
this.btnReplaceAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnReplaceAll.Location = new System.Drawing.Point(119, 174);
this.btnReplaceAll.Name = "btnReplaceAll";
this.btnReplaceAll.Size = new System.Drawing.Size(100, 30);
this.btnReplaceAll.TabIndex = 9;
this.btnReplaceAll.Text = "全部替换(&A)";
this.btnReplaceAll.UseVisualStyleBackColor = true;
this.btnReplaceAll.Click += new System.EventHandler(this.btnReplaceAll_Click);
//
// chkMatchWholeWord
//
this.chkMatchWholeWord.AutoSize = true;
this.chkMatchWholeWord.Location = new System.Drawing.Point(145, 27);
this.chkMatchWholeWord.Name = "chkMatchWholeWord";
this.chkMatchWholeWord.Size = new System.Drawing.Size(90, 16);
this.chkMatchWholeWord.TabIndex = 5;
this.chkMatchWholeWord.Text = "全字匹配(&W)";
this.chkMatchWholeWord.UseVisualStyleBackColor = true;
//
// chkMatchCase
//
this.chkMatchCase.AutoSize = true;
this.chkMatchCase.Location = new System.Drawing.Point(22, 27);
this.chkMatchCase.Name = "chkMatchCase";
this.chkMatchCase.Size = new System.Drawing.Size(102, 16);
this.chkMatchCase.TabIndex = 4;
this.chkMatchCase.Text = "大小写匹配(&C)";
this.chkMatchCase.UseVisualStyleBackColor = true;
//
// btnFindAllHighlightAll
//
this.btnFindAllHighlightAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnFindAllHighlightAll.Location = new System.Drawing.Point(66, 174);
this.btnFindAllHighlightAll.Name = "btnFindAllHighlightAll";
this.btnFindAllHighlightAll.Size = new System.Drawing.Size(150, 30);
this.btnFindAllHighlightAll.TabIndex = 8;
this.btnFindAllHighlightAll.Text = "查找全部并高亮显示(&H)";
this.btnFindAllHighlightAll.UseVisualStyleBackColor = true;
this.btnFindAllHighlightAll.Visible = false;
this.btnFindAllHighlightAll.Click += new System.EventHandler(this.btnHighlightAll_Click);
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(228, 173);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(100, 30);
this.btnCancel.TabIndex = 6;
this.btnCancel.Text = "取消(&C)";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnFindPrevious
//
this.btnFindPrevious.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnFindPrevious.Location = new System.Drawing.Point(118, 138);
this.btnFindPrevious.Name = "btnFindPrevious";
this.btnFindPrevious.Size = new System.Drawing.Size(100, 30);
this.btnFindPrevious.TabIndex = 6;
this.btnFindPrevious.Text = "查找上一个(&P)";
this.btnFindPrevious.UseVisualStyleBackColor = true;
this.btnFindPrevious.Click += new System.EventHandler(this.BtnFindPrevious_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.chkMatchCase);
this.groupBox1.Controls.Add(this.chkMatchWholeWord);
this.groupBox1.Location = new System.Drawing.Point(14, 64);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(313, 63);
this.groupBox1.TabIndex = 10;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "查找选项";
//
// FindAndReplaceForm
//
this.AcceptButton = this.btnReplace;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(339, 215);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnReplaceAll);
this.Controls.Add(this.btnReplace);
this.Controls.Add(this.btnFindAllHighlightAll);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnFindPrevious);
this.Controls.Add(this.btnFindNext);
this.Controls.Add(this.txtReplaceWith);
this.Controls.Add(this.txtLookFor);
this.Controls.Add(this.lblReplaceWith);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FindAndReplaceForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "查找和替换";
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindAndReplaceForm_FormClosing);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lblReplaceWith;
private System.Windows.Forms.TextBox txtLookFor;
private System.Windows.Forms.TextBox txtReplaceWith;
private System.Windows.Forms.Button btnFindNext;
private System.Windows.Forms.Button btnReplace;
private System.Windows.Forms.Button btnReplaceAll;
private System.Windows.Forms.CheckBox chkMatchWholeWord;
private System.Windows.Forms.CheckBox chkMatchCase;
private System.Windows.Forms.Button btnFindAllHighlightAll;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnFindPrevious;
private System.Windows.Forms.GroupBox groupBox1;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+92
View File
@@ -0,0 +1,92 @@
namespace RySmartEditor.Controls
{
partial class FrmTitle
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.TxtTitle = new ryControls.TextBoxEx2();
this.BtnOK = new ryControls.ButtonEx();
this.SuspendLayout();
//
// TxtTitle
//
this.TxtTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TxtTitle.BackColor = System.Drawing.Color.White;
this.TxtTitle.EmptyText = "请输入标题";
this.TxtTitle.ImeMode = System.Windows.Forms.ImeMode.Close;
this.TxtTitle.Location = new System.Drawing.Point(12, 23);
this.TxtTitle.MaxLength = 999999999;
this.TxtTitle.Multiline = false;
this.TxtTitle.Name = "TxtTitle";
this.TxtTitle.OnlyNumeric = false;
this.TxtTitle.PasswordChar = '\0';
this.TxtTitle.ReadOnly = false;
this.TxtTitle.SelectedText = "";
this.TxtTitle.SelectionLength = 0;
this.TxtTitle.SelectionStart = 0;
this.TxtTitle.Size = new System.Drawing.Size(363, 23);
this.TxtTitle.TabIndex = 111;
this.TxtTitle.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
this.TxtTitle.ToolTip = "";
this.TxtTitle.WordWrap = true;
//
// BtnOK
//
this.BtnOK.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
this.BtnOK.Location = new System.Drawing.Point(292, 78);
this.BtnOK.Name = "BtnOK";
this.BtnOK.Size = new System.Drawing.Size(82, 26);
this.BtnOK.TabIndex = 112;
this.BtnOK.Text = "确定";
this.BtnOK.UseVisualStyleBackColor = true;
this.BtnOK.Click += new System.EventHandler(this.BtnOK_Click);
//
// FrmTitle
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(383, 116);
this.Controls.Add(this.BtnOK);
this.Controls.Add(this.TxtTitle);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmTitle";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "请输入标题";
this.TopMost = true;
this.ResumeLayout(false);
}
#endregion
private ryControls.ButtonEx BtnOK;
public ryControls.TextBoxEx2 TxtTitle;
}
}
+29
View File
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace RySmartEditor.Controls
{
public partial class FrmTitle : Form
{
public FrmTitle()
{
InitializeComponent();
}
private void BtnOK_Click(object sender, EventArgs e)
{
if(TxtTitle.Text.Length<2)
{
MessageBox.Show("内容输入太短。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
DialogResult = DialogResult.OK;
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,154 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
namespace AutocompleteMenuNS
{
/// <summary>
/// Item of autocomplete menu
/// </summary>
public class AutocompleteItem
{
public object Tag;
string toolTipTitle;
string toolTipText;
string menuText;
/// <summary>
/// Parent AutocompleteMenu
/// </summary>
public AutocompleteMenu Parent { get; internal set; }
/// <summary>
/// Text for inserting into textbox
/// </summary>
public string Text { get; set; }
/// <summary>
/// Image index for this item
/// </summary>
public int ImageIndex{get; set; }
/// <summary>
/// Alignment. The direction the text shows.
/// </summary>
public StringAlignment Alignment { get; set; }
/// <summary>
/// Title for tooltip.
/// </summary>
/// <remarks>Return null for disable tooltip for this item</remarks>
public virtual string ToolTipTitle
{
get { return toolTipTitle; }
set { toolTipTitle = value; }
}
/// <summary>
/// Tooltip text.
/// </summary>
/// <remarks>For display tooltip text, ToolTipTitle must be not null</remarks>
public virtual string ToolTipText
{
get { return toolTipText; }
set { toolTipText = value; }
}
/// <summary>
/// Menu text. This text is displayed in the drop-down menu.
/// </summary>
public virtual string MenuText
{
get { return menuText; }
set { menuText = value; }
}
public AutocompleteItem()
{
ImageIndex = -1;
}
public AutocompleteItem(string text):this()
{
Text = text;
Alignment = StringAlignment.Near;
}
public AutocompleteItem(string text, int imageIndex)
: this(text)
{
this.ImageIndex = imageIndex;
}
public AutocompleteItem(string text, int imageIndex, string menuText)
: this(text, imageIndex)
{
this.menuText = menuText;
}
public AutocompleteItem(string text, int imageIndex, string menuText, string toolTipTitle, string toolTipText)
: this(text, imageIndex, menuText)
{
this.toolTipTitle = toolTipTitle;
this.toolTipText = toolTipText;
}
/// <summary>
/// Returns text for inserting into Textbox
/// </summary>
public virtual string GetTextForReplace()
{
return Text;
}
/// <summary>
/// Compares fragment text with this item
/// </summary>
public virtual CompareResult Compare(string fragmentText)
{
if (Text.StartsWith(fragmentText, StringComparison.InvariantCultureIgnoreCase) &&
Text != fragmentText)
return CompareResult.VisibleAndSelected;
return CompareResult.Hidden;
}
/// <summary>
/// Returns text for display into popup menu
/// </summary>
public override string ToString()
{
return menuText ?? Text;
}
/// <summary>
/// This method is called after item was inserted into text
/// </summary>
public virtual void OnSelected(SelectedEventArgs e)
{
}
public virtual void OnPaint(PaintItemEventArgs e)
{
using(var brush = new SolidBrush(e.IsSelected ? e.Colors.SelectedForeColor : e.Colors.ForeColor))
e.Graphics.DrawString(ToString(), e.Font, brush, e.TextRect, new StringFormat() {Alignment = Alignment});
}
}
public enum CompareResult
{
/// <summary>
/// Item do not appears
/// </summary>
Hidden,
/// <summary>
/// Item appears
/// </summary>
Visible,
/// <summary>
/// Item appears and will selected
/// </summary>
VisibleAndSelected
}
}
@@ -0,0 +1,199 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AutocompleteMenuNS
{
/// <summary>
/// This autocomplete item appears after dot
/// </summary>
public class MethodAutocompleteItem : AutocompleteItem
{
string firstPart;
string lowercaseText;
public MethodAutocompleteItem(string text)
: base(text)
{
lowercaseText = Text.ToLower();
}
public override CompareResult Compare(string fragmentText)
{
int i = fragmentText.LastIndexOf('.');
if (i < 0)
return CompareResult.Hidden;
string lastPart = fragmentText.Substring(i + 1);
firstPart = fragmentText.Substring(0, i);
if (lastPart == "") return CompareResult.Visible;
if (Text.StartsWith(lastPart, StringComparison.InvariantCultureIgnoreCase))
return CompareResult.VisibleAndSelected;
if (lowercaseText.Contains(lastPart.ToLower()))
return CompareResult.Visible;
return CompareResult.Hidden;
}
public override string GetTextForReplace()
{
return firstPart + "." + Text;
}
}
/// <summary>
/// Autocomplete item for code snippets
/// </summary>
/// <remarks>Snippet can contain special char ^ for caret position.</remarks>
public class SnippetAutocompleteItem : AutocompleteItem
{
public SnippetAutocompleteItem(string snippet)
{
Text = snippet.Replace("\r", "");
ToolTipTitle = "Code snippet:";
ToolTipText = Text;
}
public override string ToString()
{
return MenuText ?? Text.Replace("\n", " ").Replace("^", "");
}
public override string GetTextForReplace()
{
return Text;
}
public override void OnSelected(SelectedEventArgs e)
{
var tb = Parent.TargetControlWrapper;
//
if (!Text.Contains("^"))
return;
var text = tb.Text;
for (int i = Parent.Fragment.Start; i < text.Length; i++)
if (text[i] == '^')
{
tb.SelectionStart = i;
tb.SelectionLength = 1;
tb.SelectedText = "";
return;
}
}
/// <summary>
/// Compares fragment text with this item
/// </summary>
public override CompareResult Compare(string fragmentText)
{
if (Text.StartsWith(fragmentText, StringComparison.InvariantCultureIgnoreCase) &&
Text != fragmentText)
return CompareResult.Visible;
return CompareResult.Hidden;
}
}
/// <summary>
/// This class finds items by substring
/// </summary>
public class SubstringAutocompleteItem : AutocompleteItem
{
protected readonly string lowercaseText;
protected readonly bool ignoreCase;
public SubstringAutocompleteItem(string text, bool ignoreCase = true)
: base(text)
{
this.ignoreCase = ignoreCase;
if(ignoreCase)
lowercaseText = text.ToLower();
}
public override CompareResult Compare(string fragmentText)
{
if(ignoreCase)
{
if (lowercaseText.Contains(fragmentText.ToLower()))
return CompareResult.Visible;
}
else
{
if (Text.Contains(fragmentText))
return CompareResult.Visible;
}
return CompareResult.Hidden;
}
}
/// <summary>
/// This item draws multicolumn menu
/// </summary>
public class MulticolumnAutocompleteItem : SubstringAutocompleteItem
{
public bool CompareBySubstring { get; set; }
public string[] MenuTextByColumns { get; set; }
public int[] ColumnWidth { get; set; }
public StringAlignment[] Alignments { get; set; }
public MulticolumnAutocompleteItem(string[] menuTextByColumns, string insertingText, bool compareBySubstring = true, bool ignoreCase = true)
: base(insertingText, ignoreCase)
{
this.CompareBySubstring = compareBySubstring;
this.MenuTextByColumns = menuTextByColumns;
var tmp = new List<StringAlignment>();
for(int i = 0; i < menuTextByColumns.Length; i++)
tmp.Add(StringAlignment.Near);
this.Alignments = tmp.ToArray();
}
public override CompareResult Compare(string fragmentText)
{
if (CompareBySubstring)
return base.Compare(fragmentText);
if(ignoreCase)
{
if (Text.StartsWith(fragmentText, StringComparison.InvariantCultureIgnoreCase))
return CompareResult.VisibleAndSelected;
} else
if (Text.StartsWith(fragmentText))
return CompareResult.VisibleAndSelected;
return CompareResult.Hidden;
}
public override void OnPaint(PaintItemEventArgs e)
{
if (ColumnWidth != null && ColumnWidth.Length != MenuTextByColumns.Length)
throw new Exception("ColumnWidth.Length != MenuTextByColumns.Length");
int[] columnWidth = ColumnWidth;
if(columnWidth == null)
{
columnWidth = new int[MenuTextByColumns.Length];
float step = e.TextRect.Width/MenuTextByColumns.Length;
for (int i = 0; i < MenuTextByColumns.Length; i++)
columnWidth[i] = (int)step;
}
//draw columns
Pen pen = Pens.Silver;
float x = e.TextRect.X;
e.StringFormat.FormatFlags = e.StringFormat.FormatFlags | StringFormatFlags.NoWrap;
using (var brush = new SolidBrush(e.IsSelected ? e.Colors.SelectedForeColor : e.Colors.ForeColor))
for (int i=0;i<MenuTextByColumns.Length;i++)
{
var width = columnWidth[i];
var rect = new RectangleF(x, e.TextRect.Top, width, e.TextRect.Height);
e.Graphics.DrawLine(pen, new PointF(x, e.TextRect.Top), new PointF(x, e.TextRect.Bottom));
e.Graphics.DrawString(MenuTextByColumns[i], e.Font, brush, rect, new StringFormat() {Alignment = Alignments[i]});
x += width;
}
}
}
}
@@ -0,0 +1,420 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace AutocompleteMenuNS
{
[System.ComponentModel.ToolboxItem(false)]
public class AutocompleteListView : UserControl, IAutocompleteListView
{
private readonly ToolTip toolTip = new ToolTip();
public int HighlightedItemIndex { get; set; }
private int oldItemCount;
private int selectedItemIndex = -1;
private IList<AutocompleteItem> visibleItems;
/// <summary>
/// Duration (ms) of tooltip showing
/// </summary>
public int ToolTipDuration { get; set; }
/// <summary>
/// Occurs when user selected item for inserting into text
/// </summary>
public event EventHandler ItemSelected;
/// <summary>
/// Occurs when current hovered item is changing
/// </summary>
public event EventHandler<HoveredEventArgs> ItemHovered;
/// <summary>
/// Colors
/// </summary>
public Colors Colors { get; set; }
internal AutocompleteListView()
{
SetStyle(
ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
base.Font = new Font(FontFamily.GenericSansSerif, 11);
ItemHeight = Font.Height + 2;
VerticalScroll.SmallChange = ItemHeight;
BackColor = Color.White;
LeftPadding = 18;
ToolTipDuration = 3000;
Colors = new Colors();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
toolTip.Dispose();
}
base.Dispose(disposing);
}
private int itemHeight;
public int ItemHeight
{
get { return itemHeight; }
set {
itemHeight = value;
VerticalScroll.SmallChange = value;
oldItemCount = -1;
AdjustScroll();
}
}
public override Font Font
{
get { return base.Font; }
set
{
base.Font = value;
ItemHeight = Font.Height + 2;
}
}
public int LeftPadding { get; set; }
public ImageList ImageList { get; set; }
public string[] ColumnsTitle { get; set; } = null;
public int[] ColumnsWidth { get; set; } = null;
public IList<AutocompleteItem> VisibleItems
{
get { return visibleItems; }
set
{
visibleItems = value;
SelectedItemIndex = -1;
AdjustScroll();
Invalidate();
}
}
public int SelectedItemIndex
{
get { return selectedItemIndex; }
set
{
AutocompleteItem item = null;
if (value >= 0 && value < VisibleItems.Count)
item = VisibleItems[value];
selectedItemIndex = value;
OnItemHovered(new HoveredEventArgs() { Item = item });
if (item != null)
{
ShowToolTip(item, this.Parent);
ScrollToSelected();
}
Invalidate();
}
}
private void OnItemHovered(HoveredEventArgs e)
{
if (ItemHovered != null)
ItemHovered(this, e);
}
private void AdjustScroll()
{
if (VisibleItems == null)
return;
if (oldItemCount == VisibleItems.Count)
return;
int needHeight = ItemHeight*VisibleItems.Count + 1;
if (HasColumn) needHeight += ItemHeight;
Height = Math.Min(needHeight, MaximumSize.Height);
AutoScrollMinSize = new Size(0, needHeight);
oldItemCount = VisibleItems.Count;
}
private void ScrollToSelected()
{
int y;
if(HasColumn)
y = (SelectedItemIndex + 1)*ItemHeight - VerticalScroll.Value;
else
y = SelectedItemIndex * ItemHeight - VerticalScroll.Value;
//if (HasColumn) y += ItemHeight;
if (y < 0)
if(HasColumn)
VerticalScroll.Value = (SelectedItemIndex + 1) * ItemHeight;
else
VerticalScroll.Value = SelectedItemIndex * ItemHeight;
if (y > ClientSize.Height - ItemHeight)
VerticalScroll.Value = Math.Min(VerticalScroll.Maximum,
(HasColumn ? (SelectedItemIndex*ItemHeight) + ItemHeight : SelectedItemIndex * ItemHeight) - ClientSize.Height + ItemHeight);
//Show headers if index 0 is selected.
if (HasColumn && SelectedItemIndex == 0)
VerticalScroll.Value = 0;
//some magic for update scrolls
AutoScrollMinSize -= new Size(1, 0);
AutoScrollMinSize += new Size(1, 0);
}
public Rectangle GetItemRectangle(int itemIndex)
{
var y = itemIndex * ItemHeight - VerticalScroll.Value;
return new Rectangle(0, y, ClientSize.Width - 1, ItemHeight - 1);
}
protected override void OnPaintBackground(PaintEventArgs e)
{
e.Graphics.Clear(Colors.BackColor);
}
private bool HasColumn
{
get
{
return ColumnsTitle != null && ColumnsTitle.Length != 0;
}
}
protected override void OnPaint(PaintEventArgs e)
{
bool rtl = RightToLeft == RightToLeft.Yes;
AdjustScroll();
int startI = VerticalScroll.Value/ItemHeight - 1;
int finishI = (VerticalScroll.Value + ClientSize.Height)/ItemHeight + 1;
int y = 0;
var sf = new StringFormat();
if (rtl)
sf.FormatFlags = StringFormatFlags.DirectionRightToLeft;
if (HasColumn && VerticalScroll.Value == 0)
{
var textRect = new Rectangle(LeftPadding, y, ClientSize.Width - 1 - LeftPadding, ItemHeight - 1);
if (rtl)
textRect = new Rectangle(1, y, ClientSize.Width - 1 - LeftPadding, ItemHeight - 1);
int[] columnWidth = ColumnsWidth;
if (columnWidth == null)
{
columnWidth = new int[ColumnsTitle.Length];
float step = textRect.Width / ColumnsTitle.Length;
for (int i = 0; i < ColumnsTitle.Length; i++)
columnWidth[i] = (int)step;
}
float x = textRect.X;
sf.Alignment = StringAlignment.Center;
for (int i = 0; i < ColumnsTitle.Length; i++)
{
using (var brush = new SolidBrush(Colors.ForeColor))
{
var width = columnWidth[i];
var rect = new RectangleF(x, textRect.Top, width, textRect.Height);
e.Graphics.DrawLine(Pens.Silver, new PointF(x, textRect.Top), new PointF(x, textRect.Bottom));
e.Graphics.DrawString(ColumnsTitle[i], Font, brush, rect, sf);
x += width;
}
}
if (rtl)
sf.FormatFlags = StringFormatFlags.DirectionRightToLeft;
else
sf = new StringFormat();
}
startI = Math.Max(startI, 0);
finishI = Math.Min(finishI, VisibleItems.Count);
for (int i = startI; i < finishI; i++)
{
if(HasColumn)
y = (i * ItemHeight - VerticalScroll.Value) + ItemHeight;
else
y = i * ItemHeight - VerticalScroll.Value;
if (ImageList != null && VisibleItems[i].ImageIndex >= 0)
if (rtl)
e.Graphics.DrawImage(ImageList.Images[VisibleItems[i].ImageIndex], Width - 1 - LeftPadding, y);
else
e.Graphics.DrawImage(ImageList.Images[VisibleItems[i].ImageIndex], 1, y);
var textRect = new Rectangle(LeftPadding, y, ClientSize.Width - 1 - LeftPadding, ItemHeight - 1);
if (rtl)
textRect = new Rectangle(1, y, ClientSize.Width - 1 - LeftPadding, ItemHeight - 1);
if (i == SelectedItemIndex)
{
Brush selectedBrush = new LinearGradientBrush(new Point(0, y - 3), new Point(0, y + ItemHeight),
Colors.SelectedBackColor2, Colors.SelectedBackColor);
e.Graphics.FillRectangle(selectedBrush, textRect);
using(var pen = new Pen(Colors.SelectedBackColor2))
e.Graphics.DrawRectangle(pen, textRect);
}
if (i == HighlightedItemIndex)
using (var pen = new Pen(Colors.HighlightingColor))
e.Graphics.DrawRectangle(pen, textRect);
var args = new PaintItemEventArgs(e.Graphics, e.ClipRectangle)
{
Font = Font,
TextRect = new RectangleF(textRect.Location, textRect.Size),
StringFormat = sf,
IsSelected = i == SelectedItemIndex,
IsHovered = i == HighlightedItemIndex,
Colors = Colors
};
//call drawing
VisibleItems[i].OnPaint(args);
}
}
protected override void OnScroll(ScrollEventArgs se)
{
base.OnScroll(se);
Invalidate(true);
}
protected override void OnMouseClick(MouseEventArgs e)
{
int i = PointToItemIndex(e.Location);
if (i >= 0)
{
base.OnMouseClick(e);
if (e.Button == MouseButtons.Left)
{
SelectedItemIndex = i;
ScrollToSelected();
Invalidate();
}
}
}
private Point mouseEnterPoint;
protected override void OnMouseEnter(EventArgs e)
{
base.OnMouseEnter(e);
mouseEnterPoint = Control.MousePosition;
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (mouseEnterPoint != Control.MousePosition)
{
int i = PointToItemIndex(e.Location);
if (i >= 0)
{
HighlightedItemIndex = i;
Invalidate();
}
}
}
protected override void OnMouseDoubleClick(MouseEventArgs e)
{
int i = PointToItemIndex(e.Location);
if (i >= 0)
{
base.OnMouseDoubleClick(e);
SelectedItemIndex = i;
Invalidate();
OnItemSelected();
}
}
private void OnItemSelected()
{
if (ItemSelected != null)
ItemSelected(this, EventArgs.Empty);
}
private int PointToItemIndex(Point p)
{
var t = (p.Y + VerticalScroll.Value);
if (HasColumn)
t -= ItemHeight;
return (float)t / ItemHeight < 0 ? -1 : t / ItemHeight;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
var host = Parent as AutocompleteMenuHost;
if (host != null)
if (host.Menu.ProcessKey((char) keyData, Keys.None))
return true;
return base.ProcessCmdKey(ref msg, keyData);
}
public void SelectItem(int itemIndex)
{
SelectedItemIndex = itemIndex;
ScrollToSelected();
Invalidate();
}
public void SetItems(List<AutocompleteItem> items)
{
VisibleItems = items;
SelectedItemIndex = -1;
AdjustScroll();
Invalidate();
}
public void ShowToolTip(AutocompleteItem autocompleteItem, Control control = null)
{
string title = autocompleteItem.ToolTipTitle;
string text = autocompleteItem.ToolTipText;
if (control == null)
control = this;
if (string.IsNullOrEmpty(title))
{
toolTip.ToolTipTitle = null;
toolTip.SetToolTip(control, null);
return;
}
if (string.IsNullOrEmpty(text))
{
toolTip.ToolTipTitle = null;
toolTip.Show(title, control, Width + 3, 0, ToolTipDuration);
}
else
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, control, Width + 3, 0, ToolTipDuration);
}
}
public void HideToolTip(Control control)
{
toolTip.Hide(control);
}
public Control GetParentControl()
{
return this.Parent;
}
}
}
@@ -0,0 +1,903 @@
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// License: GNU Lesser General Public License (LGPLv3)
//
// Email: p_torgashov@ukr.net.
//
// Copyright (C) Pavel Torgashov, 2012-2015.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Collections;
using System.Diagnostics;
namespace AutocompleteMenuNS
{
[ProvideProperty("AutocompleteMenu", typeof(Control))]
public class AutocompleteMenu : Component, IExtenderProvider
{
private static readonly Dictionary<Control, AutocompleteMenu> AutocompleteMenuByControls =
new Dictionary<Control, AutocompleteMenu>();
private static readonly Dictionary<Control, ITextBoxWrapper> WrapperByControls =
new Dictionary<Control, ITextBoxWrapper>();
private ITextBoxWrapper targetControlWrapper;
private readonly Timer timer = new Timer();
private IEnumerable<AutocompleteItem> sourceItems = new List<AutocompleteItem>();
[Browsable(false)]
public IList<AutocompleteItem> VisibleItems { get { return Host.ListView.VisibleItems; } private set { Host.ListView.VisibleItems = value;} }
private Size maximumSize;
/// <summary>
/// Duration (ms) of tooltip showing
/// </summary>
[Description("Duration (ms) of tooltip showing")]
[DefaultValue(3000)]
public int ToolTipDuration
{
get { return Host.ListView.ToolTipDuration; }
set { Host.ListView.ToolTipDuration = value; }
}
public AutocompleteMenu()
{
Host = new AutocompleteMenuHost(this);
Host.ListView.ItemSelected += new EventHandler(ListView_ItemSelected);
Host.ListView.ItemHovered += new EventHandler<HoveredEventArgs>(ListView_ItemHovered);
VisibleItems = new List<AutocompleteItem>();
Enabled = true;
AppearInterval = 500;
timer.Tick += timer_Tick;
MaximumSize = new Size(180, 200);
AutoPopup = true;
SearchPattern = @"[\w\.]";
MinFragmentLength = 2;
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
timer.Dispose();
Host.Dispose();
}
base.Dispose(disposing);
}
void ListView_ItemSelected(object sender, EventArgs e)
{
OnSelecting();
}
void ListView_ItemHovered(object sender, HoveredEventArgs e)
{
OnHovered(e);
}
public void OnHovered(HoveredEventArgs e)
{
if (Hovered != null)
Hovered(this, e);
}
[Browsable(false)]
public int SelectedItemIndex { get { return Host.ListView.SelectedItemIndex; }
internal set { Host.ListView.SelectedItemIndex = value; }
}
internal AutocompleteMenuHost Host { get; set; }
/// <summary>
/// Called when user selected the control and needed wrapper over it.
/// You can assign own Wrapper for target control.
/// </summary>
[Description("Called when user selected the control and needed wrapper over it. You can assign own Wrapper for target control.")]
public event EventHandler<WrapperNeededEventArgs> WrapperNeeded;
protected void OnWrapperNeeded(WrapperNeededEventArgs args)
{
if (WrapperNeeded != null)
WrapperNeeded(this, args);
if (args.Wrapper == null)
args.Wrapper = TextBoxWrapper.Create(args.TargetControl);
}
ITextBoxWrapper CreateWrapper(Control control)
{
if (WrapperByControls.ContainsKey(control))
return WrapperByControls[control];
var args = new WrapperNeededEventArgs(control);
OnWrapperNeeded(args);
if (args.Wrapper != null)
WrapperByControls[control] = args.Wrapper;
return args.Wrapper;
}
/// <summary>
/// Current target control wrapper
/// </summary>
[Browsable(false)]
public ITextBoxWrapper TargetControlWrapper
{
get { return targetControlWrapper; }
set {
targetControlWrapper = value;
if (value != null && !WrapperByControls.ContainsKey(value.TargetControl))
{
WrapperByControls[value.TargetControl] = value;
SetAutocompleteMenu(value.TargetControl, this);
}
}
}
/// <summary>
/// Maximum size of popup menu
/// </summary>
[DefaultValue(typeof(Size), "180, 200")]
[Description("Maximum size of popup menu")]
public Size MaximumSize
{
get { return maximumSize; }
set {
maximumSize = value;
(Host.ListView as Control).MaximumSize = maximumSize;
(Host.ListView as Control).Size = maximumSize;
Host.CalcSize();
}
}
/// <summary>
/// Font
/// </summary>
public Font Font
{
get { return (Host.ListView as Control).Font; }
set { (Host.ListView as Control).Font = value; }
}
/// <summary>
/// Left padding of text
/// </summary>
[DefaultValue(18)]
[Description("Left padding of text")]
public int LeftPadding
{
get {
if (Host.ListView is AutocompleteListView)
return (Host.ListView as AutocompleteListView).LeftPadding;
else
return 0;
}
set {
if (Host.ListView is AutocompleteListView)
(Host.ListView as AutocompleteListView).LeftPadding = value;
}
}
/// <summary>
/// Colors of foreground and background
/// </summary>
[Browsable(true)]
[Description("Colors of foreground and background.")]
[TypeConverter(typeof(ExpandableObjectConverter))]
public Colors Colors
{
get { return (Host.ListView as IAutocompleteListView).Colors; }
set { (Host.ListView as IAutocompleteListView).Colors = value; }
}
/// <summary>
/// AutocompleteMenu will popup automatically (when user writes text). Otherwise it will popup only programmatically or by Ctrl-Space.
/// </summary>
[DefaultValue(true)]
[Description("AutocompleteMenu will popup automatically (when user writes text). Otherwise it will popup only programmatically or by Ctrl-Space.")]
public bool AutoPopup { get; set; }
/// <summary>
/// AutocompleteMenu will capture focus when opening.
/// </summary>
[DefaultValue(false)]
[Description("AutocompleteMenu will capture focus when opening.")]
public bool CaptureFocus { get; set; }
/// <summary>
/// Indicates whether the component should draw right-to-left for RTL languages.
/// </summary>
[DefaultValue(typeof(RightToLeft), "No")]
[Description("Indicates whether the component should draw right-to-left for RTL languages.")]
public RightToLeft RightToLeft {
get { return Host.RightToLeft; }
set { Host.RightToLeft = value; }
}
/// <summary>
/// Image list
/// </summary>
public ImageList ImageList {
get { return Host.ListView.ImageList; }
set { Host.ListView.ImageList = value; }
}
/// <summary>
/// Fragment
/// </summary>
[Browsable(false)]
public Range Fragment { get; internal set; }
/// <summary>
/// Regex pattern for serach fragment around caret
/// </summary>
[Description("Regex pattern for serach fragment around caret")]
[DefaultValue(@"[\w\.]")]
public string SearchPattern { get; set; }
/// <summary>
/// Minimum fragment length for popup
/// </summary>
[Description("Minimum fragment length for popup")]
[DefaultValue(2)]
public int MinFragmentLength { get; set; }
/// <summary>
/// Allows TAB for select menu item
/// </summary>
[Description("Allows TAB for select menu item")]
[DefaultValue(false)]
public bool AllowsTabKey { get; set; }
/// <summary>
/// Interval of menu appear (ms)
/// </summary>
[Description("Interval of menu appear (ms)")]
[DefaultValue(500)]
public int AppearInterval { get; set; }
[DefaultValue(null)]
public string[] Items
{
get
{
if (sourceItems == null)
return null;
var list = new List<string>();
foreach (AutocompleteItem item in sourceItems)
list.Add(item.ToString());
return list.ToArray();
}
set { SetAutocompleteItems(value); }
}
/// <summary>
/// The control for menu displaying.
/// Set to null for restore default ListView (AutocompleteListView).
/// </summary>
[Browsable(false)]
public IAutocompleteListView ListView
{
get { return Host.ListView; }
set
{
if (ListView != null)
{
var ctrl = value as Control;
value.ImageList = ImageList;
ctrl.RightToLeft = RightToLeft;
ctrl.Font = Font;
ctrl.MaximumSize = MaximumSize;
}
Host.ListView = value;
Host.ListView.ItemSelected += new EventHandler(ListView_ItemSelected);
Host.ListView.ItemHovered += new EventHandler<HoveredEventArgs>(ListView_ItemHovered);
}
}
[DefaultValue(true)]
public bool Enabled { get; set; }
/// <summary>
/// Updates size of the menu
/// </summary>
public void Update()
{
Host.CalcSize();
}
/// <summary>
/// Returns rectangle of item
/// </summary>
public Rectangle GetItemRectangle(int itemIndex)
{
return Host.ListView.GetItemRectangle(itemIndex);
}
#region IExtenderProvider Members
bool IExtenderProvider.CanExtend(object extendee)
{
//find AutocompleteMenu with lowest hashcode
if (Container != null)
foreach (object comp in Container.Components)
if (comp is AutocompleteMenu)
if (comp.GetHashCode() < GetHashCode())
return false;
//we are main autocomplete menu on form ...
//check extendee as TextBox
if (!(extendee is Control))
return false;
var temp = TextBoxWrapper.Create(extendee as Control);
return temp!=null;
}
public void SetAutocompleteMenu(Control control, AutocompleteMenu menu)
{
if (menu != null)
{
if (WrapperByControls.ContainsKey(control))
{
var wrapper = WrapperByControls[control];
if (wrapper == null) return;
//
if (control.IsHandleCreated)
menu.SubscribeForm(wrapper);
else
control.HandleCreated += (o, e) => menu.SubscribeForm(wrapper);
//
AutocompleteMenuByControls[control] = this;
//
wrapper.LostFocus += menu.control_LostFocus;
wrapper.Scroll += menu.control_Scroll;
wrapper.KeyDown += menu.control_KeyDown;
wrapper.MouseDown += menu.control_MouseDown;
}
else
{
var wrapper = menu.CreateWrapper(control);
if (wrapper == null) return;
//
if (control.IsHandleCreated)
menu.SubscribeForm(wrapper);
else
control.HandleCreated += (o, e) => menu.SubscribeForm(wrapper);
//
AutocompleteMenuByControls[control] = this;
//
wrapper.LostFocus += menu.control_LostFocus;
wrapper.Scroll += menu.control_Scroll;
wrapper.KeyDown += menu.control_KeyDown;
wrapper.MouseDown += menu.control_MouseDown;
}
}
else
{
AutocompleteMenuByControls.TryGetValue(control, out menu);
AutocompleteMenuByControls.Remove(control);
ITextBoxWrapper wrapper = null;
WrapperByControls.TryGetValue(control, out wrapper);
WrapperByControls.Remove(control);
if (wrapper != null && menu != null)
{
wrapper.LostFocus -= menu.control_LostFocus;
wrapper.Scroll -= menu.control_Scroll;
wrapper.KeyDown -= menu.control_KeyDown;
wrapper.MouseDown -= menu.control_MouseDown;
}
}
}
#endregion
/// <summary>
/// User selects item
/// </summary>
[Description("Occurs when user selects item.")]
public event EventHandler<SelectingEventArgs> Selecting;
/// <summary>
/// It fires after item was inserting
/// </summary>
[Description("Occurs after user selected item.")]
public event EventHandler<SelectedEventArgs> Selected;
/// <summary>
/// It fires when item was hovered
/// </summary>
[Description("Occurs when user hovered item.")]
public event EventHandler<HoveredEventArgs> Hovered;
/// <summary>
/// Occurs when popup menu is opening
/// </summary>
public event EventHandler<CancelEventArgs> Opening;
private void timer_Tick(object sender, EventArgs e)
{
timer.Stop();
if(TargetControlWrapper!=null)
ShowAutocomplete(false);
}
private Form myForm;
void SubscribeForm(ITextBoxWrapper wrapper)
{
if (wrapper == null) return;
var form = wrapper.TargetControl.FindForm();
if (form == null) return;
if (myForm != null)
{
if (myForm == form)
return;
UnsubscribeForm(wrapper);
}
myForm = form;
form.LocationChanged += new EventHandler(form_LocationChanged);
form.ResizeBegin += new EventHandler(form_LocationChanged);
form.FormClosing += new FormClosingEventHandler(form_FormClosing);
form.LostFocus += new EventHandler(form_LocationChanged);
}
void UnsubscribeForm(ITextBoxWrapper wrapper)
{
if (wrapper == null) return;
var form = wrapper.TargetControl.FindForm();
if (form == null) return;
form.LocationChanged -= new EventHandler(form_LocationChanged);
form.ResizeBegin -= new EventHandler(form_LocationChanged);
form.FormClosing -= new FormClosingEventHandler(form_FormClosing);
form.LostFocus -= new EventHandler(form_LocationChanged);
}
private void form_FormClosing(object sender, FormClosingEventArgs e)
{
Close();
}
private void form_LocationChanged(object sender, EventArgs e)
{
Close();
}
private void control_MouseDown(object sender, MouseEventArgs e)
{
Close();
}
ITextBoxWrapper FindWrapper(Control sender)
{
while (sender != null)
{
if (WrapperByControls.ContainsKey(sender))
return WrapperByControls[sender];
sender = sender.Parent;
}
return null;
}
private void control_KeyDown(object sender, KeyEventArgs e)
{
TargetControlWrapper = FindWrapper(sender as Control);
bool backspaceORdel = e.KeyCode == Keys.Back || e.KeyCode == Keys.Delete;
if (Host.Visible)
{
if (ProcessKey((char)e.KeyCode, Control.ModifierKeys))
e.SuppressKeyPress = true;
else
if (!backspaceORdel)
ResetTimer(1);
else
ResetTimer();
return;
}
if (!Host.Visible)
{
switch (e.KeyCode)
{
case Keys.Up:
case Keys.Down:
case Keys.PageUp:
case Keys.PageDown:
case Keys.Left:
case Keys.Right:
case Keys.End:
case Keys.Home:
case Keys.ControlKey:
case Keys.Escape:
case Keys.Tab:
{
timer.Stop();
return;
}
}
if (Control.ModifierKeys== Keys.Alt)
{
timer.Stop();
return;
}
if (Control.ModifierKeys == Keys.Control && e.KeyCode == Keys.Space)
{
ShowAutocomplete(true);
e.SuppressKeyPress = true;
return;
}
}
ResetTimer();
}
void ResetTimer()
{
ResetTimer(-1);
}
void ResetTimer(int interval)
{
if (interval <= 0)
timer.Interval = AppearInterval;
else
timer.Interval = interval;
timer.Stop();
timer.Start();
}
private void control_Scroll(object sender, ScrollEventArgs e)
{
Close();
}
private void control_LostFocus(object sender, EventArgs e)
{
if (!Host.Focused) Close();
}
public AutocompleteMenu GetAutocompleteMenu(Control control)
{
if (AutocompleteMenuByControls.ContainsKey(control))
return AutocompleteMenuByControls[control];
else
return null;
}
bool forcedOpened = false;
internal void ShowAutocomplete(bool forced)
{
if (forced)
forcedOpened = true;
if (TargetControlWrapper != null && TargetControlWrapper.Readonly)
{
Close();
return;
}
if (!Enabled)
{
Close();
return;
}
if (!forcedOpened && !AutoPopup)
{
Close();
return;
}
//build list
BuildAutocompleteList(forcedOpened);
//show popup menu
if (VisibleItems.Count > 0)
{
if (forced && VisibleItems.Count == 1 && Host.ListView.SelectedItemIndex == 0)
{
//do autocomplete if menu contains only one line and user press CTRL-SPACE
OnSelecting();
Close();
}
else
ShowMenu();
}
else
Close();
}
private void ShowMenu()
{
if (!Host.Visible)
{
var args = new CancelEventArgs();
OnOpening(args);
if (!args.Cancel)
{
//calc screen point for popup menu
Point point = TargetControlWrapper.TargetControl.Location;
point.Offset(2, TargetControlWrapper.TargetControl.Height + 2);
point = TargetControlWrapper.GetPositionFromCharIndex(Fragment.Start);
point.Offset(2, TargetControlWrapper.TargetControl.Font.Height + 2);
//
Host.Show(TargetControlWrapper.TargetControl, point);
if (CaptureFocus)
{
(Host.ListView as Control).Focus();
//ProcessKey((char) Keys.Down, Keys.None);
}
}
}
else
(Host.ListView as Control).Invalidate();
}
private void BuildAutocompleteList(bool forced)
{
var visibleItems = new List<AutocompleteItem>();
bool foundSelected = false;
int selectedIndex = -1;
//get fragment around caret
Range fragment = GetFragment(SearchPattern);
string text = fragment.Text;
//
if (sourceItems != null)
if (forced || (text.Length >= MinFragmentLength /* && tb.Selection.Start == tb.Selection.End*/))
{
Fragment = fragment;
//build popup menu
foreach (AutocompleteItem item in sourceItems)
{
item.Parent = this;
CompareResult res = item.Compare(text);
if (res != CompareResult.Hidden)
visibleItems.Add(item);
if (res == CompareResult.VisibleAndSelected && !foundSelected)
{
foundSelected = true;
selectedIndex = visibleItems.Count - 1;
}
}
}
VisibleItems = visibleItems;
if (foundSelected)
Host.ListView.SelectedItemIndex = selectedIndex;
else
Host.ListView.SelectedItemIndex = 0;
Host.ListView.HighlightedItemIndex = -1;
Host.CalcSize();
}
internal void OnOpening(CancelEventArgs args)
{
if (Opening != null)
Opening(this, args);
}
private Range GetFragment(string searchPattern)
{
var tb = TargetControlWrapper;
if (tb.SelectionLength > 0) return new Range(tb);
string text = tb.Text;
var regex = new Regex(searchPattern);
var result = new Range(tb);
int startPos = tb.SelectionStart;
//go forward
int i = startPos;
while (i >= 0 && i < text.Length)
{
if (!regex.IsMatch(text[i].ToString()))
break;
i++;
}
result.End = i;
//go backward
i = startPos;
while (i > 0 && (i - 1) < text.Length)
{
if (!regex.IsMatch(text[i - 1].ToString()))
break;
i--;
}
result.Start = i;
return result;
}
public void Close()
{
Host.ListView.HideToolTip(Host.ListView.GetParentControl());
Host.Close();
forcedOpened = false;
}
public void SetAutocompleteItems(IEnumerable<string> items)
{
var list = new List<AutocompleteItem>();
if (items == null)
{
sourceItems = null;
return;
}
foreach (string item in items)
list.Add(new AutocompleteItem(item));
SetAutocompleteItems(list);
}
public void SetAutocompleteItems(IEnumerable<AutocompleteItem> items)
{
sourceItems = items;
}
public void AddItem(string item)
{
AddItem(new AutocompleteItem(item));
}
public void AddItem(AutocompleteItem item)
{
if (sourceItems == null)
sourceItems = new List<AutocompleteItem>();
if (sourceItems is IList)
(sourceItems as IList).Add(item);
else
throw new Exception("Current autocomplete items does not support adding");
}
/// <summary>
/// Shows popup menu immediately
/// </summary>
/// <param name="forced">If True - MinFragmentLength will be ignored</param>
public void Show(Control control, bool forced)
{
SetAutocompleteMenu(control, this);
this.TargetControlWrapper = FindWrapper(control);
ShowAutocomplete(forced);
}
internal virtual void OnSelecting()
{
if (SelectedItemIndex < 0 || SelectedItemIndex >= VisibleItems.Count)
return;
AutocompleteItem item = VisibleItems[SelectedItemIndex];
var args = new SelectingEventArgs
{
Item = item,
SelectedIndex = SelectedItemIndex
};
OnSelecting(args);
if (args.Cancel)
{
SelectedItemIndex = args.SelectedIndex;
(Host.ListView as Control).Invalidate(true);
return;
}
if (!args.Handled)
{
Range fragment = Fragment;
ApplyAutocomplete(item, fragment);
}
Close();
//
var args2 = new SelectedEventArgs
{
Item = item,
Control = TargetControlWrapper.TargetControl
};
item.OnSelected(args2);
OnSelected(args2);
}
private void ApplyAutocomplete(AutocompleteItem item, Range fragment)
{
string newText = item.GetTextForReplace();
//replace text of fragment
fragment.Text = newText;
fragment.TargetWrapper.TargetControl.Focus();
}
internal void OnSelecting(SelectingEventArgs args)
{
if (Selecting != null)
Selecting(this, args);
}
public void OnSelected(SelectedEventArgs args)
{
if (Selected != null)
Selected(this, args);
}
public void SetColumns(string[] columns, int[] columnsWidth = null)
{
ListView.ColumnsTitle = columns;
ListView.ColumnsWidth = columnsWidth;
}
public void SelectNext(int shift)
{
SelectedItemIndex = Math.Max(0, Math.Min(SelectedItemIndex + shift, VisibleItems.Count - 1));
//
(Host.ListView as Control).Invalidate();
}
public bool ProcessKey(char c, Keys keyModifiers)
{
var page = Host.Height / (Font.Height + 4);
if (keyModifiers == Keys.None)
switch ((Keys) c)
{
case Keys.Down:
SelectNext(+1);
return true;
case Keys.PageDown:
SelectNext(+page);
return true;
case Keys.Up:
SelectNext(-1);
return true;
case Keys.PageUp:
SelectNext(-page);
return true;
case Keys.Enter:
OnSelecting();
return true;
case Keys.Tab:
if (!AllowsTabKey)
break;
OnSelecting();
return true;
case Keys.Left:
case Keys.Right:
Close();
return false;
case Keys.Escape:
Close();
return true;
}
return false;
}
/// <summary>
/// Menu is visible
/// </summary>
public bool Visible
{
get { return Host != null && Host.Visible; }
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,98 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace AutocompleteMenuNS
{
[System.ComponentModel.ToolboxItem(false)]
internal class AutocompleteMenuHost : ToolStripDropDown
{
private IAutocompleteListView listView;
public ToolStripControlHost Host { get; set; }
public readonly AutocompleteMenu Menu;
public IAutocompleteListView ListView
{
get { return listView; }
set {
if(listView != null)
(listView as Control).LostFocus -= new EventHandler(ListView_LostFocus);
if (value == null)
listView = new AutocompleteListView();
else
{
if (!(value is Control))
throw new Exception("ListView must be derived from Control class");
listView = value;
}
Host = new ToolStripControlHost(ListView as Control);
Host.Margin = new Padding(2, 2, 2, 2);
Host.Padding = Padding.Empty;
Host.AutoSize = false;
Host.AutoToolTip = false;
(ListView as Control).MaximumSize = Menu.MaximumSize;
(ListView as Control).Size = Menu.MaximumSize;
(ListView as Control).LostFocus += new EventHandler(ListView_LostFocus);
CalcSize();
base.Items.Clear();
base.Items.Add(Host);
(ListView as Control).Parent = this;
}
}
public AutocompleteMenuHost(AutocompleteMenu menu)
{
AutoClose = false;
AutoSize = false;
Margin = Padding.Empty;
Padding = Padding.Empty;
Menu = menu;
ListView = new AutocompleteListView();
}
protected override void OnPaintBackground(PaintEventArgs e)
{
using (var brush = new SolidBrush(listView.Colors.BackColor))
e.Graphics.FillRectangle(brush, e.ClipRectangle);
}
internal void CalcSize()
{
Host.Size = (ListView as Control).Size;
Size = new System.Drawing.Size((ListView as Control).Size.Width + 4, (ListView as Control).Size.Height + 4);
}
public override RightToLeft RightToLeft
{
get
{
return base.RightToLeft;
}
set
{
base.RightToLeft = value;
(ListView as Control).RightToLeft = value;
}
}
protected override void OnLostFocus(EventArgs e)
{
base.OnLostFocus(e);
if(!(ListView as Control).Focused)
Close();
}
void ListView_LostFocus(object sender, EventArgs e)
{
if (!Focused)
Close();
}
}
}
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
namespace AutocompleteMenuNS
{
[Serializable]
public class Colors
{
public Color ForeColor { get; set; }
public Color BackColor { get; set; }
public Color SelectedForeColor { get; set; }
public Color SelectedBackColor { get; set; }
public Color SelectedBackColor2 { get; set; }
public Color HighlightingColor { get; set; }
public Colors()
{
ForeColor = Color.Black;
BackColor = Color.White;
SelectedForeColor = Color.Black;
SelectedBackColor = Color.Orange;
SelectedBackColor2 = Color.White;
HighlightingColor = Color.Orange;
}
}
}
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AutocompleteMenuNS
{
public class SelectingEventArgs : EventArgs
{
public AutocompleteItem Item { get; internal set; }
public bool Cancel { get; set; }
public int SelectedIndex { get; set; }
public bool Handled { get; set; }
}
public class SelectedEventArgs : EventArgs
{
public AutocompleteItem Item { get; internal set; }
public Control Control { get; set; }
}
public class HoveredEventArgs : EventArgs
{
public AutocompleteItem Item { get; internal set; }
}
public class PaintItemEventArgs : PaintEventArgs
{
public RectangleF TextRect { get; internal set; }
public StringFormat StringFormat { get; internal set; }
public Font Font { get; internal set; }
public bool IsSelected { get; internal set; }
public bool IsHovered { get; internal set; }
public Colors Colors { get; internal set; }
public PaintItemEventArgs(Graphics graphics, Rectangle clipRect):base(graphics, clipRect)
{
}
}
public class WrapperNeededEventArgs : EventArgs
{
public Control TargetControl { get; private set; }
public ITextBoxWrapper Wrapper { get; set; }
public WrapperNeededEventArgs(Control targetControl)
{
this.TargetControl = targetControl;
}
}
}
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace AutocompleteMenuNS
{
/// <summary>
/// Control for displaying menu items, hosted in AutocompleteMenu.
/// </summary>
public interface IAutocompleteListView
{
/// <summary>
/// Image list
/// </summary>
ImageList ImageList { get; set; }
string[] ColumnsTitle { get; set; }
int[] ColumnsWidth { get; set; }
/// <summary>
/// Index of current selected item
/// </summary>
int SelectedItemIndex { get; set; }
/// <summary>
/// Index of current selected item
/// </summary>
int HighlightedItemIndex { get; set; }
/// <summary>
/// List of visible elements
/// </summary>
IList<AutocompleteItem> VisibleItems { get;set;}
/// <summary>
/// Duration (ms) of tooltip showing
/// </summary>
int ToolTipDuration { get; set; }
/// <summary>
/// Occurs when user selected item for inserting into text
/// </summary>
event EventHandler ItemSelected;
/// <summary>
/// Occurs when current hovered item is changing
/// </summary>
event EventHandler<HoveredEventArgs> ItemHovered;
/// <summary>
/// Shows tooltip
/// </summary>
/// <param name="autocompleteItem"></param>
/// <param name="control"></param>
void ShowToolTip(AutocompleteItem autocompleteItem, Control control = null);
/// <summary>
/// Hides tooltip
/// </summary>
/// <param name="control"></param>
void HideToolTip(Control control);
/// <summary>
/// Returns rectangle of item
/// </summary>
Rectangle GetItemRectangle(int itemIndex);
/// <summary>
/// Colors
/// </summary>
Colors Colors { get; set; }
Control GetParentControl();
}
}
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AutocompleteMenuNS
{
/// <summary>
/// Wrapper over the control like TextBox.
/// </summary>
public interface ITextBoxWrapper
{
Control TargetControl { get; }
string Text { get; }
string SelectedText { get; set; }
int SelectionLength { get; set; }
int SelectionStart { get; set; }
Point GetPositionFromCharIndex(int pos);
bool Readonly { get; }
event EventHandler LostFocus;
event ScrollEventHandler Scroll;
event KeyEventHandler KeyDown;
event MouseEventHandler MouseDown;
}
}
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace AutocompleteMenuNS
{
public class Range
{
public ITextBoxWrapper TargetWrapper { get; private set; }
public int Start { get; set; }
public int End { get; set; }
public Range(ITextBoxWrapper targetWrapper)
{
this.TargetWrapper = targetWrapper;
}
public string Text
{
get
{
var text = TargetWrapper.Text;
if (string.IsNullOrEmpty(text))
return "";
if (Start >= text.Length)
return "";
if (End > text.Length)
return "";
return TargetWrapper.Text.Substring(Start, End - Start);
}
set
{
TargetWrapper.SelectionStart = Start;
TargetWrapper.SelectionLength = End - Start;
TargetWrapper.SelectedText = value;
}
}
}
}
@@ -0,0 +1,96 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using AutocompleteMenuNS;
using ScintillaNET;
public class ScintillaWrapper : ITextBoxWrapper
{
public Scintilla target;
public ScintillaWrapper(Scintilla trgt)
{
target = trgt;
//Now add handler for the UpdateUI event.
target.UpdateUI += (sender, args) =>
{
if (args?.Change == UpdateChange.HScroll || args?.Change == UpdateChange.VScroll)
{
Scroll?.Invoke(sender, new ScrollEventArgs(ScrollEventType.LargeIncrement, 0));
}
};
}
public bool Readonly
{
get{ return target.ReadOnly; }
}
public string SelectedText
{
get { return target.SelectedText; }
set
{
//Store the start of the selection.
int start = target.SelectionStart;
//Delete the current text between selections.
target.DeleteRange(target.SelectionStart, (target.SelectionEnd - target.SelectionStart));
//Add the text in the same postion.
target.InsertText(start, value);
//Clear selection and make sure the caret is at the end.
target.SelectionStart = (start + value.Length);
target.SelectionEnd = (start + value.Length);
}
}
public int SelectionLength
{
get { return (target.SelectionEnd - target.SelectionStart); }
set { target.SelectionEnd = (target.SelectionStart + value); }
}
public int SelectionStart
{
get { return target.SelectionStart; }
set { target.SelectionStart = value; }
}
public Control TargetControl
{
get { return target; }
}
public string Text
{
get { return target.Text; }
}
public Point GetPositionFromCharIndex(int pos)
{
return new Point(target.PointXFromPosition(pos), target.PointYFromPosition(pos));
}
//Events
public virtual event KeyEventHandler KeyDown
{
add { target.KeyDown += value; }
remove { target.KeyDown -= value; }
}
public virtual event EventHandler LostFocus
{
add { target.LostFocus += value; }
remove { target.LostFocus -= value; }
}
public virtual event MouseEventHandler MouseDown
{
add { target.MouseDown += value; }
remove { target.MouseDown -= value; }
}
public event ScrollEventHandler Scroll;
}
@@ -0,0 +1,138 @@
using System;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
namespace AutocompleteMenuNS
{
/// <summary>
/// Wrapper over the control like TextBox.
/// </summary>
public class TextBoxWrapper : ITextBoxWrapper
{
private Control target;
private PropertyInfo selectionStart;
private PropertyInfo selectionLength;
private PropertyInfo selectedText;
private PropertyInfo readonlyProperty;
private MethodInfo getPositionFromCharIndex;
private event ScrollEventHandler RTBScroll;
private TextBoxWrapper(Control targetControl)
{
this.target = targetControl;
Init();
}
protected virtual void Init()
{
var t = target.GetType();
selectedText = t.GetProperty("SelectedText");
selectionLength = t.GetProperty("SelectionLength");
selectionStart = t.GetProperty("SelectionStart");
readonlyProperty = t.GetProperty("ReadOnly");
getPositionFromCharIndex = t.GetMethod("GetPositionFromCharIndex") ?? t.GetMethod("PositionToPoint");
if (target is RichTextBox)
(target as RichTextBox).VScroll += new EventHandler(TextBoxWrapper_VScroll);
}
void TextBoxWrapper_VScroll(object sender, EventArgs e)
{
if (RTBScroll != null)
RTBScroll(sender, new ScrollEventArgs(ScrollEventType.EndScroll, 0, 1));
}
public static TextBoxWrapper Create(Control targetControl)
{
var result = new TextBoxWrapper(targetControl);
if (result.selectedText == null || result.selectionLength == null || result.selectionStart == null ||
result.getPositionFromCharIndex == null)
return null;
return result;
}
public virtual string Text
{
get { return target.Text; }
set { target.Text = value; }
}
public virtual string SelectedText
{
get { return (string) selectedText.GetValue(target, null); }
set { selectedText.SetValue(target, value, null); }
}
public virtual int SelectionLength
{
get { return (int) selectionLength.GetValue(target, null); }
set { selectionLength.SetValue(target, value, null); }
}
public virtual int SelectionStart
{
get { return (int) selectionStart.GetValue(target, null); }
set { selectionStart.SetValue(target, value, null); }
}
public virtual Point GetPositionFromCharIndex(int pos)
{
return (Point) getPositionFromCharIndex.Invoke(target, new object[] {pos});
}
public virtual Form FindForm()
{
return target.FindForm();
}
public virtual event EventHandler LostFocus
{
add { target.LostFocus += value; }
remove { target.LostFocus -= value; }
}
public virtual event ScrollEventHandler Scroll
{
add {
if(target is RichTextBox)
RTBScroll += value;
else
if(target is ScrollableControl)(target as ScrollableControl).Scroll += value;
}
remove {
if (target is RichTextBox)
RTBScroll -= value;
else
if(target is ScrollableControl)(target as ScrollableControl).Scroll -= value;
}
}
public virtual event KeyEventHandler KeyDown
{
add { target.KeyDown += value; }
remove { target.KeyDown -= value; }
}
public virtual event MouseEventHandler MouseDown
{
add { target.MouseDown += value; }
remove { target.MouseDown -= value; }
}
public virtual Control TargetControl
{
get { return target; }
}
public bool Readonly
{
get { return (bool) readonlyProperty.GetValue(target, null); }
}
}
}
@@ -0,0 +1,86 @@
#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()
{
}
}
}
@@ -0,0 +1,42 @@
namespace ryControls
{
partial class ContextMenuStripHighlightText2
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// ContextMenuStripRichText
//
this.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripRichText_Opening);
this.ResumeLayout(false);
}
#endregion
}
}
@@ -0,0 +1,154 @@
using ryCommon;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace ryControls
{
public partial class ContextMenuStripHighlightText2 : ContextMenuStrip
{
public ContextMenuStripHighlightText2()
{
InitializeComponent();
AddMenu("撤销", "undo").Click += Undo_Click;
AddMenu("重做", "redo").Click += Redo_Click;
AddSeparatorMenu();
AddMenu("剪切", "cut").Click += Cut_Click;
AddMenu("复制", "copy").Click += Copy_Click;
AddMenu("粘贴", "paste").Click += Paste_Click;
AddMenu("删除", "del").Click += Del_Click;
AddMenu("全选", "selectall").Click += SelectAll_Click;
AddMenu("查找", "find").Click += Find_Click;
AddSeparatorMenu();
AddMenu("用百度搜索选中内容", "bdsearch").Click += BDSearch_Click;
}
private void BDSearch_Click(object sender, EventArgs e)
{
if (base.SourceControl is ScintillaNET.Scintilla editor)
{
RyFiles.OpenUrl("https://www.baidu.com/s?wd=" +RyWeb.WebDecode.UrlEncode(editor.SelectedText));
}
}
private void Find_Click(object sender, EventArgs e)
{
if(base.SourceControl is ScintillaNET.Scintilla editor)
{
if(editor.Parent is HighlightEditor rich_txt)
{
rich_txt.ShowFind();
}
}
}
private void SelectAll_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ScintillaNET.Scintilla)) { return; }
var rich_txt = (ScintillaNET.Scintilla)base.SourceControl;
rich_txt.SelectAll();
//Thread th = new Thread(sendkey);
//th.Start();
//void sendkey()
//{
// Thread.Sleep(100);
// this.Invoke(new Action(() =>
// {
// SendKeys.SendWait("^a");
// }));
//}
}
private void Undo_Click(object sender, EventArgs e)
{
if(!(base.SourceControl is ScintillaNET.Scintilla)) { return; }
var rich_txt = (ScintillaNET.Scintilla)base.SourceControl;
rich_txt.Undo();
}
private void Redo_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ScintillaNET.Scintilla)) { return; }
var rich_txt = (ScintillaNET.Scintilla)base.SourceControl;
rich_txt.Redo();
}
private void Cut_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ScintillaNET.Scintilla)) { return; }
var rich_txt = (ScintillaNET.Scintilla)base.SourceControl;
rich_txt.Cut();
}
private void Copy_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ScintillaNET.Scintilla)) { return; }
var rich_txt = (ScintillaNET.Scintilla)base.SourceControl;
//var ss = rich_txt.SelectedText;
rich_txt.Copy();
}
private void Paste_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ScintillaNET.Scintilla)) { return; }
var rich_txt = (ScintillaNET.Scintilla)base.SourceControl;
rich_txt.Paste();
}
private void Del_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ScintillaNET.Scintilla)) { return; }
var rich_txt = (ScintillaNET.Scintilla)base.SourceControl;
rich_txt.DeleteRange(rich_txt.SelectionStart,rich_txt.SelectedText.Length);
}
public ToolStripSeparator AddSeparatorMenu()
{
ToolStripSeparator item = new ToolStripSeparator();
base.Items.Add(item);
return item;
}
public ToolStripMenuItem AddMenu(string name, string tag)
{
ToolStripMenuItem item = new ToolStripMenuItem(name)
{
Tag = tag
};
base.Items.Add(item);
return item;
}
private void ContextMenuStripRichText_Opening(object sender, CancelEventArgs e)
{
if (!(base.SourceControl is ScintillaNET.Scintilla)) { return; }
var rich_txt = (ScintillaNET.Scintilla)base.SourceControl;
for (int i = 0; i < base.Items.Count; i++)
{
var item = base.Items[i];
if (item.Tag == null) { continue; }
switch(item.Tag.ToString())
{
case "undo":
item.Enabled = rich_txt.CanUndo && !rich_txt.ReadOnly;
break;
case "redo":
item.Enabled = rich_txt.CanRedo && !rich_txt.ReadOnly;
break;
case "cut":
item.Enabled = (rich_txt.SelectedText != "" && !rich_txt.ReadOnly);
break;
case "copy":
item.Enabled = rich_txt.SelectedText != "";
break;
case "paste":
item.Enabled = !rich_txt.ReadOnly;
break;
case "del":
item.Enabled =(rich_txt.SelectedText != "" && !rich_txt.ReadOnly);
break;
case "bdsearch":
item.Enabled = (rich_txt.SelectedText != "" && rich_txt.SelectedText.IndexOfEx("\n")<0 && rich_txt.SelectedText.Length<50);
break;
case "selectall":
item.Enabled = rich_txt.SelectedText != rich_txt.Text;
break;
}
}
}
}
}
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,69 @@
namespace ScintillaNET_FindReplaceDialog.FindAllResults
{
partial class FindAllResultsPanel
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.FindResultsScintilla = new ScintillaNET.Scintilla();
this.SuspendLayout();
//
// FindResultsScintilla
//
this.FindResultsScintilla.AutoCMaxHeight = 9;
this.FindResultsScintilla.BiDirectionality = ScintillaNET.BiDirectionalDisplayType.Disabled;
this.FindResultsScintilla.CaretLineBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
this.FindResultsScintilla.CaretLineVisible = true;
this.FindResultsScintilla.Dock = System.Windows.Forms.DockStyle.Fill;
this.FindResultsScintilla.LexerName = null;
this.FindResultsScintilla.Location = new System.Drawing.Point(0, 0);
this.FindResultsScintilla.Name = "FindResultsScintilla";
this.FindResultsScintilla.ScrollWidth = 5001;
this.FindResultsScintilla.Size = new System.Drawing.Size(556, 203);
this.FindResultsScintilla.TabIndents = true;
this.FindResultsScintilla.TabIndex = 4;
this.FindResultsScintilla.Text = "搜索结果";
this.FindResultsScintilla.WrapMode = ScintillaNET.WrapMode.None;
this.FindResultsScintilla.KeyUp += new System.Windows.Forms.KeyEventHandler(this.FindResultsScintilla_KeyUp);
this.FindResultsScintilla.MouseClick += new System.Windows.Forms.MouseEventHandler(this.FindResultsScintilla_MouseClick);
this.FindResultsScintilla.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.FindResultsScintilla_MouseDoubleClick);
//
// FindAllResultsPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.FindResultsScintilla);
this.Name = "FindAllResultsPanel";
this.Size = new System.Drawing.Size(556, 203);
this.ResumeLayout(false);
}
#endregion
private ScintillaNET.Scintilla FindResultsScintilla;
}
}
@@ -0,0 +1,166 @@
namespace ScintillaNET_FindReplaceDialog.FindAllResults
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ScintillaNET;
public partial class FindAllResultsPanel : UserControl
{
#region Fields
private readonly Dictionary<int, FindResult> _findAllResults=new Dictionary<int, FindResult>();
#endregion Fields
#region Constructors
/// <summary>
/// Creates a new instance of FindAllResultsPanel
/// </summary>
public FindAllResultsPanel()
{
InitializeComponent();
FindResultsScintilla.Styles[Style.Default].Font = "Consolas";
FindResultsScintilla.Styles[Style.Default].Size = 10;
FindResultsScintilla.ClearAll();
}
public delegate void ResultEventHandler(object sender, FindResult r);
/// <summary>
/// 点击结果时发生
/// </summary>
[Description("点击结果时发生")]
public event ResultEventHandler OnResultClick;
#endregion Constructors
#region Properties
#endregion Properties
#region Methods
/// <summary>
/// Updates the find all results panel
/// </summary>
/// <param name="FindReplace">The FindReplace instance used to generate the find results.</param>
/// <param name="FindAllResults"></param>
public void UpdateFindAllResults(Dictionary<string,List<ScintillaNET_FindReplaceDialog.CharacterRange>> FindAllResults)
{
_findAllResults.Clear();
FindResultsScintilla.ReadOnly = false;
FindResultsScintilla.ClearAll();
Indicator _indicator_title = FindResultsScintilla.Indicators[15];
_indicator_title.ForeColor = Color.LightGreen;
_indicator_title.Alpha = 100;
_indicator_title.Style = IndicatorStyle.RoundBox;
_indicator_title.Under = true;
Indicator _indicator = FindResultsScintilla.Indicators[16];
_indicator.ForeColor = Color.Red;
_indicator.Alpha = 100;
_indicator.Style = IndicatorStyle.RoundBox;
_indicator.Under = true;
var line = 0;
//Write lines
foreach (var item in FindAllResults)
{
FindResultsScintilla.AppendText(item.Key+" (匹配"+ item.Value.Count+ "次)\r\n");
_findAllResults.Add(line, new FindResult());
FindResultsScintilla.Lines[line].ToggleFold();
line++;
foreach (var item_file in item.Value)
{
string resultsLinePrefix = string.Format("行 {0}: ", item_file.LineNum + 1);
FindResultsScintilla.AppendText(string.Format("{0}{1}",
resultsLinePrefix, item_file.RangeText.Replace("\n"," "))+"\r\n");
_findAllResults.Add(line,new FindResult() { Path = item.Key, Result = item_file });
line++;
}
//Highlight
foreach (var item_file in _findAllResults)
{
var item_range = item_file.Value.Result;
int lastLineStartPos = FindResultsScintilla.Lines[item_file.Key].Position;
if (item_range == null) {
FindResultsScintilla.IndicatorCurrent = _indicator_title.Index;
FindResultsScintilla.IndicatorFillRange(lastLineStartPos, FindResultsScintilla.Lines[item_file.Key].Length);
continue;
}
string resultsLinePrefix = string.Format("行 {0}: ", item_range.LineNum+1);
//int LinePos = item_range.LinePos;
//int startPosInLine = item_range.CpMin - LinePos;
FindResultsScintilla.IndicatorCurrent = _indicator.Index;
FindResultsScintilla.IndicatorFillRange(lastLineStartPos + resultsLinePrefix.Length+1, item_file.Value.Result.CpMax - item_file.Value.Result.CpMin);
}
}
FindResultsScintilla.ReadOnly = true;
}
private void FindResultsScintilla_KeyUp(object sender, KeyEventArgs e)
{
int pos = FindResultsScintilla.CurrentPosition;
int selectedLine = FindResultsScintilla.LineFromPosition(pos);
if (_findAllResults.ContainsKey(selectedLine))
{
ScintillaNET_FindReplaceDialog.CharacterRange CharRange = _findAllResults[selectedLine].Result;
if (CharRange == null) { return; }
if (CharRange.CpMax== CharRange.CpMin) { return; }
OnResultClick?.Invoke(this, _findAllResults[selectedLine]);
//Scintilla.SetSelection(CharRange.cpMin, CharRange.cpMax);
//Scintilla.ScrollCaret();
}
}
private void FindResultsScintilla_MouseClick(object sender, MouseEventArgs e)
{
int pos = FindResultsScintilla.CharPositionFromPointClose((e.Location).X, (e.Location).Y);
if (pos == -1)
return;
int selectedLine = FindResultsScintilla.LineFromPosition(pos);
if (_findAllResults.ContainsKey(selectedLine))
{
ScintillaNET_FindReplaceDialog.CharacterRange CharRange = _findAllResults[selectedLine].Result;
if (CharRange == null) { return; }
if (CharRange.CpMax == CharRange.CpMin) { return; }
OnResultClick?.Invoke(this, _findAllResults[selectedLine]);
//Scintilla.SetSelection(CharRange.cpMin, CharRange.cpMax);
//Scintilla.ScrollCaret();
}
}
private void FindResultsScintilla_MouseDoubleClick(object sender, MouseEventArgs e)
{
var aa = FindResultsScintilla.CurrentPosition;
int selectedLine = FindResultsScintilla.LineFromPosition(aa);
//int pos = FindResultsScintilla.CharPositionFromPointClose((e.Location).X, (e.Location).Y);
if (selectedLine == -1)
return;
//int selectedLine = FindResultsScintilla.LineFromPosition(pos);
if (_findAllResults.ContainsKey(selectedLine))
{
ScintillaNET_FindReplaceDialog.CharacterRange CharRange = _findAllResults[selectedLine].Result;
if (CharRange == null) { return; }
if (CharRange.CpMax == CharRange.CpMin) { return; }
OnResultClick?.Invoke(this, _findAllResults[selectedLine]);
//Scintilla.SetSelection(CharRange.cpMin, CharRange.cpMax);
//Scintilla.ScrollCaret();
//Scintilla.Focus();
}
}
#endregion Methods
}
public class FindResult
{
public string Path { get; set; } = "";
public ScintillaNET_FindReplaceDialog.CharacterRange Result { get; set; }
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,319 @@
namespace SuperDesign.Controls.Highlight.FindReplace
{
partial class FindConfig
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.rdoFileStandardR = new System.Windows.Forms.RadioButton();
this.rdoFileExtendedR = new System.Windows.Forms.RadioButton();
this.rdoFileRegexR = new System.Windows.Forms.RadioButton();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.pnlStandardOptions = new System.Windows.Forms.Panel();
this.chkFileWordStartR = new System.Windows.Forms.CheckBox();
this.chkFileWholeWordR = new System.Windows.Forms.CheckBox();
this.chkFileMatchCaseR = new System.Windows.Forms.CheckBox();
this.pnlRegexpOptions = new System.Windows.Forms.Panel();
this.chkFileSinglelineR = new System.Windows.Forms.CheckBox();
this.chkFileRightToLeftR = new System.Windows.Forms.CheckBox();
this.chkFileMultilineR = new System.Windows.Forms.CheckBox();
this.chkFileIgnorePatternWhitespaceR = new System.Windows.Forms.CheckBox();
this.chkFileIgnoreCaseR = new System.Windows.Forms.CheckBox();
this.chkFileExplicitCaptureR = new System.Windows.Forms.CheckBox();
this.chkFileEcmaScriptR = new System.Windows.Forms.CheckBox();
this.chkFileCultureInvariantR = new System.Windows.Forms.CheckBox();
this.chkFileCompiledR = new System.Windows.Forms.CheckBox();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.pnlStandardOptions.SuspendLayout();
this.pnlRegexpOptions.SuspendLayout();
this.SuspendLayout();
//
// groupBox2
//
this.groupBox2.Controls.Add(this.rdoFileStandardR);
this.groupBox2.Controls.Add(this.rdoFileExtendedR);
this.groupBox2.Controls.Add(this.rdoFileRegexR);
this.groupBox2.Location = new System.Drawing.Point(3, 3);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(158, 82);
this.groupBox2.TabIndex = 38;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "搜索模式";
//
// rdoFileStandardR
//
this.rdoFileStandardR.AutoSize = true;
this.rdoFileStandardR.Checked = true;
this.rdoFileStandardR.Location = new System.Drawing.Point(6, 20);
this.rdoFileStandardR.Name = "rdoFileStandardR";
this.rdoFileStandardR.Size = new System.Drawing.Size(47, 16);
this.rdoFileStandardR.TabIndex = 5;
this.rdoFileStandardR.TabStop = true;
this.rdoFileStandardR.Text = "标准";
this.rdoFileStandardR.UseVisualStyleBackColor = true;
this.rdoFileStandardR.CheckedChanged += new System.EventHandler(this.RdoFileStandardR_CheckedChanged);
//
// rdoFileExtendedR
//
this.rdoFileExtendedR.AutoSize = true;
this.rdoFileExtendedR.Location = new System.Drawing.Point(6, 41);
this.rdoFileExtendedR.Name = "rdoFileExtendedR";
this.rdoFileExtendedR.Size = new System.Drawing.Size(149, 16);
this.rdoFileExtendedR.TabIndex = 6;
this.rdoFileExtendedR.Text = "扩展 (\\n, \\r, \\t, \\0)";
this.rdoFileExtendedR.UseVisualStyleBackColor = true;
this.rdoFileExtendedR.CheckedChanged += new System.EventHandler(this.RdoFileExtendedR_CheckedChanged);
//
// rdoFileRegexR
//
this.rdoFileRegexR.AutoSize = true;
this.rdoFileRegexR.Location = new System.Drawing.Point(6, 62);
this.rdoFileRegexR.Name = "rdoFileRegexR";
this.rdoFileRegexR.Size = new System.Drawing.Size(83, 16);
this.rdoFileRegexR.TabIndex = 7;
this.rdoFileRegexR.Text = "正则表达式";
this.rdoFileRegexR.UseVisualStyleBackColor = true;
this.rdoFileRegexR.CheckedChanged += new System.EventHandler(this.RdoFileRegexR_CheckedChanged);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.pnlRegexpOptions);
this.groupBox1.Controls.Add(this.pnlStandardOptions);
this.groupBox1.Location = new System.Drawing.Point(164, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(371, 82);
this.groupBox1.TabIndex = 39;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "选项";
//
// pnlStandardOptions
//
this.pnlStandardOptions.Controls.Add(this.chkFileWordStartR);
this.pnlStandardOptions.Controls.Add(this.chkFileWholeWordR);
this.pnlStandardOptions.Controls.Add(this.chkFileMatchCaseR);
this.pnlStandardOptions.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlStandardOptions.Location = new System.Drawing.Point(3, 17);
this.pnlStandardOptions.Name = "pnlStandardOptions";
this.pnlStandardOptions.Size = new System.Drawing.Size(365, 62);
this.pnlStandardOptions.TabIndex = 0;
//
// chkFileWordStartR
//
this.chkFileWordStartR.AutoSize = true;
this.chkFileWordStartR.Location = new System.Drawing.Point(10, 37);
this.chkFileWordStartR.Name = "chkFileWordStartR";
this.chkFileWordStartR.Size = new System.Drawing.Size(96, 16);
this.chkFileWordStartR.TabIndex = 2;
this.chkFileWordStartR.Text = "单词开头匹配";
this.chkFileWordStartR.UseVisualStyleBackColor = true;
//
// chkFileWholeWordR
//
this.chkFileWholeWordR.AutoSize = true;
this.chkFileWholeWordR.Location = new System.Drawing.Point(10, 20);
this.chkFileWholeWordR.Name = "chkFileWholeWordR";
this.chkFileWholeWordR.Size = new System.Drawing.Size(72, 16);
this.chkFileWholeWordR.TabIndex = 1;
this.chkFileWholeWordR.Text = "全词匹配";
this.chkFileWholeWordR.UseVisualStyleBackColor = true;
//
// chkFileMatchCaseR
//
this.chkFileMatchCaseR.AutoSize = true;
this.chkFileMatchCaseR.Location = new System.Drawing.Point(10, 3);
this.chkFileMatchCaseR.Name = "chkFileMatchCaseR";
this.chkFileMatchCaseR.Size = new System.Drawing.Size(84, 16);
this.chkFileMatchCaseR.TabIndex = 0;
this.chkFileMatchCaseR.Text = "匹配大小写";
this.chkFileMatchCaseR.UseVisualStyleBackColor = true;
//
// pnlRegexpOptions
//
this.pnlRegexpOptions.Controls.Add(this.chkFileSinglelineR);
this.pnlRegexpOptions.Controls.Add(this.chkFileRightToLeftR);
this.pnlRegexpOptions.Controls.Add(this.chkFileMultilineR);
this.pnlRegexpOptions.Controls.Add(this.chkFileIgnorePatternWhitespaceR);
this.pnlRegexpOptions.Controls.Add(this.chkFileIgnoreCaseR);
this.pnlRegexpOptions.Controls.Add(this.chkFileExplicitCaptureR);
this.pnlRegexpOptions.Controls.Add(this.chkFileEcmaScriptR);
this.pnlRegexpOptions.Controls.Add(this.chkFileCultureInvariantR);
this.pnlRegexpOptions.Controls.Add(this.chkFileCompiledR);
this.pnlRegexpOptions.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlRegexpOptions.Location = new System.Drawing.Point(3, 17);
this.pnlRegexpOptions.Name = "pnlRegexpOptions";
this.pnlRegexpOptions.Size = new System.Drawing.Size(365, 62);
this.pnlRegexpOptions.TabIndex = 1;
//
// chkFileSinglelineR
//
this.chkFileSinglelineR.AutoSize = true;
this.chkFileSinglelineR.Location = new System.Drawing.Point(251, 37);
this.chkFileSinglelineR.Name = "chkFileSinglelineR";
this.chkFileSinglelineR.Size = new System.Drawing.Size(72, 16);
this.chkFileSinglelineR.TabIndex = 8;
this.chkFileSinglelineR.Text = "单行模式";
this.toolTip1.SetToolTip(this.chkFileSinglelineR, "指定单行模式。 更改点 (.) 的含义,以使它与每个字符(而不是除 \\n 之外的所有字符)匹配。");
this.chkFileSinglelineR.UseVisualStyleBackColor = true;
//
// chkFileRightToLeftR
//
this.chkFileRightToLeftR.AutoSize = true;
this.chkFileRightToLeftR.Location = new System.Drawing.Point(251, 20);
this.chkFileRightToLeftR.Name = "chkFileRightToLeftR";
this.chkFileRightToLeftR.Size = new System.Drawing.Size(72, 16);
this.chkFileRightToLeftR.TabIndex = 7;
this.chkFileRightToLeftR.Text = "从右到左";
this.toolTip1.SetToolTip(this.chkFileRightToLeftR, "指定搜索从右向左而不是从左向右进行。");
this.chkFileRightToLeftR.UseVisualStyleBackColor = true;
//
// chkFileMultilineR
//
this.chkFileMultilineR.AutoSize = true;
this.chkFileMultilineR.Location = new System.Drawing.Point(251, 3);
this.chkFileMultilineR.Name = "chkFileMultilineR";
this.chkFileMultilineR.Size = new System.Drawing.Size(72, 16);
this.chkFileMultilineR.TabIndex = 6;
this.chkFileMultilineR.Text = "多行模式";
this.toolTip1.SetToolTip(this.chkFileMultilineR, "多行模式。 更改 ^ 和 $ 的含义,使它们分别在任意一行的行首和行尾匹配,而不仅仅在整个字符串的开头和结尾匹配。 ");
this.chkFileMultilineR.UseVisualStyleBackColor = true;
//
// chkFileIgnorePatternWhitespaceR
//
this.chkFileIgnorePatternWhitespaceR.AutoSize = true;
this.chkFileIgnorePatternWhitespaceR.Location = new System.Drawing.Point(130, 37);
this.chkFileIgnorePatternWhitespaceR.Name = "chkFileIgnorePatternWhitespaceR";
this.chkFileIgnorePatternWhitespaceR.Size = new System.Drawing.Size(84, 16);
this.chkFileIgnorePatternWhitespaceR.TabIndex = 5;
this.chkFileIgnorePatternWhitespaceR.Text = "忽略空白符";
this.toolTip1.SetToolTip(this.chkFileIgnorePatternWhitespaceR, "消除模式中的非转义空白并启用由 # 标记的注释。 \r\n但是,此值不影响或消除标记单独的正则表达式语言元素的开头的字符类、数值量词或标记的空格。 ");
this.chkFileIgnorePatternWhitespaceR.UseVisualStyleBackColor = true;
//
// chkFileIgnoreCaseR
//
this.chkFileIgnoreCaseR.AutoSize = true;
this.chkFileIgnoreCaseR.Location = new System.Drawing.Point(130, 20);
this.chkFileIgnoreCaseR.Name = "chkFileIgnoreCaseR";
this.chkFileIgnoreCaseR.Size = new System.Drawing.Size(84, 16);
this.chkFileIgnoreCaseR.TabIndex = 4;
this.chkFileIgnoreCaseR.Text = "忽略大小写";
this.toolTip1.SetToolTip(this.chkFileIgnoreCaseR, "指定不区分大小写的匹配。 ");
this.chkFileIgnoreCaseR.UseVisualStyleBackColor = true;
//
// chkFileExplicitCaptureR
//
this.chkFileExplicitCaptureR.AutoSize = true;
this.chkFileExplicitCaptureR.Location = new System.Drawing.Point(130, 3);
this.chkFileExplicitCaptureR.Name = "chkFileExplicitCaptureR";
this.chkFileExplicitCaptureR.Size = new System.Drawing.Size(72, 16);
this.chkFileExplicitCaptureR.TabIndex = 3;
this.chkFileExplicitCaptureR.Text = "显式捕获";
this.toolTip1.SetToolTip(this.chkFileExplicitCaptureR, "指定唯一有效的捕获是显式命名或编号的 (?<name>...) 形式的组。\r\n这使未命名的圆括号可以充当非捕获组,并且不会使表达式的语法 (?:...) 显得笨拙" +
"。");
this.chkFileExplicitCaptureR.UseVisualStyleBackColor = true;
//
// chkFileEcmaScriptR
//
this.chkFileEcmaScriptR.AutoSize = true;
this.chkFileEcmaScriptR.Location = new System.Drawing.Point(3, 37);
this.chkFileEcmaScriptR.Name = "chkFileEcmaScriptR";
this.chkFileEcmaScriptR.Size = new System.Drawing.Size(72, 16);
this.chkFileEcmaScriptR.TabIndex = 2;
this.chkFileEcmaScriptR.Text = "ECMA脚本";
this.toolTip1.SetToolTip(this.chkFileEcmaScriptR, "指定搜索从右向左而不是从左向右进行。");
this.chkFileEcmaScriptR.UseVisualStyleBackColor = true;
this.chkFileEcmaScriptR.CheckedChanged += new System.EventHandler(this.chkFileEcmaScriptR_CheckedChanged);
//
// chkFileCultureInvariantR
//
this.chkFileCultureInvariantR.AutoSize = true;
this.chkFileCultureInvariantR.Location = new System.Drawing.Point(3, 20);
this.chkFileCultureInvariantR.Name = "chkFileCultureInvariantR";
this.chkFileCultureInvariantR.Size = new System.Drawing.Size(120, 16);
this.chkFileCultureInvariantR.TabIndex = 1;
this.chkFileCultureInvariantR.Text = "忽略语言区域差异";
this.toolTip1.SetToolTip(this.chkFileCultureInvariantR, "指定忽略语言中的区域性差异。");
this.chkFileCultureInvariantR.UseVisualStyleBackColor = true;
//
// chkFileCompiledR
//
this.chkFileCompiledR.AutoSize = true;
this.chkFileCompiledR.Location = new System.Drawing.Point(3, 3);
this.chkFileCompiledR.Name = "chkFileCompiledR";
this.chkFileCompiledR.Size = new System.Drawing.Size(60, 16);
this.chkFileCompiledR.TabIndex = 0;
this.chkFileCompiledR.Text = "已编译";
this.toolTip1.SetToolTip(this.chkFileCompiledR, "指定正则表达式编译为 MSIL 代码,而不是解释。 \r\n已编译的正则表达式最大限度地提高运行时性能,代价是会影响初始化时间。");
this.chkFileCompiledR.UseVisualStyleBackColor = true;
//
// FindConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "FindConfig";
this.Size = new System.Drawing.Size(538, 90);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.pnlStandardOptions.ResumeLayout(false);
this.pnlStandardOptions.PerformLayout();
this.pnlRegexpOptions.ResumeLayout(false);
this.pnlRegexpOptions.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RadioButton rdoFileStandardR;
private System.Windows.Forms.RadioButton rdoFileExtendedR;
private System.Windows.Forms.RadioButton rdoFileRegexR;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Panel pnlRegexpOptions;
private System.Windows.Forms.CheckBox chkFileSinglelineR;
private System.Windows.Forms.CheckBox chkFileRightToLeftR;
private System.Windows.Forms.CheckBox chkFileMultilineR;
private System.Windows.Forms.CheckBox chkFileIgnorePatternWhitespaceR;
private System.Windows.Forms.CheckBox chkFileIgnoreCaseR;
private System.Windows.Forms.CheckBox chkFileExplicitCaptureR;
private System.Windows.Forms.CheckBox chkFileEcmaScriptR;
private System.Windows.Forms.CheckBox chkFileCultureInvariantR;
private System.Windows.Forms.CheckBox chkFileCompiledR;
private System.Windows.Forms.Panel pnlStandardOptions;
private System.Windows.Forms.CheckBox chkFileWordStartR;
private System.Windows.Forms.CheckBox chkFileWholeWordR;
private System.Windows.Forms.CheckBox chkFileMatchCaseR;
}
}
@@ -0,0 +1,284 @@
using Newtonsoft.Json.Linq;
using ryCommon;
using ScintillaNET;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SuperDesign.Controls.Highlight.FindReplace
{
public partial class FindConfig : UserControl
{
public FindConfig()
{
InitializeComponent();
pnlStandardOptions.BringToFront();
}
/// <summary>
/// 搜索模式,0表示标准,1表示扩展,2表示正则
/// </summary>
[Description("搜索模式,0表示标准,1表示扩展,2表示正则")]
public int SearchMode
{
get
{
if (rdoFileStandardR.Checked) { return 0; }
if (rdoFileExtendedR.Checked) { return 1; }
if (rdoFileRegexR.Checked) { return 2; }
return -1;
}
set
{
if (value == 0) { rdoFileStandardR.Checked = true; }
else if (value ==1) { rdoFileExtendedR.Checked = true; }
else if (value == 2) { rdoFileRegexR.Checked = true; }
else { rdoFileStandardR.Checked = true; }
}
}
/// <summary>
/// 匹配大小写
/// </summary>
[Description("匹配大小写")]
public bool MatchCase
{
get { return chkFileMatchCaseR.Checked; }
set { chkFileMatchCaseR.Checked = value; }
}
/// <summary>
/// 全词匹配
/// </summary>
[Description("全词匹配")]
public bool FileWholeWord
{
get { return chkFileWholeWordR.Checked; }
set { chkFileWholeWordR.Checked = value; }
}
/// <summary>
/// 单词开头匹配
/// </summary>
[Description("单词开头匹配")]
public bool FileWordStart
{
get { return chkFileWordStartR.Checked; }
set { chkFileWordStartR.Checked = value; }
}
/// <summary>
/// 【正则】已编译
/// </summary>
[Description("【正则】已编译")]
public bool RegexCompiled
{
get { return chkFileCompiledR.Checked; }
set { chkFileCompiledR.Checked = value; }
}
/// <summary>
/// 【正则】显式捕获
/// </summary>
[Description("【正则】显式捕获")]
public bool RegexExplicitCapture
{
get { return chkFileExplicitCaptureR.Checked; }
set { chkFileExplicitCaptureR.Checked = value; }
}
/// <summary>
/// 【正则】多行模式
/// </summary>
[Description("【正则】多行模式")]
public bool RegexMultiline
{
get { return chkFileMultilineR.Checked; }
set { chkFileMultilineR.Checked = value; }
}
/// <summary>
/// 【正则】忽略语言区域差异
/// </summary>
[Description("【正则】忽略语言区域差异")]
public bool RegexFileCultureInvariant
{
get { return chkFileCultureInvariantR.Checked; }
set { chkFileCultureInvariantR.Checked = value; }
}
/// <summary>
/// 【正则】忽略大小写
/// </summary>
[Description("【正则】忽略大小写")]
public bool RegexIgnoreCase
{
get { return chkFileIgnoreCaseR.Checked; }
set { chkFileIgnoreCaseR.Checked = value; }
}
/// <summary>
/// 【正则】从右到左
/// </summary>
[Description("【正则】从右到左")]
public bool RegexRightToLeft
{
get { return chkFileRightToLeftR.Checked; }
set { chkFileRightToLeftR.Checked = value; }
}
/// <summary>
/// 【正则】ECMA脚本
/// </summary>
[Description("【正则】ECMA脚本")]
public bool RegexEcmaScript
{
get { return chkFileEcmaScriptR.Checked; }
set { chkFileEcmaScriptR.Checked = value; }
}
/// <summary>
/// 【正则】忽略空白符
/// </summary>
[Description("【正则】忽略空白符")]
public bool RegexIgnorePatternWhitespace
{
get { return chkFileIgnorePatternWhitespaceR.Checked; }
set { chkFileIgnorePatternWhitespaceR.Checked = value; }
}
/// <summary>
/// 【正则】单行模式
/// </summary>
[Description("【正则】单行模式")]
public bool RegexFileSingleline
{
get { return chkFileSinglelineR.Checked; }
set { chkFileSinglelineR.Checked = value; }
}
/// <summary>
/// 获取正则选项
/// </summary>
/// <returns></returns>
public RegexOptions GetRegexOptions()
{
RegexOptions ro = RegexOptions.None;
if (chkFileCompiledR.Checked)
ro |= RegexOptions.Compiled;
if (chkFileCultureInvariantR.Checked)
ro |= RegexOptions.CultureInvariant;
if (chkFileEcmaScriptR.Checked)
ro |= RegexOptions.ECMAScript;
if (chkFileExplicitCaptureR.Checked)
ro |= RegexOptions.ExplicitCapture;
if (chkFileIgnoreCaseR.Checked)
ro |= RegexOptions.IgnoreCase;
if (chkFileIgnorePatternWhitespaceR.Checked)
ro |= RegexOptions.IgnorePatternWhitespace;
if (chkFileMultilineR.Checked)
ro |= RegexOptions.Multiline;
if (chkFileRightToLeftR.Checked)
ro |= RegexOptions.RightToLeft;
if (chkFileSinglelineR.Checked)
ro |= RegexOptions.Singleline;
return ro;
}
/// <summary>
/// 设置正则选项
/// </summary>
/// <returns></returns>
public void SetRegexOptions(RegexOptions ro)
{
chkFileCompiledR.Checked = (ro & RegexOptions.Compiled) == RegexOptions.Compiled;
chkFileCultureInvariantR.Checked = (ro & RegexOptions.CultureInvariant) == RegexOptions.CultureInvariant;
chkFileEcmaScriptR.Checked = (ro & RegexOptions.ECMAScript) == RegexOptions.ECMAScript;
chkFileExplicitCaptureR.Checked = (ro & RegexOptions.ExplicitCapture) == RegexOptions.ExplicitCapture;
chkFileIgnoreCaseR.Checked = (ro & RegexOptions.IgnoreCase) == RegexOptions.IgnoreCase;
chkFileIgnorePatternWhitespaceR.Checked = (ro & RegexOptions.IgnorePatternWhitespace) == RegexOptions.IgnorePatternWhitespace;
chkFileMultilineR.Checked = (ro & RegexOptions.Multiline) == RegexOptions.Multiline;
chkFileRightToLeftR.Checked = (ro & RegexOptions.RightToLeft) == RegexOptions.RightToLeft;
chkFileSinglelineR.Checked = (ro & RegexOptions.Singleline) == RegexOptions.Singleline;
}
/// <summary>
/// 获取普通搜索选项
/// </summary>
/// <returns></returns>
public SearchFlags GetSearchFlags()
{
SearchFlags sf = SearchFlags.None;
if (chkFileMatchCaseR.Checked)
sf |= SearchFlags.MatchCase;
if (chkFileWholeWordR.Checked)
sf |= SearchFlags.WholeWord;
if (chkFileWordStartR.Checked)
sf |= SearchFlags.WordStart;
return sf;
}
/// <summary>
/// 设置普通搜索选项
/// </summary>
/// <returns></returns>
public void SetSearchFlags(SearchFlags sf)
{
chkFileMatchCaseR.Checked = (sf & SearchFlags.MatchCase) == SearchFlags.MatchCase;
chkFileWholeWordR.Checked = (sf & SearchFlags.WholeWord) == SearchFlags.WholeWord;
chkFileWordStartR.Checked = (sf & SearchFlags.WordStart) == SearchFlags.WordStart;
}
/// <summary>
/// 从另一个控件复制配置
/// </summary>
/// <param name="fc"></param>
public void LoadConfig(FindConfig fc)
{
SearchMode = fc.SearchMode;
fc.SetSearchFlags(fc.GetSearchFlags());
fc.SetRegexOptions(fc.GetRegexOptions());
}
private void RdoFileExtendedR_CheckedChanged(object sender, EventArgs e)
{
if (rdoFileExtendedR.Checked)
pnlStandardOptions.BringToFront();
//cmdExtCharAndRegExFindR.Enabled = !rdoStandardR.Checked;
//cmdExtCharAndRegExReplace.Enabled = !rdoStandardR.Checked;
}
private void RdoFileStandardR_CheckedChanged(object sender, EventArgs e)
{
if (rdoFileStandardR.Checked)
pnlStandardOptions.BringToFront();
}
private void RdoFileRegexR_CheckedChanged(object sender, EventArgs e)
{
if (rdoFileRegexR.Checked)
pnlRegexpOptions.BringToFront();
}
private void chkFileEcmaScriptR_CheckedChanged(object sender, EventArgs e)
{
if (((CheckBox)sender).Checked)
{
chkFileExplicitCaptureR.Checked = false;
chkFileExplicitCaptureR.Enabled = false;
chkFileIgnorePatternWhitespaceR.Checked = false;
chkFileIgnorePatternWhitespaceR.Enabled = false;
chkFileRightToLeftR.Checked = false;
chkFileRightToLeftR.Enabled = false;
chkFileSinglelineR.Checked = false;
chkFileSinglelineR.Enabled = false;
}
else
{
chkFileExplicitCaptureR.Enabled = true;
chkFileIgnorePatternWhitespaceR.Enabled = true;
chkFileRightToLeftR.Enabled = true;
chkFileSinglelineR.Enabled = true;
}
}
}
}
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
@@ -0,0 +1,40 @@
#region Using Directives
using System;
#endregion Using Directives
namespace ScintillaNET_FindReplaceDialog
{
/// <summary>
/// Controls find behavior for non-regular expression searches
/// </summary>
public enum FindOption
{
/// <summary>
/// Find must match the whole word
/// </summary>
WholeWord = 2,
/// <summary>
/// Find must match the case of the expression
/// </summary>
MatchCase = 4,
/// <summary>
/// Only match the _start of a word
/// </summary>
WordStart = 0x00100000,
/// <summary>
/// Not used in ScintillaNET
/// </summary>
RegularExpression = 0x00200000,
/// <summary>
/// Not used in ScintillaNET
/// </summary>
Posix = 0x00400000,
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>114, 56</value>
</metadata>
<metadata name="mnuExtendedCharFindF.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="mnuRecentFindF.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>576, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="mnuExtendedCharFindR.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>198, 17</value>
</metadata>
<metadata name="mnuExtendedCharReplace.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>381, 17</value>
</metadata>
<metadata name="mnuRecentFindR.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>719, 17</value>
</metadata>
<metadata name="mnuRecentReplace.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>863, 17</value>
</metadata>
<metadata name="mnuRegExCharFindF.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>223, 56</value>
</metadata>
<metadata name="mnuRegExCharFindR.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>378, 56</value>
</metadata>
<metadata name="mnuRegExCharReplace.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>533, 56</value>
</metadata>
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>721, 56</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>86</value>
</metadata>
</root>
@@ -0,0 +1,92 @@
namespace ScintillaNET_FindReplaceDialog
{
partial class FrmFinding
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.label1 = new System.Windows.Forms.Label();
this.BtnClose = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// progressBar1
//
this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.progressBar1.Location = new System.Drawing.Point(12, 12);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(578, 23);
this.progressBar1.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 38);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(113, 12);
this.label1.TabIndex = 1;
this.label1.Text = "状态:正在查找中...";
//
// BtnClose
//
this.BtnClose.Location = new System.Drawing.Point(258, 62);
this.BtnClose.Name = "BtnClose";
this.BtnClose.Size = new System.Drawing.Size(72, 25);
this.BtnClose.TabIndex = 2;
this.BtnClose.Text = "关闭";
this.BtnClose.UseVisualStyleBackColor = true;
this.BtnClose.Click += new System.EventHandler(this.BtnClose_Click);
//
// FrmFinding
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(602, 93);
this.Controls.Add(this.BtnClose);
this.Controls.Add(this.label1);
this.Controls.Add(this.progressBar1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.Name = "FrmFinding";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "正在查找...";
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmFinding_FormClosing);
this.Load += new System.EventHandler(this.FrmFinding_Load);
this.Shown += new System.EventHandler(this.FrmFinding_Shown);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button BtnClose;
}
}
@@ -0,0 +1,417 @@
using ryCommon;
using ryControls;
using ScintillaNET;
using SuperDesign.Tools.SmartEditor;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using 开发辅助工具.Tools.SmartEditor;
using static ScintillaNET.Style;
using static System.Net.Mime.MediaTypeNames;
namespace ScintillaNET_FindReplaceDialog
{
public partial class FrmFinding : Form
{
public FrmFinding()
{
InitializeComponent();
}
bool IsExit = false;
bool IsRunning = false;
/// <summary>
/// 搜索配置
/// </summary>
public SearchDirConfig SearchConfig=new SearchDirConfig();
/// <summary>
/// 获取待搜索的文件数量
/// </summary>
/// <returns></returns>
private int GetFileCount()
{
var count = 0;
GetCount(SearchConfig.SearchDir);
return count;
void GetCount(string folder)
{
if(!SearchConfig.SearchHiddenDir)
{
DirectoryInfo directory = new DirectoryInfo(folder);
if((directory.Attributes & FileAttributes.Hidden)== FileAttributes.Hidden) {
return;
}
}
var split_ext = SearchConfig.Exts.Split(';');
for (int i = 0; i < split_ext.Length; i++)
{
if (IsExit) { break; }
var files = System.IO.Directory.GetFiles(folder, split_ext[i]);
if (files != null)
count += files.Length;
}
if (SearchConfig.SearchSubDir)
{
if (IsExit) { return ; }
var folder_list = System.IO.Directory.GetDirectories(folder);
if (folder_list != null)
{
for (int i = 0; i < folder_list.Length; i++)
{
if (IsExit) { break; }
GetCount(folder_list[i]);
}
}
}
}
}
private void ShowText(string text)
{
this.Invoke(new Action(() =>
{
label1.Text = "状态:" + text;
}));
}
private List<CharacterRange> SearchText(string Text)
{
var list = new List<CharacterRange>();
var start_i = 0;
var all_text = Text;
while (start_i>=0)
{
CharacterRange foundRange = new CharacterRange(start_i, Text.Length);
try
{
if (SearchConfig.SearchMode == 2)//正则
{
Regex r = new Regex(SearchConfig.FindText, SearchConfig.RegexOptions);
Match m = r.Match(all_text);
if (!m.Success)
return list;
int start = foundRange.CpMin + all_text.Substring(0, m.Index).Length;
int end = all_text.Substring(m.Index, m.Length).Length;
var LineNum = GetLineNum(start, out var LinePos,out var LineText);
list.Add(new CharacterRange(start, start + end) {LineText= LineText, LineNum=LineNum, LinePos=LinePos,RangeText=Text.Substring(start,end) });
start_i = start+end + 1;
}
else
{
string textToFind = SearchConfig.SearchMode == 1 ? FindReplace.Transform(SearchConfig.FindText) : SearchConfig.FindText;
int start = 0;
if ((SearchConfig.SearchFlags & SearchFlags.MatchCase) == SearchFlags.MatchCase) //忽略大小写
{
start=Text.IndexOfEx(textToFind,start_i);
}
else
{
start = Text.IndexOf(textToFind, start_i, StringComparison.Ordinal);
}
int end = textToFind.Length;
if (start >= 0)
{
if ((SearchConfig.SearchFlags & SearchFlags.WholeWord) == SearchFlags.WholeWord) //全词匹配
{
if (start >= 0)
{
bool Word_Start = false;
bool Word_End = false;
if (start == 0) { Word_Start = true; }
else
{
var char_i = Text[start - 1];
if ((char_i >= '0' && char_i <= '9') || (char_i >= 'a' && char_i <= 'z')
|| (char_i >= 'A' && char_i <= 'Z'))
{
Word_Start = false;
}
else { Word_Start = true; }
}
if ((start + end)>=(Text.Length-1)) { Word_End = true; }
else
{
var char_i = Text[start + end];
if ((char_i >= '0' && char_i <= '9') || (char_i >= 'a' && char_i <= 'z')
|| (char_i >= 'A' && char_i <= 'Z'))
{
Word_End = false;
}
else { Word_End = true; }
}
if (Word_Start && Word_End)
{
var LineNum = GetLineNum(start, out var LinePos, out var LineText);
list.Add(new CharacterRange(start, start + end) { LineText = LineText, LineNum = LineNum, LinePos = LinePos, RangeText = Text.Substring(start, end) });
}
start_i = start+ end + 1;
}
else
{
break;
}
}
else if ((SearchConfig.SearchFlags & SearchFlags.WordStart) == SearchFlags.WordStart) //开头匹配
{
if (start >= 0)
{
bool Word_Start = false;
if (start == 0) { Word_Start = true; }
else
{
var char_i = Text[start - 1];
if ((char_i >= '0' && char_i <= '9') || (char_i >= 'a' && char_i <= 'z')
|| (char_i >= 'A' && char_i <= 'Z'))
{
Word_Start = false;
}
else { Word_Start = true; }
}
if (Word_Start)
{
var LineNum = GetLineNum(start, out var LinePos, out var LineText);
list.Add(new CharacterRange(start, start + end) { LineText = LineText, LineNum = LineNum, LinePos = LinePos, RangeText = Text.Substring(start, end) });
}
start_i = start+ end + 1;
}
else
{
break;
}
}
else
{
var LineNum = GetLineNum(start, out var LinePos, out var LineText);
list.Add(new CharacterRange(start, start + end) { LineText = LineText, LineNum = LineNum, LinePos = LinePos, RangeText = Text.Substring(start, end) });
start_i = start+end + 1;
}
}
else
{
break;
}
}
}
catch (ArgumentException ex)
{
}
if (foundRange.CpMin == foundRange.CpMax) { break; }
if (start_i < Text.Length)
{
all_text = Text.Substring(start_i);
}
}
//根据位置来获取该位置所在行
int GetLineNum(int pos,out int LinePos,out string LineText)
{
LinePos = -1;
var split_txt = Text.Split('\n');
var count = 0;
for (int i = 0; i < split_txt.Length; i++)
{
if (count+split_txt[i].Length+1>=pos)
{
LinePos = count;
LineText = split_txt[i];
return i;
}
else
{
count += split_txt[i].Length+1;
}
}
LineText = "";
return -1;
}
return list;
}
/// <summary>
/// 获取待搜索的文件数量
/// </summary>
/// <returns></returns>
private void SearchFiles()
{
IsRunning = true;
var count = 0;
ShowText("正在统计总文件数...");
var total_count= GetFileCount();
this.Invoke(new Action(() =>
{
progressBar1.Maximum = total_count;
}));
ShowText("统计结束,正在查找...");
Dictionary<string,List<CharacterRange>> dict_list = new Dictionary<string, List<CharacterRange>>();
new Thread(Start).Start();
void Start()
{
Search(SearchConfig.SearchDir);
this.Invoke(new Action(() =>
{
var opens = System.Windows.Forms.Application.OpenForms;
for (int i = 0; i < opens.Count; i++)
{
if (opens[i] is FrmResultText frm2)
{
frm2.findAllResultsPanel1.UpdateFindAllResults(dict_list);
frm2.Show(FrmMainEditor.MainEditor.DockPanel, WeifenLuo.WinFormsUI.Docking.DockState.DockBottom);
IsRunning = false;
this.Close();
return;
}
}
FrmResultText frm = new FrmResultText();
frm.findAllResultsPanel1.UpdateFindAllResults(dict_list);
frm.Show(FrmMainEditor.MainEditor.DockPanel, WeifenLuo.WinFormsUI.Docking.DockState.DockBottom);
IsRunning = false;
this.Close();
}));
}
void Search(string folder)
{
if (!SearchConfig.SearchHiddenDir)
{
DirectoryInfo directory = new DirectoryInfo(folder);
if ((directory.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
{
return;
}
}
var split_ext = SearchConfig.Exts.Split(';');
for (int i = 0; i < split_ext.Length; i++)
{
if (IsExit) { break; }
var files = System.IO.Directory.GetFiles(folder, split_ext[i]);
if (files != null)
{
for (int f = 0; f < files.Length; f++)
{
ShowText("正在查找=>" + files[f]);
if(SearchConfig.IgnoreBinExt)
{
var ext= Path.GetExtension(files[f]);
if (";.exe;.apk;.bin;.dll;.msi;.sys;.zip;.rar;.7z;.iso;.cab;.tar;.tgz;.crx;.psd;.jpg;.bmp;.gif;.webp;.png;.jpeg;.ico;.mp3;.wav;.ape;.aac;.flac;.ogg;.mp4;.rmvb;.flv;.wmv;.mov;.3gp;.mpeg;".IndexOfEx(";" + ext + ";") >= 0) { continue; }
}
if(SearchConfig.LimitFileSize>0)
{
if(RyFiles.GetFileSize(files[f])> SearchConfig.LimitFileSize) { continue; }
}
var text = RyFiles.ReadAllText(files[f]);
var find_list= SearchText(text);
if(find_list.Count>0)
{
dict_list.Add(files[f],find_list);
}
count++;
if (count <= total_count)
{
this.Invoke(new Action(() =>
{
progressBar1.Value = count;
}));
}
}
}
}
if (SearchConfig.SearchSubDir)
{
if (IsExit) { return; }
var folder_list = System.IO.Directory.GetDirectories(folder);
if (folder_list != null)
{
for (int i = 0; i < folder_list.Length; i++)
{
if (IsExit) { break; }
if(SearchConfig.SkipDirName.Length>0)
{
var name = Path.GetFileName(folder_list[i]);
if((";"+SearchConfig.SkipDirName+";").IndexOfEx(";"+name+";")>=0) { continue; }
}
Search(folder_list[i]);
}
}
}
}
}
private void FrmFinding_Load(object sender, EventArgs e)
{
}
private void BtnClose_Click(object sender, EventArgs e)
{
IsExit = true;
}
private void FrmFinding_FormClosing(object sender, FormClosingEventArgs e)
{
if (IsRunning) { e.Cancel = true; }
}
private void FrmFinding_Shown(object sender, EventArgs e)
{
SearchFiles();
}
}
public class FindResult
{
public string Path { get; set; } = "";
public CharacterRange Result { get; set; }
}
public class SearchDirConfig
{
/// <summary>
/// 搜索文件夹
/// </summary>
public string SearchDir { get; set; } = "";
/// <summary>
/// 是否搜索子目录
/// </summary>
public bool SearchSubDir { get; set; } = false;
/// <summary>
/// 忽略常见二进制格式
/// </summary>
public bool IgnoreBinExt { get; set; } = true;
/// <summary>
/// 是否搜索隐藏目录
/// </summary>
public bool SearchHiddenDir { get; set; } = false;
/// <summary>
/// 要查找的文本
/// </summary>
public string FindText { get; set; } = "";
/// <summary>
/// 要替换的文本
/// </summary>
public string ReplaceText { get; set; } = "";
/// <summary>
/// 要搜索的扩展名列表
/// </summary>
public string Exts { get; set; } = "";
/// <summary>
/// 跳过的目录名
/// </summary>
public string SkipDirName { get; set; } = "";
/// <summary>
/// 超过该大小的文件将不再查找
/// </summary>
public long LimitFileSize { get; set; } = 0;
/// <summary>
/// 是否开启替换模式,默认是查找模式
/// </summary>
public bool ReplaceModeOn { get; set; } = false;
/// <summary>
/// 正则表达式选项
/// </summary>
public RegexOptions RegexOptions { get; set; } = RegexOptions.None;
public ScintillaNET.SearchFlags SearchFlags { get; set; }
/// <summary>
/// 查找模式,0为普通查找,1表示扩展查找,2表示正则查找
/// </summary>
public int SearchMode { get; set; } = 0;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,180 @@
namespace ScintillaNET_FindReplaceDialog
{
partial class IncrementalSearcher
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.lblFind = new System.Windows.Forms.Label();
this.txtFind = new System.Windows.Forms.TextBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.btnNext = new System.Windows.Forms.Button();
this.brnPrevious = new System.Windows.Forms.Button();
this.btnHighlightAll = new System.Windows.Forms.Button();
this.btnClearHighlights = new System.Windows.Forms.Button();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// lblFind
//
this.lblFind.AutoSize = true;
this.lblFind.Dock = System.Windows.Forms.DockStyle.Left;
this.lblFind.Location = new System.Drawing.Point(0, 0);
this.lblFind.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.lblFind.Name = "lblFind";
this.lblFind.Size = new System.Drawing.Size(27, 22);
this.lblFind.TabIndex = 0;
this.lblFind.Text = "&Find";
this.lblFind.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtFind
//
this.txtFind.Location = new System.Drawing.Point(33, 1);
this.txtFind.Margin = new System.Windows.Forms.Padding(3, 1, 0, 0);
this.txtFind.Name = "txtFind";
this.txtFind.Size = new System.Drawing.Size(135, 20);
this.txtFind.TabIndex = 1;
this.txtFind.TextChanged += new System.EventHandler(this.txtFind_TextChanged);
this.txtFind.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtFind_KeyDown);
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.AutoSize = true;
this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flowLayoutPanel1.Controls.Add(this.lblFind);
this.flowLayoutPanel1.Controls.Add(this.txtFind);
this.flowLayoutPanel1.Controls.Add(this.btnNext);
this.flowLayoutPanel1.Controls.Add(this.brnPrevious);
this.flowLayoutPanel1.Controls.Add(this.btnHighlightAll);
this.flowLayoutPanel1.Controls.Add(this.btnClearHighlights);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(259, 22);
this.flowLayoutPanel1.TabIndex = 4;
this.flowLayoutPanel1.WrapContents = false;
//
// btnNext
//
this.btnNext.AutoSize = true;
this.btnNext.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnNext.BackgroundImage = global::RySmartEditor.Properties.Resources.GoToNextMessage;
this.btnNext.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.btnNext.FlatAppearance.BorderSize = 0;
this.btnNext.Image = global::RySmartEditor.Properties.Resources.GoToNextMessage;
this.btnNext.Location = new System.Drawing.Point(171, 0);
this.btnNext.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.btnNext.Name = "btnNext";
this.btnNext.Size = new System.Drawing.Size(22, 22);
this.btnNext.TabIndex = 2;
this.toolTip.SetToolTip(this.btnNext, "Find Next");
this.btnNext.UseVisualStyleBackColor = true;
this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
//
// brnPrevious
//
this.brnPrevious.AutoSize = true;
this.brnPrevious.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.brnPrevious.FlatAppearance.BorderSize = 0;
this.brnPrevious.Image = global::RySmartEditor.Properties.Resources.GoToPreviousMessage;
this.brnPrevious.Location = new System.Drawing.Point(193, 0);
this.brnPrevious.Margin = new System.Windows.Forms.Padding(0);
this.brnPrevious.Name = "brnPrevious";
this.brnPrevious.Size = new System.Drawing.Size(22, 22);
this.brnPrevious.TabIndex = 3;
this.toolTip.SetToolTip(this.brnPrevious, "Find Previous");
this.brnPrevious.UseVisualStyleBackColor = true;
this.brnPrevious.Click += new System.EventHandler(this.brnPrevious_Click);
//
// btnHighlightAll
//
this.btnHighlightAll.AutoSize = true;
this.btnHighlightAll.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnHighlightAll.BackgroundImage = global::RySmartEditor.Properties.Resources.LineColorHS;
this.btnHighlightAll.FlatAppearance.BorderSize = 0;
this.btnHighlightAll.Font = new System.Drawing.Font("Microsoft Sans Serif", 1.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnHighlightAll.ForeColor = System.Drawing.Color.SkyBlue;
this.btnHighlightAll.Image = global::RySmartEditor.Properties.Resources.LineColorHS;
this.btnHighlightAll.Location = new System.Drawing.Point(215, 0);
this.btnHighlightAll.Margin = new System.Windows.Forms.Padding(0);
this.btnHighlightAll.Name = "btnHighlightAll";
this.btnHighlightAll.Size = new System.Drawing.Size(22, 22);
this.btnHighlightAll.TabIndex = 4;
this.btnHighlightAll.Text = "&h";
this.toolTip.SetToolTip(this.btnHighlightAll, "Highlight All Matches (ALT+H)");
this.btnHighlightAll.UseVisualStyleBackColor = true;
this.btnHighlightAll.Click += new System.EventHandler(this.btnHighlightAll_Click);
//
// btnClearHighlights
//
this.btnClearHighlights.AutoSize = true;
this.btnClearHighlights.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnClearHighlights.FlatAppearance.BorderSize = 0;
this.btnClearHighlights.Font = new System.Drawing.Font("Microsoft Sans Serif", 1.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnClearHighlights.Image = global::RySmartEditor.Properties.Resources.DeleteHS;
this.btnClearHighlights.Location = new System.Drawing.Point(237, 0);
this.btnClearHighlights.Margin = new System.Windows.Forms.Padding(0);
this.btnClearHighlights.Name = "btnClearHighlights";
this.btnClearHighlights.Size = new System.Drawing.Size(22, 22);
this.btnClearHighlights.TabIndex = 5;
this.btnClearHighlights.Text = "&j";
this.toolTip.SetToolTip(this.btnClearHighlights, "Clear Highlights (ALT+J)");
this.btnClearHighlights.UseVisualStyleBackColor = true;
this.btnClearHighlights.Click += new System.EventHandler(this.btnClearHighlights_Click);
//
// IncrementalSearcher
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.BackColor = System.Drawing.Color.LightSteelBlue;
this.Controls.Add(this.flowLayoutPanel1);
this.Margin = new System.Windows.Forms.Padding(0);
this.Name = "IncrementalSearcher";
this.Size = new System.Drawing.Size(259, 22);
this.flowLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblFind;
private System.Windows.Forms.TextBox txtFind;
private System.Windows.Forms.Button btnNext;
private System.Windows.Forms.Button brnPrevious;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button btnHighlightAll;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.Button btnClearHighlights;
}
}
@@ -0,0 +1,303 @@
namespace ScintillaNET_FindReplaceDialog
{
using ScintillaNET;
using ScintillaNET_FindReplaceDialog;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public partial class IncrementalSearcher : UserControl
{
#region Fields
private bool _autoPosition = true;
private Scintilla _scintilla;
private bool _toolItem = false;
private FindReplace _findReplace;
#endregion Fields
#region Constructors
public IncrementalSearcher()
{
InitializeComponent();
}
public IncrementalSearcher(bool toolItem)
{
InitializeComponent();
_toolItem = toolItem;
if (toolItem)
BackColor = Color.Transparent;
}
#endregion Constructors
#region Properties
/// <summary>
/// Gets or sets whether the control should automatically move away from the current
/// selection to prevent obscuring it.
/// </summary>
/// <returns>true to automatically move away from the current selection; otherwise, false.
/// If ToolItem is enabled, this defaults to false.</returns>
public bool AutoPosition
{
get
{
return _autoPosition;
}
set
{
if (!ToolItem)
_autoPosition = value;
else
_autoPosition = false;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
public FindReplace FindReplace
{
get
{
return _findReplace;
}
set
{
_findReplace = value;
if (value!=null)
{
_scintilla = _findReplace.Scintilla;
}
else
{
_scintilla = null;
}
}
}
[Browsable(false)]
public Scintilla Scintilla
{
get
{
return _scintilla;
}
set
{
_scintilla = value;
}
}
public bool ToolItem
{
get { return _toolItem; }
set
{
_toolItem = value;
if (_toolItem)
BackColor = Color.Transparent;
else
BackColor = Color.LightSteelBlue;
}
}
#endregion Properties
#region Event Handlers
private void brnPrevious_Click(object sender, EventArgs e)
{
findPrevious();
}
private void btnClearHighlights_Click(object sender, EventArgs e)
{
if (_scintilla == null)
return;
_findReplace.ClearAllHighlights();
}
private void btnHighlightAll_Click(object sender, EventArgs e)
{
if (txtFind.Text == string.Empty)
return;
if (_scintilla == null)
return;
int foundCount = _findReplace.FindAll(txtFind.Text, false, true).Count;
}
private void btnNext_Click(object sender, EventArgs e)
{
findNext();
}
#endregion Event Handlers
#region Methods
public virtual void MoveFormAwayFromSelection()
{
if (!Visible || _scintilla == null)
return;
if (!AutoPosition)
return;
int pos = _scintilla.CurrentPosition;
int x = _scintilla.PointXFromPosition(pos);
int y = _scintilla.PointYFromPosition(pos);
Point cursorPoint = new Point(x, y);
Rectangle r = new Rectangle(Location, Size);
if (_scintilla != null)
{
r.Location = new Point(_scintilla.ClientRectangle.Right - Size.Width, 0);
}
if (r.Contains(cursorPoint))
{
Point newLocation;
if (cursorPoint.Y < (Screen.PrimaryScreen.Bounds.Height / 2))
{
//TODO - replace lineheight with ScintillaNET command, when added
int SCI_TEXTHEIGHT = 2279;
int lineHeight = _scintilla.DirectMessage(SCI_TEXTHEIGHT, IntPtr.Zero, IntPtr.Zero).ToInt32();
// Top half of the screen
newLocation = new Point(r.X, cursorPoint.Y + lineHeight * 2);
}
else
{
//TODO - replace lineheight with ScintillaNET command, when added
int SCI_TEXTHEIGHT = 2279;
int lineHeight = _scintilla.DirectMessage(SCI_TEXTHEIGHT, IntPtr.Zero, IntPtr.Zero).ToInt32();
// Bottom half of the screen
newLocation = new Point(r.X, cursorPoint.Y - Height - (lineHeight * 2));
}
Location = newLocation;
}
else
{
Location = r.Location;
}
}
protected override void OnCreateControl()
{
base.OnCreateControl();
MoveFormAwayFromSelection();
txtFind.Focus();
}
protected override void OnLeave(EventArgs e)
{
base.OnLostFocus(e);
if (!_toolItem)
Hide();
}
protected override void OnVisibleChanged(EventArgs e)
{
base.OnVisibleChanged(e);
txtFind.Text = string.Empty;
txtFind.BackColor = SystemColors.Window;
MoveFormAwayFromSelection();
if (Visible)
txtFind.Focus();
else if (_scintilla != null)
_scintilla.Focus();
}
private void findNext()
{
if (txtFind.Text == string.Empty)
return;
if (_scintilla == null)
return;
ScintillaNET_FindReplaceDialog.CharacterRange r = _findReplace.FindNext(txtFind.Text, true, _findReplace.Window.GetSearchFlags());
if (r.CpMin != r.CpMax)
{
_scintilla.GotoPosition(r.CpMin);
_scintilla.SetSel(r.CpMin, r.CpMax);
}
MoveFormAwayFromSelection();
}
private void findPrevious()
{
if (txtFind.Text == string.Empty)
return;
if (_scintilla == null)
return;
ScintillaNET_FindReplaceDialog.CharacterRange r = _findReplace.FindPrevious(txtFind.Text, true, _findReplace.Window.GetSearchFlags());
if (r.CpMin != r.CpMax)
{
_scintilla.GotoPosition(r.CpMin);
_scintilla.SetSel(r.CpMin, r.CpMax);
}
MoveFormAwayFromSelection();
}
private void txtFind_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Enter:
case Keys.Down:
findNext();
e.Handled = true;
break;
case Keys.Up:
findPrevious();
e.Handled = true;
break;
case Keys.Escape:
if (!_toolItem)
Hide();
break;
}
}
private void txtFind_TextChanged(object sender, EventArgs e)
{
txtFind.BackColor = SystemColors.Window;
if (txtFind.Text == string.Empty)
return;
if (_scintilla == null)
return;
int pos = Math.Min(_scintilla.CurrentPosition, _scintilla.AnchorPosition);
ScintillaNET_FindReplaceDialog.CharacterRange r = _findReplace.Find(pos, _scintilla.TextLength, txtFind.Text, _findReplace.Window.GetSearchFlags());
if (r.CpMin == r.CpMax)
r = _findReplace.Find(0, pos, txtFind.Text, _findReplace.Window.GetSearchFlags());
if (r.CpMin != r.CpMax)
{
_scintilla.GotoPosition(r.CpMin);
_scintilla.SetSel(r.CpMin, r.CpMax);
}
else
txtFind.BackColor = Color.Tomato;
MoveFormAwayFromSelection();
}
#endregion Methods
}
}
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
@@ -0,0 +1,40 @@
#region Using Directives
using ScintillaNET;
using ScintillaNET_FindReplaceDialog;
using System;
using System.Windows.Forms;
#endregion Using Directives
namespace ScintillaNET_FindReplaceDialog
{
public class ToolStripIncrementalSearcher : ToolStripControlHost
{
#region Properties
public Scintilla Scintilla
{
get { return Searcher.Scintilla; }
set { Searcher.Scintilla = value; }
}
public IncrementalSearcher Searcher
{
get { return Control as IncrementalSearcher; }
}
#endregion Properties
#region Constructors
public ToolStripIncrementalSearcher() : base(new IncrementalSearcher(true))
{
}
#endregion Constructors
}
}
@@ -0,0 +1,120 @@
#region Using Directives
using ryCommon;
using ScintillaNET;
using System;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
#endregion Using Directives
namespace ScintillaNET_FindReplaceDialog
{
public class GoTo
{
private Scintilla _scintilla=null;
private GoToDialog _window;
#region Methods
public void Line(int number)
{
if (_scintilla == null) { return; }
_scintilla.Lines[number].Goto();
}
public void Position(int pos)
{
if (_scintilla == null) { return; }
_scintilla.GotoPosition(pos);
}
public void ShowGoToDialog()
{
if (_scintilla == null) { return; }
//GoToDialog gd = new GoToDialog();
GoToDialog gd = _window;
gd.CurrentLineNumber = _scintilla.CurrentLine;
gd.MaximumLineNumber = _scintilla.Lines.Count;
gd.Scintilla = _scintilla;
if (!_window.Visible)
{
var form = _scintilla.FindForm();
if (form != null)
{
if (form is DockContent dc)
{
var parent = dc.DockPanel.FindForm();
_window.StartPosition = FormStartPosition.Manual;
_window.Location = new System.Drawing.Point(parent.Left+(parent.Width - _window.Width) / 2, parent.Top+(parent.Height - _window.Height) / 2);
_window.Show(parent);
}
else
{
_window.Show(form);
}
}
else
{
_window.StartPosition = FormStartPosition.CenterScreen;
_window.Show();
}
}
//_window.ShowDialog(_scintilla.FindForm());
//_window.Show(_scintilla.FindForm());
//if (gd.ShowDialog() == DialogResult.OK)
//Line(gd.GotoLineNumber);
//gd.ShowDialog();
//gd.Show();
_scintilla.Focus();
}
#endregion Methods
#region Constructors
protected virtual GoToDialog CreateWindowInstance()
{
return new GoToDialog();
}
public GoTo(Scintilla scintilla)
{
_scintilla = scintilla;
_window = CreateWindowInstance();
_window.Scintilla = scintilla;
}
public GoTo()
{
_scintilla = null;
_window = CreateWindowInstance();
_window.Scintilla = null;
}
public Scintilla Scintilla
{
get { return _scintilla; }
set {
_scintilla = value;
_window.Scintilla = value;
if (value != null)
{
GoToDialog gd = _window;
gd.CurrentLineNumber = _scintilla.CurrentLine;
gd.MaximumLineNumber = _scintilla.Lines.Count;
gd.Scintilla = _scintilla;
gd.UpdateUI();
}
}
}
#endregion Constructors
}
}
@@ -0,0 +1,163 @@
namespace ScintillaNET_FindReplaceDialog
{
partial class GoToDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.lblCurrentLine = new System.Windows.Forms.Label();
this.txtCurrentLine = new System.Windows.Forms.TextBox();
this.err = new System.Windows.Forms.ErrorProvider(this.components);
this.txtMaxLine = new System.Windows.Forms.TextBox();
this.lblMaxLine = new System.Windows.Forms.Label();
this.txtGotoLine = new System.Windows.Forms.TextBox();
this.lblGotoLine = new System.Windows.Forms.Label();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.err)).BeginInit();
this.SuspendLayout();
//
// lblCurrentLine
//
this.lblCurrentLine.AutoSize = true;
this.lblCurrentLine.Location = new System.Drawing.Point(9, 13);
this.lblCurrentLine.Name = "lblCurrentLine";
this.lblCurrentLine.Size = new System.Drawing.Size(55, 13);
this.lblCurrentLine.TabIndex = 0;
this.lblCurrentLine.Text = "当前行号";
//
// txtCurrentLine
//
this.txtCurrentLine.Location = new System.Drawing.Point(132, 8);
this.txtCurrentLine.Name = "txtCurrentLine";
this.txtCurrentLine.ReadOnly = true;
this.txtCurrentLine.Size = new System.Drawing.Size(63, 21);
this.txtCurrentLine.TabIndex = 1;
//
// err
//
this.err.ContainerControl = this;
//
// txtMaxLine
//
this.txtMaxLine.Location = new System.Drawing.Point(132, 33);
this.txtMaxLine.Name = "txtMaxLine";
this.txtMaxLine.ReadOnly = true;
this.txtMaxLine.Size = new System.Drawing.Size(63, 21);
this.txtMaxLine.TabIndex = 3;
//
// lblMaxLine
//
this.lblMaxLine.AutoSize = true;
this.lblMaxLine.Location = new System.Drawing.Point(9, 37);
this.lblMaxLine.Name = "lblMaxLine";
this.lblMaxLine.Size = new System.Drawing.Size(55, 13);
this.lblMaxLine.TabIndex = 2;
this.lblMaxLine.Text = "最大行号";
//
// txtGotoLine
//
this.txtGotoLine.Location = new System.Drawing.Point(132, 58);
this.txtGotoLine.Name = "txtGotoLine";
this.txtGotoLine.Size = new System.Drawing.Size(63, 21);
this.txtGotoLine.TabIndex = 5;
//
// lblGotoLine
//
this.lblGotoLine.AutoSize = true;
this.lblGotoLine.Location = new System.Drawing.Point(9, 61);
this.lblGotoLine.Name = "lblGotoLine";
this.lblGotoLine.Size = new System.Drawing.Size(55, 13);
this.lblGotoLine.TabIndex = 4;
this.lblGotoLine.Text = "目标行号";
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(39, 85);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 6;
this.btnOK.Text = "确定";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.BtnOK_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(120, 85);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 7;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.BtnCancel_Click);
//
// GoToDialog
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(210, 113);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.txtGotoLine);
this.Controls.Add(this.lblGotoLine);
this.Controls.Add(this.txtMaxLine);
this.Controls.Add(this.lblMaxLine);
this.Controls.Add(this.txtCurrentLine);
this.Controls.Add(this.lblCurrentLine);
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "GoToDialog";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "行定位";
this.Activated += new System.EventHandler(this.GoToDialog_Activated);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GoToDialog_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.err)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblCurrentLine;
private System.Windows.Forms.TextBox txtCurrentLine;
private System.Windows.Forms.ErrorProvider err;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.TextBox txtGotoLine;
private System.Windows.Forms.Label lblGotoLine;
private System.Windows.Forms.TextBox txtMaxLine;
private System.Windows.Forms.Label lblMaxLine;
}
}
@@ -0,0 +1,174 @@
#region Using Directives
using ScintillaNET;
using System;
using System.Drawing;
using System.Windows.Forms;
#endregion Using Directives
namespace ScintillaNET_FindReplaceDialog
{
public partial class GoToDialog : Form
{
#region Fields
private Scintilla _scintilla;
private int _currentLineNumber;
private int _maximumLineNumber;
private int _gotoLineNumber;
#endregion Fields
#region Methods
private void BtnOK_Click(object sender, EventArgs e)
{
if (int.TryParse(txtGotoLine.Text, out _gotoLineNumber))
{
// Line #s are 0 based but the users don't think that way
_gotoLineNumber--;
if (_gotoLineNumber < 0 || _gotoLineNumber >= _maximumLineNumber)
err.SetError(txtGotoLine, "转到行必须大于0且小于 " + (_maximumLineNumber + 1).ToString());
else
{
_scintilla.Lines[_gotoLineNumber].Goto();
//Line(GotoLineNumber);
this.Hide();
//DialogResult = DialogResult.OK;
}
}
else
{
err.SetError(txtGotoLine, "转到行必须是数值");
}
}
// This was taken from FindReplaceDialog. Obviously some refactoring is called for
// since we have common code. However I'm holding off on this because I'm coming
// up with some other ideas for the FindReplaceDialog. Right now every scintilla
// gets its own FindReplaceDialog, but they really need to be sharable across
// multiple scintillas much like how DropMarkers work.
private void MoveFormAwayFromSelection()
{
if (!Visible)
return;
int pos = Scintilla.CurrentPosition;
int x = Scintilla.PointXFromPosition(pos);
int y = Scintilla.PointYFromPosition(pos);
Point cursorPoint = Scintilla.PointToScreen(new Point(x, y));
Rectangle r = new Rectangle(Location, Size);
if (r.Contains(cursorPoint))
{
Point newLocation;
if (cursorPoint.Y < (Screen.PrimaryScreen.Bounds.Height / 2))
{
//TODO - replace lineheight with ScintillaNET command, when added
int SCI_TEXTHEIGHT = 2279;
int lineHeight = Scintilla.DirectMessage(SCI_TEXTHEIGHT, IntPtr.Zero, IntPtr.Zero).ToInt32();
// Top half of the screen
newLocation = Scintilla.PointToClient(
new Point(Location.X, cursorPoint.Y + lineHeight * 2)
);
}
else
{
//TODO - replace lineheight with ScintillaNET command, when added
int SCI_TEXTHEIGHT = 2279;
int lineHeight = Scintilla.DirectMessage(SCI_TEXTHEIGHT, IntPtr.Zero, IntPtr.Zero).ToInt32();
// Bottom half of the screen
newLocation = Scintilla.PointToClient(
new Point(Location.X, cursorPoint.Y - Height - (lineHeight * 2))
);
}
newLocation = Scintilla.PointToScreen(newLocation);
Location = newLocation;
}
}
protected override void OnActivated(EventArgs e)
{
base.OnActivated(e);
MoveFormAwayFromSelection();
}
#endregion Methods
#region Properties
public int CurrentLineNumber
{
get { return _currentLineNumber; }
set
{
_currentLineNumber = value;
}
}
public int GotoLineNumber
{
get { return _gotoLineNumber; }
set
{
_gotoLineNumber = value;
}
}
public int MaximumLineNumber
{
get { return _maximumLineNumber; }
set
{
_maximumLineNumber = value;
}
}
public Scintilla Scintilla
{
get { return _scintilla; }
set { _scintilla = value; }
}
#endregion Properties
#region Constructors
public GoToDialog()
{
InitializeComponent();
}
#endregion Constructors
private void GoToDialog_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
Hide();
}
}
private void GoToDialog_Activated(object sender, EventArgs e)
{
UpdateUI();
}
public void UpdateUI()
{
string displayLine = (_currentLineNumber + 1).ToString();
txtCurrentLine.Text = displayLine;
txtMaxLine.Text = _maximumLineNumber.ToString();
txtGotoLine.Text = displayLine;
txtGotoLine.Select();
}
private void BtnCancel_Click(object sender, EventArgs e)
{
Hide();
}
}
}
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="err.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
@@ -0,0 +1,800 @@
using ScintillaNET;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static ScintillaNET.Style;
using VPKSoft.ScintillaLexers;
using ScintillaNET_FindReplaceDialog.FindAllResults;
using ScintillaNET_FindReplaceDialog;
using System.Windows.Forms;
using ryCommon;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
using Newtonsoft.Json.Linq;
using DiffPlex.Model;
using IfacesEnumsStructsClasses;
namespace ryControls
{
public partial class HighlightEditor : Control
{
public HighlightEditor() : base()
{
if(!this.DesignMode)
{
this.Controls.Add(Editor);
Editor.Parent = this;
Editor.Dock= DockStyle.Fill;
}
Editor.CaretLineBackColor = Color.FromArgb(255, 255, 192);
Editor.AutoCAutoHide = true;
Editor.TextChanged += Scintilla_TextChanged;
Editor.ContextMenuStrip = contextMenuStripHighlightText21;
Editor.CharAdded += HighlightEditor_CharAdded;
Editor.UpdateUI += HighlightEditor_UpdateUI;
Editor.EolMode = Eol.CrLf;
//Editor.AdditionalCaretForeColor=Color.Red;
//Editor
//base.HandleCreated += HighlightEditor_HandleCreated;
//base.InternalFocusFlag = true;
MyFindReplace = new FindReplace
{
Scintilla = Editor
};
AutoComplete.TargetControlWrapper = new ScintillaWrapper(Editor);
Editor.DoubleClick += Editor_DoubleClick;
var ind_17= Editor.Indicators[17];
ind_17.ForeColor = Color.FromArgb(232, 232, 255);
ind_17.Alpha = 100;
ind_17.Style = IndicatorStyle.RoundBox;
ind_17.Under = true;
_indicator = Editor.Indicators[16];
_indicator.ForeColor = Color.Red;
//_indicator.ForeColor = Color.LawnGreen; //Smart highlight
_indicator.Alpha = 100;
_indicator.Style = IndicatorStyle.RoundBox;
_indicator.Under = true;
Editor.IndicatorCurrent = _indicator.Index;
this.LostFocus += HighlightEditor_LostFocus;
Editor.LostFocus += HighlightEditor_LostFocus;
Editor.InternalFocusFlag = true;
Editor.CaretLineBackColorAlpha = 60;
Editor.CaretPeriod = 0;
}
private void HighlightEditor_LostFocus(object sender, EventArgs e)
{
//Editor.AdditionalCaretForeColor
}
#region 属性设置
/// <summary>
/// 读取或设置只读模式
/// </summary>
[Description("是否开启只读模式")]
public bool ReadOnly
{
get { return Editor.ReadOnly; }
set { Editor.ReadOnly = value; }
}
[DefaultValue(ScintillaNET.BorderStyle.Fixed3D)]
[Category("Appearance")]
[Description("编辑器边框.")]
public ScintillaNET.BorderStyle BorderStyle
{
get { return Editor.BorderStyle; }
set { Editor.BorderStyle = value; }
}
/// <summary>
/// 是否开启行号
/// </summary>
[Description("是否开启行号")]
public bool LineNumberOn { get; set; } = true;
/// <summary>
/// 是否使用自定义搜索功能
/// </summary>
[Description("是否使用自定义搜索功能")]
public bool UseCustomShowFindReplace { get; set; } = false;
/// <summary>
/// 是否使用自定义定位行功能
/// </summary>
[Description("是否使用自定义定位行功能")]
public bool UseCustomGotoLine { get; set; } = false;
/// <summary>
/// 当前高亮语言
/// </summary>
public LexerType CurHighliteLang
{
get; set;
} = LexerType.Text;
/// <summary>
/// 获取或设置是否开启自动标记功能
/// </summary>
[Description("开启自动标记功能")]
public bool AutoMark { get; set; } = true;
/// <summary>
/// 获取或设置编辑器字体
/// </summary>
[EditorBrowsable(EditorBrowsableState.Always)]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[DefaultValue(typeof(Font), "Consolas, 14pt")]
public override Font Font
{
get => base.Font;
set
{
base.Font = value;
Editor.Font = value;
for (int i = 0; i < Editor.Styles.Count; i++)
{
if (i != CallTip) SetStyleFont(i, value);
}
}
}
/// <summary>
/// Sets font style properties
/// </summary>
/// <param name="index"></param>
/// <param name="font"></param>
private void SetStyleFont(int index, Font font)
{
Editor.Styles[index].Font = font.Name;
Editor.Styles[index].SizeF = font.SizeInPoints;
Editor.Styles[index].Bold = font.Bold;
Editor.Styles[index].Italic = font.Italic;
Editor.Styles[index].Underline = font.Underline;
}
/// <summary>
/// 获取或设置当前选中的文字
/// </summary>
public string SelectedText
{
get {
var text= Editor.SelectedText.TrimEnd('\0');
if (text == "\0") { text = ""; }
return text;
}
set { Editor.ReplaceSelection(value); }
}
/// <summary>
/// 设置或获取文本
/// </summary>
public override string Text
{
get { return Editor.Text; }
set
{
bool Readonly = Editor.ReadOnly;
if (Readonly)
{
Editor.ReadOnly = false;
}
Editor.Text = value;
if (Readonly)
{
Editor.ReadOnly = true;
}
}
}
#endregion
#region 对外公开的事件
/// <summary>
/// 在自带菜单弹出前激发
/// </summary>
[Description("在自带菜单弹出前激发")]
public event CancelEventHandler OnMenuOpening;
/// <summary>
/// 保存热键发生时
/// </summary>
[Description("保存热键发生时")]
public event EventHandler OnSaveKeyHappen;
/// <summary>
/// 打开自定义查找窗口时发生
/// </summary>
[Description("打开自定义查找窗口时发生")]
public event EventHandler OnCustomShowFind;
/// <summary>
/// 打开自定义替换窗口时发生
/// </summary>
[Description("打开自定义替换窗口时发生")]
public event EventHandler OnCustomShowReplace;
/// <summary>
/// 打开自定义定位行窗口时发生
/// </summary>
[Description("打开自定义定位行窗口时发生")]
public event EventHandler OnCustomShowGotoLine;
/// <summary>
/// 选定内容发生变化
/// </summary>
[Description("选定内容发生变化")]
public event EventHandler OnSelectedChanged;
#endregion
#region 内部事件方法
private void Editor_DoubleClick(object sender, DoubleClickEventArgs e)
{
base.OnDoubleClick(new EventArgs());
}
private void ContextMenuStripRichText1_Opening(object sender, CancelEventArgs e)
{
OnMenuOpening?.Invoke(sender, e);
}
private string Indent(int len)
{
var str = "";
for (int i = 0; i < len; i++)
{
str += " ";
}
return str;
}
private string last_selected = "";
private void HighlightEditor_UpdateUI(object sender,UpdateUIEventArgs e)
{
if (e.Change != UpdateChange.Content)
{
var selected_text = SelectedText;
var sel_start = Editor.SelectionStart;
var sel_id= sel_start + "|" + selected_text.Length;
if (sel_id != last_selected)
{
ClearAllMark();
last_selected = sel_id;
if (AutoMark)
{
MarkText(selected_text);
}
OnSelectedChanged?.Invoke(this, EventArgs.Empty);
}
if (selected_text.Length == 0)
{
var a = Editor.BraceMatch(sel_start);
if (a >= 0)
{
Editor.IndicatorCurrent = _indicator.Index;
Editor.IndicatorFillRange(a, 1);
Editor.IndicatorFillRange(sel_start, 1);
}
else
{
if (sel_start - 1 >= 0)
{
a = Editor.BraceMatch(sel_start - 1);
if (a >= 0)
{
Editor.IndicatorCurrent = _indicator.Index;
Editor.IndicatorFillRange(a, 1);
Editor.IndicatorFillRange(sel_start - 1, 1);
}
}
}
}
var pos = Editor.CurrentPosition;
var line = Editor.LineFromPosition(pos);
Editor.IndicatorCurrent = 17;
Editor.IndicatorFillRange(Editor.Lines[line].Position, Editor.Lines[line].Length);
}
if (LastProcessedChar != 0)
{
var pos = Editor.CurrentPosition;
var line = Editor.LineFromPosition(pos);
if (line >= 1)
{
if (LastProcessedChar == 10)
{
//Editor.Lines[line].Indentation = Editor.Lines[line - 1].Indentation;
var nPrevLineText = Editor.Lines[line - 1].Text.Trim();//获取上一行文本
if (nPrevLineText.Length >= 1)
{
if ("{(<[".IndexOfEx(nPrevLineText.Substring(nPrevLineText.Length - 1, 1)) >= 0)
{
if (Editor.Lines[line].Text.Trim().StartsWith("}")) {
Editor.ReplaceSelection(Indent(Editor.Lines[line - 1].Indentation));
}
else {
Editor.ReplaceSelection(Indent(Editor.Lines[line - 1].Indentation + 4));
}
}
else
{
Editor.ReplaceSelection(Indent(Editor.Lines[line - 1].Indentation));
}
}
else
{
for (int i = line - 2; i >0; i--)
{
nPrevLineText = Editor.Lines[i].Text.Trim();
if (nPrevLineText.Length >= 1)
{
if ("{(<[".IndexOfEx(nPrevLineText.Substring(nPrevLineText.Length - 1, 1)) >= 0)
{
if (Editor.Lines[line].Text.Trim().StartsWith("}"))
{
Editor.ReplaceSelection(Indent(Editor.Lines[i].Indentation));
}
else
{
Editor.ReplaceSelection(Indent(Editor.Lines[i].Indentation + 4));
}
}
else
{
Editor.ReplaceSelection(Indent(Editor.Lines[i].Indentation));
}
break;
}
}
}
}
}
LastProcessedChar = 0;
// if(LastProcessedChar=='}' && this.GetCharAt(pos-2)==' ' && LastProcessedChar!=0)
//{
// var startpos = this.WordStartPosition(pos - 1, false);
// var linepos = this.Lines[line].Indentation;
// if(startpos== linepos)
// {
// var othpos = this.BraceMatch(pos - 1);
// var othline = this.LineFromPosition(othpos);
// int nIndent = this.Lines[othline].Indentation;
// this.TargetStart = startpos;
// this.TargetEnd = pos - 1;
// this.ReplaceTarget("xxxxxxx");
// }
//}
}
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.S))
{
OnSaveKeyHappen?.Invoke(this, new EventArgs());
return true;
}
else if (keyData == (Keys.Control | Keys.F))
{
ShowFind();
return true;
}
else if (keyData == (Keys.Control | Keys.B))
{
return true;
}
else if (keyData == (Keys.Control | Keys.M))
{
return true;
}
else if (keyData == (Keys.Control | Keys.N))
{
return true;
}
else if (keyData == (Keys.Control | Keys.J))
{
return true;
}
else if (keyData == (Keys.Control | Keys.Q))
{
return true;
}
else if (keyData == (Keys.Control | Keys.U))
{
return true;
}
else if (keyData == (Keys.Control | Keys.I))
{
return true;
}
else if (keyData == (Keys.Control | Keys.P))
{
return true;
}
else if (keyData == (Keys.Control | Keys.W))
{
return true;
}
else if (keyData == (Keys.Control | Keys.E))
{
return true;
}
return base.ProcessCmdKey(ref msg, keyData);//这里就是返回没有重写的键位,也就是这个函数原本的处理方式 //其余键位默认处理
}
private void HighlightEditor_CharAdded(object sender, CharAddedEventArgs e)
{
LastProcessedChar = e.Char;
}
private void Scintilla_TextChanged(object sender, EventArgs e)
{
base.OnTextChanged(new EventArgs());
if (LineNumberOn)
{
Scintilla scintilla = (Scintilla)sender;
int maxLineNumberCharLengthFromTag = mark;
// Did the number of characters in the line number display change?
// i.e. nnn VS nn, or nnnn VS nn, etc...
var maxLineNumberCharLength = scintilla.Lines.Count.ToString().Length;
if (maxLineNumberCharLength == maxLineNumberCharLengthFromTag)
return;
// Calculate the width required to display the last line number
// and include some padding for good measure.
const int padding = 2;
scintilla.Margins[0].Width = scintilla.TextWidth(ScintillaNET.Style.LineNumber, new string('9', maxLineNumberCharLength + 1)) + padding;
mark = maxLineNumberCharLength;
}
}
/// <summary>
/// 判断改行为函数开头行
/// </summary>
/// <param name="line"></param>
/// <returns></returns>
private bool IsFunLine(string line)
{
if (line.StartsWith("public", StringComparison.OrdinalIgnoreCase) ||
line.StartsWith("private", StringComparison.OrdinalIgnoreCase) ||
line.StartsWith("protected", StringComparison.OrdinalIgnoreCase) ||
line.StartsWith("const", StringComparison.OrdinalIgnoreCase))
{
return true;
}
else
{
if (line.IndexOfEx("(") > 0 && line.IndexOfEx(")") > 0 && line.IndexOfEx("function")>=0)
{
return true;
}
}
return false;
}
#endregion
#region 对方公开方法或函数
public void FindText(string FindText)
{
Editor.TargetStart = 0;
Editor.TargetEnd = Editor.TextLength;
var pos = Editor.SearchInTarget(FindText);
if (pos >= 0)
{
Editor.FirstVisibleLine = Editor.LineFromPosition(pos);
}
}
/// <summary>
/// 获取最近的函数名称所在行内容
/// </summary>
/// <param name="high_editor"></param>
/// <param name="fun_line_num"></param>
/// <returns></returns>
public string GetNearestFunLineStr(HighlightEditor high_editor,out int fun_line_num)
{
var line_num = high_editor.Editor.LineFromPosition(high_editor.Editor.CurrentPosition == 0 ? high_editor.Editor.FirstVisibleLine : high_editor.Editor.CurrentPosition);
var lines = high_editor.Editor.Lines;
var pre_fun_line = "";
var pre_fun_line_num = -1;
var next_fun_line = "";
var next_fun_line_num = -1;
string fun_line;
for (int i = line_num; i >= 0; i--)
{
var line = lines[i].Text.Trim();
if (IsFunLine(line))
{
pre_fun_line = line;
pre_fun_line_num = i;
break;
}
}
if (pre_fun_line_num == -1 || (line_num - pre_fun_line_num) > 3)
{
for (int i = line_num + 1; i < lines.Count; i++)
{
var line = lines[i].Text.Trim();
if (IsFunLine(line))
{
next_fun_line = line;
next_fun_line_num = i;
break;
}
}
}
if (next_fun_line_num == -1)
{
fun_line = pre_fun_line;
fun_line_num = pre_fun_line_num;
}
else if (pre_fun_line_num == -1)
{
fun_line = next_fun_line;
fun_line_num = next_fun_line_num;
}
else if ((line_num - pre_fun_line_num) > (next_fun_line_num - line_num))
{
fun_line = next_fun_line;
fun_line_num = next_fun_line_num;
}
else
{
fun_line = pre_fun_line;
fun_line_num = pre_fun_line_num;
}
return fun_line;
}
/// <summary>
/// 到达与指定编辑器同样的位置
/// </summary>
/// <param name="high_editor"></param>
public int GotoSameLocation(HighlightEditor high_editor)
{
if (high_editor.Editor.CurrentPosition == 0 && high_editor.Editor.FirstVisibleLine==0) { return 0; }
var result = 0;
var line_num=high_editor.Editor.LineFromPosition(high_editor.Editor.CurrentPosition==0? high_editor.Editor.FirstVisibleLine: high_editor.Editor.CurrentPosition);
var lines = high_editor.Editor.Lines;
string fun_line= GetNearestFunLineStr(high_editor,out var fun_line_num);
if (fun_line_num >= 0)
{
Editor.TargetStart = 0;
Editor.TargetEnd = Editor.TextLength;
var pos= Editor.SearchInTarget(fun_line);
if(pos>=0)
{
Editor.FirstVisibleLine = Editor.LineFromPosition(pos);
result = Editor.FirstVisibleLine;
}
else
{
var str = fun_line.GetStr("", "(");
if(str.Length>0)
{
pos = Editor.SearchInTarget(str);
if (pos >= 0)
{
Editor.FirstVisibleLine = Editor.LineFromPosition(pos);
result = Editor.FirstVisibleLine;
}
}
}
}
return result;
//var kk = Editor.Lines.FirstOrDefault(f => f.Text == high_editor.Editor.Lines[line_num].Text);
}
/// <summary>
/// 标记文本
/// </summary>
/// <param name="search_text"></param>
public void MarkText(string search_text)
{
if (search_text.Length == 0)
{
ClearAllMark();
return;
}
if (search_text.IndexOfEx("\n") >= 0 || !search_text.Replace("_","").IsEngOrNum())
{
ClearAllMark();
if (search_text.Length == 1)
{
var a= Editor.BraceMatch(Editor.SelectionStart);
if (a >= 0)
{
Editor.IndicatorCurrent = _indicator.Index;
Editor.IndicatorFillRange(a, 1);
Editor.IndicatorFillRange(Editor.SelectionStart, 1);
}
return;
}
return;
}
var find_count = 0;
//Editor.IndicatorCurrent = _indicator.Index;
var _text = Editor.Text;
var search_len = search_text.Length;
var total_len = _text.Length;
var pos = _text.IndexOf(search_text);
while (pos != -1)
{
if (pos > 0 && pos < total_len - 1)
{
var word = _text.Substring(pos - 1, 1)[0];
if ((word >= 'a' && word <= 'z') || (word >= 'A' && word <= 'Z') || (word >= '0' && word <= '9') || word=='_')
{
//是数字字母不处理
pos = _text.IndexOf(search_text, pos + search_len);
continue;
}
if ((pos + search_len) <= total_len - 1)
{
word = _text.Substring(pos + search_len, 1)[0];
if ((word >= 'a' && word <= 'z') || (word >= 'A' && word <= 'Z') || (word >= '0' && word <= '9') || word == '_')
{
//是数字字母不处理
pos = _text.IndexOf(search_text, pos + search_len);
continue;
}
}
}
find_count++;
Editor.IndicatorCurrent = _indicator.Index;
Editor.IndicatorFillRange(pos, search_len);
pos = _text.IndexOf(search_text, pos + search_len);
}
if (find_count == 1)
{
ClearAllMark();
return;
}
}
/// <summary>
/// 清除所有标记
/// </summary>
public void ClearAllMark()
{
int currentIndicator = Editor.IndicatorCurrent;
Editor.IndicatorCurrent = 17;
Editor.IndicatorClearRange(0, Editor.TextLength);
Editor.IndicatorCurrent = _indicator.Index;
Editor.IndicatorClearRange(0, Editor.TextLength);
Editor.IndicatorCurrent = currentIndicator;
}
/// <summary>
/// 设置高亮文本
/// </summary>
/// <param name="format"></param>
public void SetHightlightText(string format)
{
SetHightlightText(this.Text, format);
}
/// <summary>
/// 设置高亮文本
/// </summary>
/// <param name="text"></param>
/// <param name="format"></param>
public void SetHightlightText(string text, string format)
{
bool Readonly = Editor.ReadOnly;
if (Readonly)
{
Editor.ReadOnly = false;
}
Editor.Text = text;
var _formart = format;
if (_formart == "c#") { _formart = "cs"; }
try
{
var LexerType = VPKSoft.ScintillaLexers.HelperClasses.LexerFileExtensions.LexerTypeFromFileName(@"1." + _formart);
CurHighliteLang = LexerType;
ScintillaLexers.CreateLexer(Editor, LexerType);
}
catch { CurHighliteLang = LexerType.Unknown; }
if (Readonly)
{
Editor.ReadOnly = true;
}
Editor.Font = this.Font;
for (int i = 0; i < Editor.Styles.Count; i++)
{
if (i != CallTip) SetStyleFont(i, this.Font);
}
}
/// <summary>
/// 设置文本
/// </summary>
/// <param name="text"></param>
/// <param name="format"></param>
public void SetText(string text)
{
bool Readonly = Editor.ReadOnly;
if (Readonly)
{
Editor.ReadOnly = false;
}
Editor.Text = text;
if (Readonly)
{
Editor.ReadOnly = true;
}
}
/// <summary>
/// 显示查找对话框
/// </summary>
public void ShowFind()
{
if (UseCustomShowFindReplace)
{
OnCustomShowFind?.Invoke(this, new EventArgs());
}
else
{
MyFindReplace.ShowFind();
}
}
/// <summary>
/// 显示替换对话框
/// </summary>
public void ShowReplace()
{
if (UseCustomShowFindReplace)
{
OnCustomShowReplace?.Invoke(this, new EventArgs());
}
else
{
MyFindReplace.ShowFind(1);
}
}
/// <summary>
/// 显示行定位对话框
/// </summary>
public void ShowGotoLine()
{
if (UseCustomGotoLine)
{
OnCustomShowGotoLine?.Invoke(this, new EventArgs());
}
else
{
GoTo MyGoTo = new GoTo(Editor);
MyGoTo.ShowGoToDialog();
}
}
/// <summary>
/// 根据标签获得菜单项
/// </summary>
/// <param name="tag"></param>
/// <returns></returns>
public ToolStripItem GetMenuItem(string tag)
{
for (int i = 0; i < contextMenuStripHighlightText21.Items.Count; i++)
{
var item = contextMenuStripHighlightText21.Items[i];
if (item.Tag == null) { continue; }
if (tag == item.Tag.ToString())
{
return item;
}
}
return null;
}
/// <summary>
/// 设置自动完成列表
/// </summary>
/// <param name="list"></param>
public void SetAutoCompleteList(List<string> list)
{
AutoComplete.SetAutocompleteItems(list);
}
/// <summary>
/// 添加菜单分隔线
/// </summary>
/// <returns></returns>
public ToolStripSeparator AddSeparatorMenu()
{
return contextMenuStripHighlightText21.AddSeparatorMenu();
}
/// <summary>
/// 添加菜单
/// </summary>
/// <param name="name"></param>
/// <param name="tag"></param>
/// <returns></returns>
public ToolStripMenuItem AddMenu(string name, string tag)
{
return contextMenuStripHighlightText21.AddMenu(name, tag);
}
#endregion
#region 声明变量
int mark = -1;
private string lastSelectedText = "";
private int LastProcessedChar;
private Indicator _indicator;
public override ContextMenuStrip ContextMenuStrip { get => Editor.ContextMenuStrip; set => Editor.ContextMenuStrip = value; }
private readonly FindReplace MyFindReplace;
public ScintillaNET.Scintilla Editor { get; set; } = new Scintilla();
private readonly AutocompleteMenuNS.AutocompleteMenu AutoComplete = new AutocompleteMenuNS.AutocompleteMenu();
private readonly ryControls.ContextMenuStripHighlightText2 contextMenuStripHighlightText21 = new ContextMenuStripHighlightText2();
#endregion
}
}
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStripHighlightText21.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,93 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the Batch lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerBatch: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the batch script file.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateBatchLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors,bool foldOn)
{
ClearStyle(scintilla);
// DEFAULT, fontStyle = 0
scintilla.Styles[Style.Batch.Default].ForeColor = lexerColors[LexerType.Batch, "DefaultFore"];
scintilla.Styles[Style.Batch.Default].BackColor = lexerColors[LexerType.Batch, "DefaultBack"];
// COMMENT, fontStyle = 0
scintilla.Styles[Style.Batch.Comment].ForeColor = lexerColors[LexerType.Batch, "CommentFore"];
scintilla.Styles[Style.Batch.Comment].BackColor = lexerColors[LexerType.Batch, "CommentBack"];
// KEYWORDS, fontStyle = 1
scintilla.Styles[Style.Batch.Word].Bold = true;
scintilla.Styles[Style.Batch.Word].ForeColor = lexerColors[LexerType.Batch, "WordFore"];
scintilla.Styles[Style.Batch.Word].BackColor = lexerColors[LexerType.Batch, "WordBack"];
// LABEL, fontStyle = 1
scintilla.Styles[Style.Batch.Label].Bold = true;
scintilla.Styles[Style.Batch.Label].ForeColor = lexerColors[LexerType.Batch, "LabelFore"];
scintilla.Styles[Style.Batch.Label].BackColor = lexerColors[LexerType.Batch, "LabelBack"];
// HIDE SYBOL, fontStyle = 0
scintilla.Styles[Style.Batch.Hide].ForeColor = lexerColors[LexerType.Batch, "HideFore"];
scintilla.Styles[Style.Batch.Hide].BackColor = lexerColors[LexerType.Batch, "HideBack"];
// COMMAND, fontStyle = 0
scintilla.Styles[Style.Batch.Command].ForeColor = lexerColors[LexerType.Batch, "CommandFore"];
scintilla.Styles[Style.Batch.Command].BackColor = lexerColors[LexerType.Batch, "CommandBack"];
// VARIABLE, fontStyle = 1
scintilla.Styles[Style.Batch.Identifier].Bold = true;
scintilla.Styles[Style.Batch.Identifier].ForeColor = lexerColors[LexerType.Batch, "IdentifierFore"];
scintilla.Styles[Style.Batch.Identifier].BackColor = lexerColors[LexerType.Batch, "IdentifierBack"];
// OPERATOR, fontStyle = 1
scintilla.Styles[Style.Batch.Operator].Bold = true;
scintilla.Styles[Style.Batch.Operator].ForeColor = lexerColors[LexerType.Batch, "OperatorFore"];
scintilla.Styles[Style.Batch.Operator].BackColor = lexerColors[LexerType.Batch, "OperatorBack"];
scintilla.LexerName = "batch";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Batch);
if(foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,309 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System.Drawing;
using System.Linq;
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
using static VPKSoft.ScintillaLexers.GlobalScintillaFont;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A base class for creating static lexers.
/// </summary>
public class CreateLexerCommon
{
/// <summary>
/// Resets the Scintilla's style to default.
/// </summary>
/// <param name="scintilla">A Scintilla which style to reset.</param>
public static void ClearStyle(Scintilla scintilla)
{
scintilla.StyleResetDefault();
scintilla.Styles[Style.Default].Font = FontFamilyName;
scintilla.Styles[Style.Default].Size = FontSize;
scintilla.StyleClearAll();
}
/// <summary>
/// Adds a "standard" folding to a lexer.
/// </summary>
/// <param name="scintilla">An instance to a Scintilla class.</param>
public static void AddFolding(Scintilla scintilla)
{
// the default colors as in the example.. (C)::https://github.com/jacobslusser/ScintillaNET/wiki/Automatic-Code-Folding
AddFolding(scintilla, SystemColors.ControlLightLight, SystemColors.ControlDark);
}
/// <summary>
/// Adds a "standard" folding to a lexer with given foreground and background colors.
/// </summary>
/// <param name="scintilla">An instance to a Scintilla class.</param>
/// <param name="foregroundColor">The foreground color to be used.</param>
/// <param name="backgroundColor">The background color to be used.</param>
public static void AddFolding(Scintilla scintilla, Color foregroundColor, Color backgroundColor)
{
// the default colors as in the example.. (C)::https://github.com/jacobslusser/ScintillaNET/wiki/Automatic-Code-Folding
// Instruct the lexer to calculate folding..
LexerFoldProperties.FoldDefault(scintilla);
// Configure a margin to display folding symbols
scintilla.Margins[2].Type = MarginType.Symbol;
scintilla.Margins[2].Mask = Marker.MaskFolders;
scintilla.Margins[2].Sensitive = true;
scintilla.Margins[2].Width = 20;
// Set colors for all folding markers
for (int i = 25; i <= 31; i++)
{
scintilla.Markers[i].SetForeColor(foregroundColor);
scintilla.Markers[i].SetBackColor(backgroundColor);
}
// Configure folding markers with respective symbols
scintilla.Markers[Marker.Folder].Symbol = MarkerSymbol.BoxPlus;
scintilla.Markers[Marker.FolderOpen].Symbol = MarkerSymbol.BoxMinus;
scintilla.Markers[Marker.FolderEnd].Symbol = MarkerSymbol.BoxPlusConnected;
scintilla.Markers[Marker.FolderMidTail].Symbol = MarkerSymbol.TCorner;
scintilla.Markers[Marker.FolderOpenMid].Symbol = MarkerSymbol.BoxMinusConnected;
scintilla.Markers[Marker.FolderSub].Symbol = MarkerSymbol.VLine;
scintilla.Markers[Marker.FolderTail].Symbol = MarkerSymbol.LCorner;
// Enable automatic folding
scintilla.AutomaticFold = (AutomaticFold.Show | AutomaticFold.Click | AutomaticFold.Change);
}
/// <summary>
/// Sets the HTML styles for a lexer.
/// </summary>
/// <param name="scintilla">A <see cref="Scintilla"/> class instance.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
public static void SetHtmlStyles(Scintilla scintilla, LexerColors.LexerColors lexerColors)
{
// DEFAULT, fontStyle = 1, styleId = 0
scintilla.Styles[Style.Html.Default].Bold = true;
scintilla.Styles[Style.Html.Default].ForeColor = lexerColors[LexerType.HTML, "DefaultFore"];
scintilla.Styles[Style.Html.Default].BackColor = lexerColors[LexerType.HTML, "DefaultBack"];
// COMMENT, fontStyle = 0, styleId = 9
scintilla.Styles[Style.Html.Comment].ForeColor = lexerColors[LexerType.HTML, "CommentFore"];
scintilla.Styles[Style.Html.Comment].BackColor = lexerColors[LexerType.HTML, "CommentBack"];
// NUMBER, fontStyle = 0, styleId = 5
scintilla.Styles[Style.Html.Number].ForeColor = lexerColors[LexerType.HTML, "NumberFore"];
scintilla.Styles[Style.Html.Number].BackColor = lexerColors[LexerType.HTML, "NumberBack"];
// self added, seemed to be missing..
scintilla.Styles[Style.Html.Entity].Italic = true;
scintilla.Styles[Style.Html.Entity].ForeColor = lexerColors[LexerType.HTML, "EntityFore"];
scintilla.Styles[Style.Html.Entity].BackColor = lexerColors[LexerType.HTML, "EntityBack"];
// DOUBLESTRING, fontStyle = 1, styleId = 6
scintilla.Styles[Style.Html.DoubleString].Bold = true;
scintilla.Styles[Style.Html.DoubleString].ForeColor = lexerColors[LexerType.HTML, "DoubleStringFore"];
scintilla.Styles[Style.Html.DoubleString].BackColor = lexerColors[LexerType.HTML, "DoubleStringBack"];
// SINGLESTRING, fontStyle = 1, styleId = 7
scintilla.Styles[Style.Html.SingleString].Bold = true;
scintilla.Styles[Style.Html.SingleString].ForeColor = lexerColors[LexerType.HTML, "SingleStringFore"];
scintilla.Styles[Style.Html.SingleString].BackColor = lexerColors[LexerType.HTML, "SingleStringBack"];
// TAG, fontStyle = 0, styleId = 1
scintilla.Styles[Style.Html.Tag].ForeColor = lexerColors[LexerType.HTML, "TagFore"];
scintilla.Styles[Style.Html.Tag].BackColor = lexerColors[LexerType.HTML, "TagBack"];
// TAGEND, fontStyle = 0, styleId = 11
scintilla.Styles[Style.Html.TagEnd].ForeColor = lexerColors[LexerType.HTML, "TagEndFore"];
scintilla.Styles[Style.Html.TagEnd].BackColor = lexerColors[LexerType.HTML, "TagEndBack"];
// TAGUNKNOWN, fontStyle = 0, styleId = 2
scintilla.Styles[Style.Html.TagUnknown].ForeColor = lexerColors[LexerType.HTML, "TagUnknownFore"];
scintilla.Styles[Style.Html.TagUnknown].BackColor = lexerColors[LexerType.HTML, "TagUnknownBack"];
// ATTRIBUTE, fontStyle = 0, styleId = 3
scintilla.Styles[Style.Html.Attribute].ForeColor = lexerColors[LexerType.HTML, "AttributeFore"];
scintilla.Styles[Style.Html.Attribute].BackColor = lexerColors[LexerType.HTML, "AttributeBack"];
// ATTRIBUTEUNKNOWN, fontStyle = 0, styleId = 4
scintilla.Styles[Style.Html.AttributeUnknown].ForeColor = lexerColors[LexerType.HTML, "AttributeUnknownFore"];
scintilla.Styles[Style.Html.AttributeUnknown].BackColor = lexerColors[LexerType.HTML, "AttributeUnknownBack"];
// SGMLDEFAULT, fontStyle = 0, styleId = 21
scintilla.Styles[21].ForeColor = lexerColors[LexerType.HTML, "SGMDefaultFore"];
scintilla.Styles[21].BackColor = lexerColors[LexerType.HTML, "SGMDefaultBack"];
}
/// <summary>
/// Sets the PHP styles for a lexer.
/// </summary>
/// <param name="scintilla">A <see cref="Scintilla"/> class instance.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
public static void SetPhpStyles(Scintilla scintilla, LexerColors.LexerColors lexerColors)
{
// QUESTION MARK, fontStyle = 0, styleId = 18
scintilla.Styles[Style.Html.Question].ForeColor = lexerColors[LexerType.PHP, "HQuestionFore"];
scintilla.Styles[Style.Html.Question].BackColor = lexerColors[LexerType.PHP, "HQuestionBack"];
// DEFAULT, fontStyle = 0, styleId = 118
scintilla.Styles[Style.PhpScript.Default].ForeColor = lexerColors[LexerType.PHP, "DefaultFore"];
scintilla.Styles[Style.PhpScript.Default].BackColor = lexerColors[LexerType.PHP, "DefaultBack"];
// STRING, fontStyle = 0, styleId = 119
scintilla.Styles[Style.PhpScript.HString].ForeColor = lexerColors[LexerType.PHP, "HStringFore"];
scintilla.Styles[Style.PhpScript.HString].BackColor = lexerColors[LexerType.PHP, "HStringBack"];
// STRING VARIABLE, fontStyle = 1, styleId = 126
scintilla.Styles[Style.PhpScript.HStringVariable].Bold = true;
scintilla.Styles[Style.PhpScript.HStringVariable].ForeColor = lexerColors[LexerType.PHP, "HStringVariableFore"];
scintilla.Styles[Style.PhpScript.HStringVariable].BackColor = lexerColors[LexerType.PHP, "HStringVariableBack"];
// SIMPLESTRING, fontStyle = 0, styleId = 120
scintilla.Styles[Style.PhpScript.SimpleString].ForeColor = lexerColors[LexerType.PHP, "SimpleStringFore"];
scintilla.Styles[Style.PhpScript.SimpleString].BackColor = lexerColors[LexerType.PHP, "SimpleStringBack"];
// WORD, fontStyle = 1, styleId = 121
scintilla.Styles[Style.PhpScript.Word].Bold = true;
scintilla.Styles[Style.PhpScript.Word].ForeColor = lexerColors[LexerType.PHP, "WordFore"];
scintilla.Styles[Style.PhpScript.Word].BackColor = lexerColors[LexerType.PHP, "WordBack"];
// NUMBER, fontStyle = 0, styleId = 122
scintilla.Styles[Style.PhpScript.Number].ForeColor = lexerColors[LexerType.PHP, "NumberFore"];
scintilla.Styles[Style.PhpScript.Number].BackColor = lexerColors[LexerType.PHP, "NumberBack"];
// VARIABLE, fontStyle = 0, styleId = 123
scintilla.Styles[Style.PhpScript.Variable].ForeColor = lexerColors[LexerType.PHP, "VariableFore"];
scintilla.Styles[Style.PhpScript.Variable].BackColor = lexerColors[LexerType.PHP, "VariableBack"];
// COMMENT, fontStyle = 0, styleId = 124
scintilla.Styles[Style.PhpScript.Comment].ForeColor = lexerColors[LexerType.PHP, "CommentFore"];
scintilla.Styles[Style.PhpScript.Comment].BackColor = lexerColors[LexerType.PHP, "CommentBack"];
// COMMENTLINE, fontStyle = 0, styleId = 125
scintilla.Styles[Style.PhpScript.CommentLine].ForeColor = lexerColors[LexerType.PHP, "CommentLineFore"];
scintilla.Styles[Style.PhpScript.CommentLine].BackColor = lexerColors[LexerType.PHP, "CommentLineBack"];
// OPERATOR, fontStyle = 0, styleId = 127
scintilla.Styles[Style.PhpScript.Operator].ForeColor = lexerColors[LexerType.PHP, "OperatorFore"];
scintilla.Styles[Style.PhpScript.Operator].BackColor = lexerColors[LexerType.PHP, "OperatorBack"];
}
/// <summary>
/// Sets the JS styles for a lexer.
/// </summary>
/// <param name="scintilla">A <see cref="Scintilla"/> class instance.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
public static void SetJSStyles(Scintilla scintilla, LexerColors.LexerColors lexerColors)
{
//// DEFAULT, fontStyle = 0, styleId = 118
//scintilla.Styles[Style.JavaScript.Default].ForeColor = lexerColors[LexerType.PHP, "DefaultFore"];
//scintilla.Styles[Style.JavaScript.Default].BackColor = lexerColors[LexerType.PHP, "DefaultBack"];
//// WORD, fontStyle = 1, styleId = 121
//scintilla.Styles[Style.JavaScript.Word].Bold = true;
//scintilla.Styles[Style.JavaScript.Word].ForeColor = lexerColors[LexerType.PHP, "WordFore"];
//scintilla.Styles[Style.JavaScript.Word].BackColor = lexerColors[LexerType.PHP, "WordBack"];
// NUMBER, fontStyle = 0, styleId = 122
scintilla.Styles[Style.JavaScript.Number].Bold = true;
scintilla.Styles[Style.JavaScript.Number].ForeColor = lexerColors[LexerType.PHP, "NumberFore"];
scintilla.Styles[Style.JavaScript.Number].BackColor = lexerColors[LexerType.PHP, "NumberBack"];
// COMMENT, fontStyle = 0, styleId = 124
scintilla.Styles[Style.JavaScript.Comment].ForeColor = lexerColors[LexerType.PHP, "CommentFore"];
scintilla.Styles[Style.JavaScript.Comment].BackColor = lexerColors[LexerType.PHP, "CommentBack"];
// COMMENTLINE, fontStyle = 0, styleId = 125
scintilla.Styles[Style.JavaScript.CommentLine].ForeColor = lexerColors[LexerType.PHP, "CommentLineFore"];
scintilla.Styles[Style.JavaScript.CommentLine].BackColor = lexerColors[LexerType.PHP, "CommentLineBack"];
// OPERATOR, fontStyle = 0, styleId = 127
scintilla.Styles[Style.JavaScript.SingleString].ForeColor = lexerColors[LexerType.PHP, "SimpleStringFore"];
scintilla.Styles[Style.JavaScript.SingleString].BackColor = lexerColors[LexerType.PHP, "SimpleStringBack"];
// OPERATOR, fontStyle = 0, styleId = 127
scintilla.Styles[Style.JavaScript.Keyword].Bold = true;
scintilla.Styles[Style.JavaScript.Keyword].ForeColor =Color.Blue;
// OPERATOR, fontStyle = 0, styleId = 127
scintilla.Styles[Style.JavaScript.Regex].ForeColor = Color.Gray;
// OPERATOR, fontStyle = 0, styleId = 127
scintilla.Styles[Style.JavaScript.DoubleString].ForeColor = Color.FromArgb(172, 62, 145);
//scintilla.Styles[Style.JavaScript.Word].ForeColor = Color.Goldenrod;
// OPERATOR, fontStyle = 0, styleId = 127
// COMMENT DOC KEYWORD, fontStyle = 1, styleId = 17
}
/// <summary>
/// A helper method to be used with HTML including scripts.
/// </summary>
/// <param name="lexerType">Type of the lexer to embed into the HTML lexer.</param>
/// <param name="scintilla">An instance to a scintilla to which to append the script lexer.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
public static void SetScriptedHtml(LexerType lexerType, Scintilla scintilla, LexerColors.LexerColors lexerColors)
{
if (lexerType == LexerType.PHP || lexerType == LexerType.HTML)
{
SetHtmlStyles(scintilla, lexerColors);
if (lexerType == LexerType.PHP)
{
var keyWords1 =
ScintillaKeyWords.KeyWordList.FirstOrDefault(f => f.LexerType == LexerType.HTML);
var keyWords2 =
ScintillaKeyWords.KeyWordList.FirstOrDefault(f => f.LexerType == LexerType.PHP);
//var keyWords3 =
// ScintillaKeyWords.KeyWordList.FindAll(f => f.LexerType == LexerType.JavaScript);
//var text = "";
//for (int i = 0; i < keyWords3.Count; i++)
//{
// text += " "+keyWords3[i].KeyWords;
//}
if (keyWords1 != null && keyWords2 != null)
{
scintilla.SetKeywords(4, keyWords1.KeyWords+" "+ keyWords2.KeyWords);
}
ScintillaKeyWords.SetKeywords(scintilla, LexerType.JavaScript);
}
else if (lexerType == LexerType.HTML)
{
var keyWords =
ScintillaKeyWords.KeyWordList.FirstOrDefault(f => f.LexerType == LexerType.PHP);
if (keyWords != null)
{
scintilla.SetKeywords(4, keyWords.KeyWords);
}
}
LexerFoldProperties.SetScintillaProperties(scintilla, LexerFoldProperties.HyperTextFolding);
SetHtmlStyles(scintilla, lexerColors);
}
}
}
}
@@ -0,0 +1,143 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the C++ lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerCpp: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the C++ programming language.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateCppLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// PREPROCESSOR, fontStyle = 0
scintilla.Styles[Style.Cpp.Preprocessor].ForeColor = lexerColors[LexerType.Cpp, "PreprocessorFore"];
scintilla.Styles[Style.Cpp.Preprocessor].BackColor = lexerColors[LexerType.Cpp, "PreprocessorBack"];
// DEFAULT, fontStyle = 0
scintilla.Styles[Style.Cpp.Default].ForeColor = lexerColors[LexerType.Cpp, "DefaultFore"];
scintilla.Styles[Style.Cpp.Default].BackColor = lexerColors[LexerType.Cpp, "DefaultBack"];
// INSTRUCTION WORD, fontStyle = 1
scintilla.Styles[Style.Cpp.Word].Bold = true;
scintilla.Styles[Style.Cpp.Word].ForeColor = lexerColors[LexerType.Cpp, "WordFore"];
scintilla.Styles[Style.Cpp.Word].BackColor = lexerColors[LexerType.Cpp, "WordBack"];
// TYPE WORD, fontStyle = 0
scintilla.Styles[Style.Cpp.Word2].ForeColor = lexerColors[LexerType.Cpp, "Word2Fore"];
scintilla.Styles[Style.Cpp.Word2].BackColor = lexerColors[LexerType.Cpp, "Word2Back"];
// NUMBER, fontStyle = 0
scintilla.Styles[Style.Cpp.Number].ForeColor = lexerColors[LexerType.Cpp, "NumberFore"];
scintilla.Styles[Style.Cpp.Number].BackColor = lexerColors[LexerType.Cpp, "NumberBack"];
// STRING, fontStyle = 0
scintilla.Styles[Style.Cpp.String].ForeColor = lexerColors[LexerType.Cpp, "StringFore"];
scintilla.Styles[Style.Cpp.String].BackColor = lexerColors[LexerType.Cpp, "StringBack"];
// CHARACTER, fontStyle = 0
scintilla.Styles[Style.Cpp.Character].ForeColor = lexerColors[LexerType.Cpp, "CharacterFore"];
scintilla.Styles[Style.Cpp.Character].BackColor = lexerColors[LexerType.Cpp, "CharacterBack"];
// OPERATOR, fontStyle = 1
scintilla.Styles[Style.Cpp.Operator].Bold = true;
scintilla.Styles[Style.Cpp.Operator].ForeColor = lexerColors[LexerType.Cpp, "OperatorFore"];
scintilla.Styles[Style.Cpp.Operator].BackColor = lexerColors[LexerType.Cpp, "OperatorBack"];
// VERBATIM, fontStyle = 0
scintilla.Styles[Style.Cpp.Verbatim].ForeColor = lexerColors[LexerType.Cpp, "VerbatimFore"];
scintilla.Styles[Style.Cpp.Verbatim].BackColor = lexerColors[LexerType.Cpp, "VerbatimBack"];
// REGEX, fontStyle = 1
scintilla.Styles[Style.Cpp.Regex].Bold = true;
scintilla.Styles[Style.Cpp.Regex].ForeColor = lexerColors[LexerType.Cpp, "RegexFore"];
scintilla.Styles[Style.Cpp.Regex].BackColor = lexerColors[LexerType.Cpp, "RegexBack"];
// COMMENT, fontStyle = 0
scintilla.Styles[Style.Cpp.Comment].ForeColor = lexerColors[LexerType.Cpp, "CommentFore"];
scintilla.Styles[Style.Cpp.Comment].BackColor = lexerColors[LexerType.Cpp, "CommentBack"];
// COMMENT LINE, fontStyle = 0
scintilla.Styles[Style.Cpp.CommentLine].ForeColor = lexerColors[LexerType.Cpp, "CommentLineFore"];
scintilla.Styles[Style.Cpp.CommentLine].BackColor = lexerColors[LexerType.Cpp, "CommentLineBack"];
// COMMENT DOC, fontStyle = 0
scintilla.Styles[Style.Cpp.CommentDoc].ForeColor = lexerColors[LexerType.Cpp, "CommentDocFore"];
scintilla.Styles[Style.Cpp.CommentDoc].BackColor = lexerColors[LexerType.Cpp, "CommentDocBack"];
// COMMENT LINE DOC, fontStyle = 0
scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor = lexerColors[LexerType.Cpp, "CommentLineDocFore"];
scintilla.Styles[Style.Cpp.CommentLineDoc].BackColor = lexerColors[LexerType.Cpp, "CommentLineDocBack"];
// COMMENT DOC KEYWORD, fontStyle = 1
scintilla.Styles[Style.Cpp.CommentDocKeyword].Bold = true;
scintilla.Styles[Style.Cpp.CommentDocKeyword].ForeColor =
lexerColors[LexerType.Cpp, "CommentDocKeywordFore"];
scintilla.Styles[Style.Cpp.CommentDocKeyword].BackColor =
lexerColors[LexerType.Cpp, "CommentDocKeywordBack"];
// COMMENT DOC KEYWORD ERROR, fontStyle = 0
scintilla.Styles[Style.Cpp.CommentDocKeywordError].ForeColor =
lexerColors[LexerType.Cpp, "CommentDocKeywordErrorFore"];
scintilla.Styles[Style.Cpp.CommentDocKeywordError].BackColor =
lexerColors[LexerType.Cpp, "CommentDocKeywordErrorBack"];
// PREPROCESSOR COMMENT, fontStyle = 0
scintilla.Styles[Style.Cpp.PreprocessorComment].ForeColor =
lexerColors[LexerType.Cpp, "PreprocessorCommentFore"];
scintilla.Styles[Style.Cpp.PreprocessorComment].BackColor =
lexerColors[LexerType.Cpp, "PreprocessorCommentBack"];
// PREPROCESSOR COMMENT DOC, fontStyle = 0
scintilla.Styles[Style.Cpp.PreprocessorCommentDoc].ForeColor =
lexerColors[LexerType.Cpp, "PreprocessorCommentDocFore"];
scintilla.Styles[Style.Cpp.PreprocessorCommentDoc].BackColor =
lexerColors[LexerType.Cpp, "PreprocessorCommentDocBack"];
scintilla.LexerName = "cpp";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Cpp);
if(foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,165 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the C# lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerCs: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the C# programming language.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateCsLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors,bool foldOn=true)
{
ClearStyle(scintilla);
// PREPROCESSOR, fontStyle = 0
scintilla.Styles[Style.Cpp.Preprocessor].ForeColor =
lexerColors[LexerType.Cs, "PreprocessorFore"];
scintilla.Styles[Style.Cpp.Preprocessor].BackColor =
lexerColors[LexerType.Cs, "PreprocessorBack"];
// DEFAULT, fontStyle = 0
scintilla.Styles[Style.Cpp.Default].ForeColor =
lexerColors[LexerType.Cs, "DefaultFore"];
scintilla.Styles[Style.Cpp.Default].BackColor =
lexerColors[LexerType.Cs, "DefaultBack"];
// INSTRUCTION WORD, fontStyle = 1
scintilla.Styles[Style.Cpp.Word].Bold = true;
scintilla.Styles[Style.Cpp.Word].ForeColor = lexerColors[LexerType.Cs, "WordFore"];
scintilla.Styles[Style.Cpp.Word].BackColor = lexerColors[LexerType.Cs, "WordBack"];
// TYPE WORD, fontStyle = 0
scintilla.Styles[Style.Cpp.Word2].ForeColor = lexerColors[LexerType.Cs, "Word2Fore"];
scintilla.Styles[Style.Cpp.Word2].BackColor = lexerColors[LexerType.Cs, "Word2Back"];
// NUMBER, fontStyle = 0
scintilla.Styles[Style.Cpp.Number].ForeColor =
lexerColors[LexerType.Cs, "NumberFore"];
scintilla.Styles[Style.Cpp.Number].BackColor =
lexerColors[LexerType.Cs, "NumberBack"];
// STRING, fontStyle = 0
scintilla.Styles[Style.Cpp.String].ForeColor =
lexerColors[LexerType.Cs, "StringFore"];
scintilla.Styles[Style.Cpp.String].BackColor =
lexerColors[LexerType.Cs, "StringBack"];
// CHARACTER, fontStyle = 0
scintilla.Styles[Style.Cpp.Character].ForeColor =
lexerColors[LexerType.Cs, "CharacterFore"];
scintilla.Styles[Style.Cpp.Character].BackColor =
lexerColors[LexerType.Cs, "CharacterBack"];
// OPERATOR, fontStyle = 1
scintilla.Styles[Style.Cpp.Operator].Bold = true;
scintilla.Styles[Style.Cpp.Operator].ForeColor =
lexerColors[LexerType.Cs, "OperatorFore"];
scintilla.Styles[Style.Cpp.Operator].BackColor =
lexerColors[LexerType.Cs, "OperatorBack"];
// VERBATIM, fontStyle = 0
scintilla.Styles[Style.Cpp.Verbatim].ForeColor =
lexerColors[LexerType.Cs, "VerbatimFore"];
scintilla.Styles[Style.Cpp.Verbatim].BackColor =
lexerColors[LexerType.Cs, "VerbatimBack"];
// REGEX, fontStyle = 1
scintilla.Styles[Style.Cpp.Regex].Bold = true;
scintilla.Styles[Style.Cpp.Regex].ForeColor = lexerColors[LexerType.Cs, "RegexFore"];
scintilla.Styles[Style.Cpp.Regex].BackColor = lexerColors[LexerType.Cs, "RegexBack"];
// COMMENT, fontStyle = 0
scintilla.Styles[Style.Cpp.Comment].ForeColor =
lexerColors[LexerType.Cs, "CommentFore"];
scintilla.Styles[Style.Cpp.Comment].BackColor =
lexerColors[LexerType.Cs, "CommentBack"];
// COMMENT LINE, fontStyle = 0
scintilla.Styles[Style.Cpp.CommentLine].ForeColor =
lexerColors[LexerType.Cs, "CommentLineFore"];
scintilla.Styles[Style.Cpp.CommentLine].BackColor =
lexerColors[LexerType.Cs, "CommentLineBack"];
// COMMENT DOC, fontStyle = 0
scintilla.Styles[Style.Cpp.CommentDoc].ForeColor =
lexerColors[LexerType.Cs, "CommentDocFore"];
scintilla.Styles[Style.Cpp.CommentDoc].BackColor =
lexerColors[LexerType.Cs, "CommentDocBack"];
// COMMENT LINE DOC, fontStyle = 0
scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor =
lexerColors[LexerType.Cs, "CommentLineDocFore"];
scintilla.Styles[Style.Cpp.CommentLineDoc].BackColor =
lexerColors[LexerType.Cs, "CommentLineDocBack"];
// COMMENT DOC KEYWORD, fontStyle = 1
scintilla.Styles[Style.Cpp.CommentDocKeyword].Bold = true;
scintilla.Styles[Style.Cpp.CommentDocKeyword].ForeColor =
lexerColors[LexerType.Cs, "CommentDocKeywordFore"];
scintilla.Styles[Style.Cpp.CommentDocKeyword].BackColor =
lexerColors[LexerType.Cs, "CommentDocKeywordBack"];
// COMMENT DOC KEYWORD ERROR, fontStyle = 0
scintilla.Styles[Style.Cpp.CommentDocKeywordError].ForeColor =
lexerColors[LexerType.Cs, "CommentDocKeywordErrorFore"];
scintilla.Styles[Style.Cpp.CommentDocKeywordError].BackColor =
lexerColors[LexerType.Cs, "CommentDocKeywordErrorBack"];
// PREPROCESSOR COMMENT, fontStyle = 0
scintilla.Styles[Style.Cpp.PreprocessorComment].ForeColor =
lexerColors[LexerType.Cs, "PreprocessorCommentFore"];
scintilla.Styles[Style.Cpp.PreprocessorComment].BackColor =
lexerColors[LexerType.Cs, "PreprocessorCommentBack"];
// PREPROCESSOR COMMENT DOC, fontStyle = 0
scintilla.Styles[Style.Cpp.PreprocessorCommentDoc].ForeColor =
lexerColors[LexerType.Cs, "PreprocessorCommentDocFore"];
scintilla.Styles[Style.Cpp.PreprocessorCommentDoc].BackColor =
lexerColors[LexerType.Cs, "PreprocessorCommentDocBack"];
scintilla.LexerName = "cpp";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Cs);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,112 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
class CreateLexerCss: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the Cascading Style Sheets (CSS).
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateCssLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// DEFAULT, fontStyle = 0, styleId = 0
scintilla.Styles[Style.Css.Default].ForeColor = lexerColors[LexerType.Css, "DefaultFore"];
scintilla.Styles[Style.Css.Default].BackColor = lexerColors[LexerType.Css, "DefaultBack"];
// TAG, fontStyle = 0, styleId = 1
scintilla.Styles[Style.Css.Tag].ForeColor = lexerColors[LexerType.Css, "TagFore"];
scintilla.Styles[Style.Css.Tag].BackColor = lexerColors[LexerType.Css, "TagBack"];
// CLASS, fontStyle = 0, styleId = 2
scintilla.Styles[Style.Css.Class].ForeColor = lexerColors[LexerType.Css, "ClassFore"];
scintilla.Styles[Style.Css.Class].BackColor = lexerColors[LexerType.Css, "ClassBack"];
// PSEUDOCLASS, fontStyle = 1, styleId = 3
scintilla.Styles[Style.Css.PseudoClass].Bold = true;
scintilla.Styles[Style.Css.PseudoClass].ForeColor = lexerColors[LexerType.Css, "PseudoClassFore"];
scintilla.Styles[Style.Css.PseudoClass].BackColor = lexerColors[LexerType.Css, "PseudoClassBack"];
// UNKNOWN_PSEUDOCLASS, fontStyle = 0, styleId = 4
scintilla.Styles[Style.Css.UnknownPseudoClass].ForeColor = lexerColors[LexerType.Css, "UnknownPseudoClassFore"];
scintilla.Styles[Style.Css.UnknownPseudoClass].BackColor = lexerColors[LexerType.Css, "UnknownPseudoClassBack"];
// OPERATOR, fontStyle = 1, styleId = 5
scintilla.Styles[Style.Css.Operator].Bold = true;
scintilla.Styles[Style.Css.Operator].ForeColor = lexerColors[LexerType.Css, "OperatorFore"];
scintilla.Styles[Style.Css.Operator].BackColor = lexerColors[LexerType.Css, "OperatorBack"];
// IDENTIFIER, fontStyle = 1, styleId = 6
scintilla.Styles[Style.Css.Identifier].Bold = true;
scintilla.Styles[Style.Css.Identifier].ForeColor = lexerColors[LexerType.Css, "IdentifierFore"];
scintilla.Styles[Style.Css.Identifier].BackColor = lexerColors[LexerType.Css, "IdentifierBack"];
// UNKNOWN_IDENTIFIER, fontStyle = 0, styleId = 7
scintilla.Styles[Style.Css.UnknownIdentifier].ForeColor = lexerColors[LexerType.Css, "UnknownIdentifierFore"];
scintilla.Styles[Style.Css.UnknownIdentifier].BackColor = lexerColors[LexerType.Css, "UnknownIdentifierBack"];
// VALUE, fontStyle = 1, styleId = 8
scintilla.Styles[Style.Css.Value].Bold = true;
scintilla.Styles[Style.Css.Value].ForeColor = lexerColors[LexerType.Css, "ValueFore"];
scintilla.Styles[Style.Css.Value].BackColor = lexerColors[LexerType.Css, "ValueBack"];
// COMMENT, fontStyle = 0, styleId = 9
scintilla.Styles[Style.Css.Comment].ForeColor = lexerColors[LexerType.Css, "CommentFore"];
scintilla.Styles[Style.Css.Comment].BackColor = lexerColors[LexerType.Css, "CommentBack"];
// ID, fontStyle = 1, styleId = 10
scintilla.Styles[Style.Css.Id].Bold = true;
scintilla.Styles[Style.Css.Id].ForeColor = lexerColors[LexerType.Css, "IdFore"];
scintilla.Styles[Style.Css.Id].BackColor = lexerColors[LexerType.Css, "IdBack"];
// IMPORTANT, fontStyle = 1, styleId = 11
scintilla.Styles[Style.Css.Important].Bold = true;
scintilla.Styles[Style.Css.Important].ForeColor = lexerColors[LexerType.Css, "ImportantFore"];
scintilla.Styles[Style.Css.Important].BackColor = lexerColors[LexerType.Css, "ImportantBack"];
// DIRECTIVE, fontStyle = 0, styleId = 12
scintilla.Styles[Style.Css.Directive].ForeColor = lexerColors[LexerType.Css, "DirectiveFore"];
scintilla.Styles[Style.Css.Directive].BackColor = lexerColors[LexerType.Css, "DirectiveBack"];
scintilla.LexerName = "css";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Css);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,65 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the HTML lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
class CreateLexerHtml: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the HTML (Hypertext Markup Language).
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateHtmlLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
// HTML should be simple but the embedded scripts make it hard for lexical "analysis"..
ClearStyle(scintilla);
//..therefore the weird logic.. (which might malfunction)..
SetHtmlStyles(scintilla, lexerColors);
SetPhpStyles(scintilla, lexerColors);
scintilla.LexerName = "hypertext";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.HTML);
SetScriptedHtml(LexerType.HTML, scintilla, lexerColors);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,78 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the INI lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerIni: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the INI (properties file).
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateIniLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// DEFAULT, fontStyle = 0, styleId = 0
scintilla.Styles[Style.Properties.Default].ForeColor = lexerColors[LexerType.INI, "DefaultFore"];
scintilla.Styles[Style.Properties.Default].BackColor = lexerColors[LexerType.INI, "DefaultBack"];
// COMMENT, fontStyle = 0, styleId = 1
scintilla.Styles[Style.Properties.Comment].ForeColor = lexerColors[LexerType.INI, "CommentFore"];
scintilla.Styles[Style.Properties.Comment].BackColor = lexerColors[LexerType.INI, "CommentBack"];
// SECTION, fontStyle = 1, styleId = 2
scintilla.Styles[Style.Properties.Section].Bold = true;
scintilla.Styles[Style.Properties.Section].ForeColor = lexerColors[LexerType.INI, "SectionFore"];
scintilla.Styles[Style.Properties.Section].BackColor = lexerColors[LexerType.INI, "SectionBack"];
// ASSIGNMENT, fontStyle = 1, styleId = 3
scintilla.Styles[Style.Properties.Assignment].Bold = true;
scintilla.Styles[Style.Properties.Assignment].ForeColor = lexerColors[LexerType.INI, "AssignmentFore"];
scintilla.Styles[Style.Properties.Assignment].BackColor = lexerColors[LexerType.INI, "AssignmentBack"];
// DEFVAL, fontStyle = 0, styleId = 4
scintilla.Styles[Style.Properties.DefVal].ForeColor = lexerColors[LexerType.INI, "DefValFore"];
scintilla.Styles[Style.Properties.DefVal].BackColor = lexerColors[LexerType.INI, "DefValBack"];
scintilla.LexerName = "props";
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,213 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
// ReSharper disable once CommentTypo
/// <summary>
/// Constants for the InnoSetup script language.
/// </summary>
// ReSharper disable once IdentifierTypo
public static class InnoSetup
{
///
/// Summary:
/// Default style index.
public const int Default = 0;
///
/// Summary:
/// Identifier style index.
public const int Identifier = 1;
///
/// Summary:
/// Comment style '{' index.
public const int Comment = 2;
///
/// Summary:
/// Comment style 2 "(*" index.
public const int Comment2 = 3;
///
/// Summary:
/// Comment line style "//" index.
public const int CommentLine = 4;
///
/// Summary:
/// Preprocessor style "{$" index.
public const int Preprocessor = 5;
///
/// Summary:
/// Preprocessor style 2 "(*$" index.
public const int Preprocessor2 = 6;
///
/// Summary:
/// Number style index.
public const int Number = 7;
///
/// Summary:
/// Hexadecimal number style index.
public const int HexNumber = 8;
///
/// Summary:
/// Word (keyword set 0) style index.
public const int Word = 9;
///
/// Summary:
/// Double-quoted string style index.
public const int String = 10;
///
/// Summary:
/// Unclosed string EOL style index.
public const int StringEol = 11;
///
/// Summary:
/// Single-quoted string style index.
public const int Character = 12;
///
/// Summary:
/// Operator style index.
public const int Operator = 13;
///
/// Summary:
/// Assembly style index.
public const int Asm = 14;
}
// ReSharper disable once CommentTypo
/// <summary>
/// A class for the InnoSetup lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
// ReSharper disable once IdentifierTypo
public class CreateLexerInnoSetup: CreateLexerCommon
{
// ReSharper disable once CommentTypo
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the InnoSetup programming language.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
// ReSharper disable once IdentifierTypo
public static bool CreateInnoSetupLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// DEFAULT, fontStyle = 0
scintilla.Styles[InnoSetup.Default].ForeColor = lexerColors[LexerType.InnoSetup, "DefaultFore"];
scintilla.Styles[InnoSetup.Default].BackColor = lexerColors[LexerType.InnoSetup, "DefaultBack"];
// IDENTIFIER, fontStyle = 0
scintilla.Styles[InnoSetup.Identifier].ForeColor = lexerColors[LexerType.InnoSetup, "IdentifierFore"];
scintilla.Styles[InnoSetup.Identifier].BackColor = lexerColors[LexerType.InnoSetup, "IdentifierBack"];
// COMMENT, fontStyle = 0
scintilla.Styles[InnoSetup.Comment].ForeColor = lexerColors[LexerType.InnoSetup, "CommentFore"];
scintilla.Styles[InnoSetup.Comment].BackColor = lexerColors[LexerType.InnoSetup, "CommentBack"];
// COMMENT LINE, fontStyle = 0
scintilla.Styles[InnoSetup.Comment2].ForeColor = lexerColors[LexerType.InnoSetup, "Comment2Fore"];
scintilla.Styles[InnoSetup.Comment2].BackColor = lexerColors[LexerType.InnoSetup, "Comment2Back"];
// COMMENT DOC, fontStyle = 0
scintilla.Styles[InnoSetup.CommentLine].ForeColor = lexerColors[LexerType.InnoSetup, "CommentLineFore"];
scintilla.Styles[InnoSetup.CommentLine].BackColor = lexerColors[LexerType.InnoSetup, "CommentLineBack"];
// PREPROCESSOR, fontStyle = 0
scintilla.Styles[InnoSetup.Preprocessor].ForeColor = lexerColors[LexerType.InnoSetup, "PreprocessorFore"];
scintilla.Styles[InnoSetup.Preprocessor].BackColor = lexerColors[LexerType.InnoSetup, "PreprocessorBack"];
// PREPROCESSOR2, fontStyle = 0
scintilla.Styles[InnoSetup.Preprocessor2].ForeColor = lexerColors[LexerType.InnoSetup, "Preprocessor2Fore"];
scintilla.Styles[InnoSetup.Preprocessor2].BackColor = lexerColors[LexerType.InnoSetup, "Preprocessor2Back"];
// NUMBER, fontStyle = 0
scintilla.Styles[InnoSetup.Number].ForeColor = lexerColors[LexerType.InnoSetup, "NumberFore"];
scintilla.Styles[InnoSetup.Number].BackColor = lexerColors[LexerType.InnoSetup, "NumberBack"];
// HEX NUMBER, fontStyle = 0
scintilla.Styles[InnoSetup.HexNumber].ForeColor = lexerColors[LexerType.InnoSetup, "HexNumberFore"];
scintilla.Styles[InnoSetup.HexNumber].BackColor = lexerColors[LexerType.InnoSetup, "HexNumberBack"];
// INSTRUCTION WORD, fontStyle = 1
scintilla.Styles[InnoSetup.Word].Bold = true;
scintilla.Styles[InnoSetup.Word].ForeColor = lexerColors[LexerType.InnoSetup, "WordFore"];
scintilla.Styles[InnoSetup.Word].BackColor = lexerColors[LexerType.InnoSetup, "WordBack"];
// STRING, fontStyle = 0
scintilla.Styles[InnoSetup.String].ForeColor = lexerColors[LexerType.InnoSetup, "StringFore"];
scintilla.Styles[InnoSetup.String].BackColor = lexerColors[LexerType.InnoSetup, "StringBack"];
// CHARACTER, fontStyle = 0
scintilla.Styles[InnoSetup.Character].ForeColor = lexerColors[LexerType.InnoSetup, "CharacterFore"];
scintilla.Styles[InnoSetup.Character].BackColor = lexerColors[LexerType.InnoSetup, "CharacterBack"];
// OPERATOR, fontStyle = 1
scintilla.Styles[InnoSetup.Operator].Bold = true;
scintilla.Styles[InnoSetup.Operator].ForeColor = lexerColors[LexerType.InnoSetup, "OperatorFore"];
scintilla.Styles[InnoSetup.Operator].BackColor = lexerColors[LexerType.InnoSetup, "OperatorBack"];
// ASM, fontStyle = 1
scintilla.Styles[InnoSetup.Asm].Bold = true;
scintilla.Styles[InnoSetup.Asm].ForeColor = lexerColors[LexerType.InnoSetup, "ForeColorFore"];
scintilla.Styles[InnoSetup.Asm].BackColor = lexerColors[LexerType.InnoSetup, "ForeColorBack"];
scintilla.LexerName = "inno";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.InnoSetup);
if (foldOn)
AddFolding(scintilla);
return true;
}
/// <summary>
/// Creates a color value of a given integer containing an RGB color value.
/// </summary>
/// <param name="rgb">The RGB color value.</param>
/// <returns>System.Drawing.Color.</returns>
public static System.Drawing.Color IntToColor(int rgb)
{
return System.Drawing.Color.FromArgb(255, (byte)(rgb >> 16), (byte)(rgb >> 8), (byte)rgb);
}
}
}
@@ -0,0 +1,126 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the Java lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerJava : CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the Java programming language.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateJavaLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// PREPROCESSOR, fontStyle = 0, styleId = 9
scintilla.Styles[Style.Cpp.Preprocessor].ForeColor = lexerColors[LexerType.Java, "PreprocessorFore"];
scintilla.Styles[Style.Cpp.Preprocessor].BackColor = lexerColors[LexerType.Java, "PreprocessorBack"];
// Style.Cpp.Identifier ?, Style.Cpp.Default = 0..
// DEFAULT, fontStyle = 0, styleId = 11
scintilla.Styles[Style.Cpp.Default].ForeColor = lexerColors[LexerType.Java, "DefaultFore"];
scintilla.Styles[Style.Cpp.Default].BackColor = lexerColors[LexerType.Java, "DefaultBack"];
// INSTRUCTION WORD, fontStyle = 1, styleId = 5
scintilla.Styles[Style.Cpp.Word].Bold = true;
scintilla.Styles[Style.Cpp.Word].ForeColor = lexerColors[LexerType.Java, "InstructionWordFore"];
scintilla.Styles[Style.Cpp.Word].BackColor = lexerColors[LexerType.Java, "InstructionWordBack"];
// TYPE WORD, fontStyle = 0, styleId = 16
scintilla.Styles[Style.Cpp.Word2].ForeColor = lexerColors[LexerType.Java, "TypeWordFore"];
scintilla.Styles[Style.Cpp.Word2].BackColor = lexerColors[LexerType.Java, "TypeWordBack"];
// NUMBER, fontStyle = 0, styleId = 4
scintilla.Styles[Style.Cpp.Number].ForeColor = lexerColors[LexerType.Java, "NumberFore"];
scintilla.Styles[Style.Cpp.Number].BackColor = lexerColors[LexerType.Java, "NumberBack"];
// STRING, fontStyle = 0, styleId = 6
scintilla.Styles[Style.Cpp.String].ForeColor = lexerColors[LexerType.Java, "StringFore"];
scintilla.Styles[Style.Cpp.String].BackColor = lexerColors[LexerType.Java, "StringBack"];
// CHARACTER, fontStyle = 0, styleId = 7
scintilla.Styles[Style.Cpp.Character].ForeColor = lexerColors[LexerType.Java, "CharacterFore"];
scintilla.Styles[Style.Cpp.Character].BackColor = lexerColors[LexerType.Java, "CharacterBack"];
// OPERATOR, fontStyle = 1, styleId = 10
scintilla.Styles[Style.Cpp.Operator].Bold = true;
scintilla.Styles[Style.Cpp.Operator].ForeColor = lexerColors[LexerType.Java, "OperatorFore"];
scintilla.Styles[Style.Cpp.Operator].BackColor = lexerColors[LexerType.Java, "OperatorBack"];
// VERBATIM, fontStyle = 0, styleId = 13
scintilla.Styles[Style.Cpp.Verbatim].ForeColor = lexerColors[LexerType.Java, "VerbatimFore"];
scintilla.Styles[Style.Cpp.Verbatim].BackColor = lexerColors[LexerType.Java, "VerbatimBack"];
// REGEX, fontStyle = 1, styleId = 14
scintilla.Styles[Style.Cpp.Regex].Bold = true;
scintilla.Styles[Style.Cpp.Regex].ForeColor = lexerColors[LexerType.Java, "RegexFore"];
scintilla.Styles[Style.Cpp.Regex].BackColor = lexerColors[LexerType.Java, "RegexBack"];
// COMMENT, fontStyle = 0, styleId = 1
scintilla.Styles[Style.Cpp.Comment].ForeColor = lexerColors[LexerType.Java, "CommentFore"];
scintilla.Styles[Style.Cpp.Comment].BackColor = lexerColors[LexerType.Java, "CommentBack"];
// COMMENT LINE, fontStyle = 0, styleId = 2
scintilla.Styles[Style.Cpp.CommentLine].ForeColor = lexerColors[LexerType.Java, "CommentLineFore"];
scintilla.Styles[Style.Cpp.CommentLine].BackColor = lexerColors[LexerType.Java, "CommentLineBack"];
// COMMENT DOC, fontStyle = 0, styleId = 3
scintilla.Styles[Style.Cpp.CommentDoc].ForeColor = lexerColors[LexerType.Java, "CommentDocFore"];
scintilla.Styles[Style.Cpp.CommentDoc].BackColor = lexerColors[LexerType.Java, "CommentDocBack"];
// COMMENT LINE DOC, fontStyle = 0, styleId = 15
scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor = lexerColors[LexerType.Java, "CommentLineDocFore"];
scintilla.Styles[Style.Cpp.CommentLineDoc].BackColor = lexerColors[LexerType.Java, "CommentLineDocBack"];
// COMMENT DOC KEYWORD, fontStyle = 1, styleId = 17
scintilla.Styles[Style.Cpp.CommentDocKeyword].Bold = true;
scintilla.Styles[Style.Cpp.CommentDocKeyword].ForeColor = lexerColors[LexerType.Java, "CommentDocKeywordFore"];
scintilla.Styles[Style.Cpp.CommentDocKeyword].BackColor = lexerColors[LexerType.Java, "CommentDocKeywordBack"];
// COMMENT DOC KEYWORD ERROR, fontStyle = 0, styleId = 18
scintilla.Styles[Style.Cpp.CommentDocKeywordError].ForeColor = lexerColors[LexerType.Java, "CommentDocKeywordErrorFore"];
scintilla.Styles[Style.Cpp.CommentDocKeywordError].BackColor = lexerColors[LexerType.Java, "CommentDocKeywordErrorBack"];
scintilla.LexerName = "cpp";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Java);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,127 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
class CreateLexerJavaScript: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the Java programming language.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateJavaScriptLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// 11 ?, Style.Cpp.Default = 0..
// DEFAULT, fontStyle = 0, styleId = 11
scintilla.Styles[Style.Cpp.Default].ForeColor = lexerColors[LexerType.JavaScript, "DefaultFore"];
scintilla.Styles[Style.Cpp.Default].BackColor = lexerColors[LexerType.JavaScript, "DefaultBack"];
// TODO::From here onward!!
// INSTRUCTION WORD, fontStyle = 1, styleId = 5
scintilla.Styles[Style.Cpp.Word].Bold = true;
scintilla.Styles[Style.Cpp.Word].ForeColor = lexerColors[LexerType.JavaScript, "InstructionWordFore"];
scintilla.Styles[Style.Cpp.Word].BackColor = lexerColors[LexerType.JavaScript, "InstructionWordBack"];
// TYPE WORD, fontStyle = 0, styleId = 16
scintilla.Styles[Style.Cpp.Word2].ForeColor = lexerColors[LexerType.JavaScript, "TypeWordFore"];
scintilla.Styles[Style.Cpp.Word2].BackColor = lexerColors[LexerType.JavaScript, "TypeWordBack"];
// WINDOW INSTRUCTION, fontStyle = 1, styleId = 19
scintilla.Styles[Style.Cpp.GlobalClass].Bold = true;
scintilla.Styles[Style.Cpp.GlobalClass].ForeColor = lexerColors[LexerType.JavaScript, "WindowInstructionFore"];
scintilla.Styles[Style.Cpp.GlobalClass].BackColor = lexerColors[LexerType.JavaScript, "WindowInstructionBack"];
// NUMBER, fontStyle = 0, styleId = 4
scintilla.Styles[Style.Cpp.Number].ForeColor = lexerColors[LexerType.JavaScript, "NumberFore"];
scintilla.Styles[Style.Cpp.Number].BackColor = lexerColors[LexerType.JavaScript, "NumberBack"];
// STRING, fontStyle = 0, styleId = 6
scintilla.Styles[Style.Cpp.String].ForeColor = lexerColors[LexerType.JavaScript, "StringFore"];
scintilla.Styles[Style.Cpp.String].BackColor = lexerColors[LexerType.JavaScript, "StringBack"];
// STRINGRAW, fontStyle = 0, styleId = 20
scintilla.Styles[Style.Cpp.StringRaw].ForeColor = lexerColors[LexerType.JavaScript, "StringRawFore"];
scintilla.Styles[Style.Cpp.StringRaw].BackColor = lexerColors[LexerType.JavaScript, "StringRawBack"];
// CHARACTER, fontStyle = 0, styleId = 7
scintilla.Styles[Style.Cpp.Character].ForeColor = lexerColors[LexerType.JavaScript, "CharacterFore"];
scintilla.Styles[Style.Cpp.Character].BackColor = lexerColors[LexerType.JavaScript, "CharacterBack"];
// OPERATOR, fontStyle = 1, styleId = 10
scintilla.Styles[Style.Cpp.Operator].Bold = true;
scintilla.Styles[Style.Cpp.Operator].ForeColor = lexerColors[LexerType.JavaScript, "OperatorFore"];
scintilla.Styles[Style.Cpp.Operator].BackColor = lexerColors[LexerType.JavaScript, "OperatorBack"];
// VERBATIM, fontStyle = 0, styleId = 13
scintilla.Styles[Style.Cpp.Verbatim].ForeColor = lexerColors[LexerType.JavaScript, "VerbatimFore"];
scintilla.Styles[Style.Cpp.Verbatim].BackColor = lexerColors[LexerType.JavaScript, "VerbatimBack"];
// REGEX, fontStyle = 1, styleId = 14
scintilla.Styles[Style.Cpp.Regex].Bold = true;
scintilla.Styles[Style.Cpp.Regex].ForeColor = lexerColors[LexerType.JavaScript, "RegexFore"];
scintilla.Styles[Style.Cpp.Regex].BackColor = lexerColors[LexerType.JavaScript, "RegexBack"];
// COMMENT, fontStyle = 0, styleId = 1
scintilla.Styles[Style.Cpp.Comment].ForeColor = lexerColors[LexerType.JavaScript, "CommentFore"];
scintilla.Styles[Style.Cpp.Comment].BackColor = lexerColors[LexerType.JavaScript, "CommentBack"];
// COMMENT LINE, fontStyle = 0, styleId = 2
scintilla.Styles[Style.Cpp.CommentLine].ForeColor = lexerColors[LexerType.JavaScript, "CommentLineFore"];
scintilla.Styles[Style.Cpp.CommentLine].BackColor = lexerColors[LexerType.JavaScript, "CommentLineBack"];
// COMMENT DOC, fontStyle = 0, styleId = 3
scintilla.Styles[Style.Cpp.CommentDoc].ForeColor = lexerColors[LexerType.JavaScript, "CommentDocFore"];
scintilla.Styles[Style.Cpp.CommentDoc].BackColor = lexerColors[LexerType.JavaScript, "CommentDocBack"];
// COMMENT LINE DOC, fontStyle = 0, styleId = 15
scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor = lexerColors[LexerType.JavaScript, "CommentLineDocFore"];
scintilla.Styles[Style.Cpp.CommentLineDoc].BackColor = lexerColors[LexerType.JavaScript, "CommentLineDocBack"];
// COMMENT DOC KEYWORD, fontStyle = 1, styleId = 17
scintilla.Styles[Style.Cpp.CommentDocKeyword].Bold = true;
scintilla.Styles[Style.Cpp.CommentDocKeyword].ForeColor = lexerColors[LexerType.JavaScript, "CommentDocKeywordFore"];
scintilla.Styles[Style.Cpp.CommentDocKeyword].BackColor = lexerColors[LexerType.JavaScript, "CommentDocKeywordBack"];
// COMMENT DOC KEYWORD ERROR, fontStyle = 0, styleId = 18
scintilla.Styles[Style.Cpp.CommentDocKeywordError].ForeColor = lexerColors[LexerType.JavaScript, "CommentDocKeywordErrorFore"];
scintilla.Styles[Style.Cpp.CommentDocKeywordError].BackColor = lexerColors[LexerType.JavaScript, "CommentDocKeywordErrorBack"];
scintilla.LexerName = "cpp";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.JavaScript);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,122 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the YAML lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerJson: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the YAML (YAML Ain't Markup Language).
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateJsonLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// DEFAULT
scintilla.Styles[Style.Json.Default].ForeColor = lexerColors[LexerType.Json, "JsonDefaultFore"];
scintilla.Styles[Style.Json.Default].BackColor = lexerColors[LexerType.Json, "JsonDefaultBack"];
// NUMBER
scintilla.Styles[Style.Json.Number].ForeColor = lexerColors[LexerType.Json, "JsonNumberFore"];
scintilla.Styles[Style.Json.Number].BackColor = lexerColors[LexerType.Json, "JsonNumberBack"];
// STRING
scintilla.Styles[Style.Json.String].ForeColor = lexerColors[LexerType.Json, "JsonStringFore"];
scintilla.Styles[Style.Json.String].BackColor = lexerColors[LexerType.Json, "JsonStringBack"];
// UNCLOSED STRING
scintilla.Styles[Style.Json.StringEol].ForeColor = lexerColors[LexerType.Json, "JsonUnclosedStringFore"];
scintilla.Styles[Style.Json.StringEol].BackColor = lexerColors[LexerType.Json, "JsonUnclosedStringBack"];
// PROPERTY
scintilla.Styles[Style.Json.PropertyName].ForeColor = lexerColors[LexerType.Json, "JsonPropertyFore"];
scintilla.Styles[Style.Json.PropertyName].BackColor = lexerColors[LexerType.Json, "JsonPropertyBack"];
// ESCAPE SEQUENCE
scintilla.Styles[Style.Json.LineComment].ForeColor = lexerColors[LexerType.Json, "JsonEscapeSequenceFore"];
scintilla.Styles[Style.Json.LineComment].BackColor = lexerColors[LexerType.Json, "JsonEscapeSequenceBack"];
// LINE COMMENT
scintilla.Styles[Style.Json.LineComment].ForeColor = lexerColors[LexerType.Json, "JsonLineCommentFore"];
scintilla.Styles[Style.Json.LineComment].BackColor = lexerColors[LexerType.Json, "JsonLineCommentBack"];
scintilla.Styles[Style.Json.LineComment].Italic = true;
// BLOCK COMMENT
scintilla.Styles[Style.Json.BlockComment].ForeColor = lexerColors[LexerType.Json, "JsonBlockCommentFore"];
scintilla.Styles[Style.Json.BlockComment].BackColor = lexerColors[LexerType.Json, "JsonBlockCommentBack"];
// OPERATOR
scintilla.Styles[Style.Json.Operator].ForeColor = lexerColors[LexerType.Json, "JsonOperatorFore"];
scintilla.Styles[Style.Json.Operator].BackColor = lexerColors[LexerType.Json, "JsonOperatorBack"];
// URL/IRI
scintilla.Styles[Style.Json.Uri].ForeColor = lexerColors[LexerType.Json, "JsonUriFore"];
scintilla.Styles[Style.Json.Uri].BackColor = lexerColors[LexerType.Json, "JsonUriBack"];
// JSON-LD COMPACT IRI
scintilla.Styles[Style.Json.CompactIRI].ForeColor = lexerColors[LexerType.Json, "JsonCompactIRIFore"];
scintilla.Styles[Style.Json.CompactIRI].BackColor = lexerColors[LexerType.Json, "JsonCompactIRIBack"];
// JSON KEYWORD
scintilla.Styles[Style.Json.Keyword].ForeColor = lexerColors[LexerType.Json, "JsonKeywordFore"];
scintilla.Styles[Style.Json.Keyword].BackColor = lexerColors[LexerType.Json, "JsonKeywordBack"];
// JSON-LD KEYWORD
scintilla.Styles[Style.Json.LdKeyword].ForeColor = lexerColors[LexerType.Json, "JsonLdKeywordFore"];
scintilla.Styles[Style.Json.LdKeyword].BackColor = lexerColors[LexerType.Json, "JsonLdKeywordBack"];
// PARSING ERROR
scintilla.Styles[Style.Json.LdKeyword].ForeColor = lexerColors[LexerType.Json, "JsonErrorFore"];
scintilla.Styles[Style.Json.LdKeyword].BackColor = lexerColors[LexerType.Json, "JsonErrorBack"];
scintilla.LexerName = "json";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Json);
scintilla.SetProperty("lexer.json.allow.comments", "1");
scintilla.SetProperty("lexer.json.escape.sequence", "1");
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,163 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the NSIS lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerNsis: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the NSIS (Nullsoft Scriptable Install System).
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateNsisLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// NSIS not found..
#region NSIS_CONSTANTS
const int SCE_NSIS_DEFAULT = 0;
const int SCE_NSIS_COMMENT = 1;
const int SCE_NSIS_STRINGDQ = 2;
const int SCE_NSIS_STRINGLQ = 3;
const int SCE_NSIS_STRINGRQ = 4;
const int SCE_NSIS_FUNCTION = 5;
const int SCE_NSIS_VARIABLE = 6;
const int SCE_NSIS_LABEL = 7;
const int SCE_NSIS_USERDEFINED = 8;
const int SCE_NSIS_SECTIONDEF = 9;
const int SCE_NSIS_SUBSECTIONDEF = 10;
const int SCE_NSIS_IFDEFINEDEF = 11;
const int SCE_NSIS_MACRODEF = 12;
const int SCE_NSIS_STRINGVAR = 13;
const int SCE_NSIS_NUMBER = 14;
const int SCE_NSIS_SECTIONGROUP = 15;
const int SCE_NSIS_PAGEEX = 16;
const int SCE_NSIS_FUNCTIONDEF = 17;
const int SCE_NSIS_COMMENTBOX = 18;
#endregion
// DEFAULT, fontStyle = 0
scintilla.Styles[SCE_NSIS_DEFAULT].ForeColor = lexerColors[LexerType.Nsis, "DefaultFore"];
scintilla.Styles[SCE_NSIS_DEFAULT].BackColor = lexerColors[LexerType.Nsis, "DefaultBack"];
// COMMENTLINE, fontStyle = 0
scintilla.Styles[SCE_NSIS_COMMENT].ForeColor = lexerColors[LexerType.Nsis, "CommentFore"];
scintilla.Styles[SCE_NSIS_COMMENT].BackColor = lexerColors[LexerType.Nsis, "CommentBack"];
// STRING DOUBLE QUOTE, fontStyle = 0
scintilla.Styles[SCE_NSIS_STRINGDQ].ForeColor = lexerColors[LexerType.Nsis, "StringDoubleQuoteFore"];
scintilla.Styles[SCE_NSIS_STRINGDQ].BackColor = lexerColors[LexerType.Nsis, "StringDoubleQuoteBack"];
// STRING LEFT QUOTE, fontStyle = 0
scintilla.Styles[SCE_NSIS_STRINGLQ].ForeColor = lexerColors[LexerType.Nsis, "StringLeftQuoteFore"];
scintilla.Styles[SCE_NSIS_STRINGLQ].BackColor = lexerColors[LexerType.Nsis, "StringLeftQuoteBack"];
// STRING RIGHT QUOTE, fontStyle = 0
scintilla.Styles[SCE_NSIS_STRINGRQ].ForeColor = lexerColors[LexerType.Nsis, "StringRightQuoteFore"];
scintilla.Styles[SCE_NSIS_STRINGRQ].BackColor = lexerColors[LexerType.Nsis, "StringRightQuoteBack"];
// FUNCTION, fontStyle = 0
scintilla.Styles[SCE_NSIS_FUNCTION].ForeColor = lexerColors[LexerType.Nsis, "FunctionFore"];
scintilla.Styles[SCE_NSIS_FUNCTION].BackColor = lexerColors[LexerType.Nsis, "FunctionBack"];
// VARIABLE, fontStyle = 0
scintilla.Styles[SCE_NSIS_VARIABLE].ForeColor = lexerColors[LexerType.Nsis, "VariableFore"];
scintilla.Styles[SCE_NSIS_VARIABLE].BackColor = lexerColors[LexerType.Nsis, "VariableBack"];
// LABEL, fontStyle = 0
scintilla.Styles[SCE_NSIS_LABEL].ForeColor = lexerColors[LexerType.Nsis, "LabelFore"];
scintilla.Styles[SCE_NSIS_LABEL].BackColor = lexerColors[LexerType.Nsis, "LabelBack"];
// USER DEFINED, fontStyle = 4
scintilla.Styles[SCE_NSIS_USERDEFINED].ForeColor = lexerColors[LexerType.Nsis, "UserDefinedFore"];
scintilla.Styles[SCE_NSIS_USERDEFINED].BackColor = lexerColors[LexerType.Nsis, "UserDefinedBack"];
// SECTION, fontStyle = 1
scintilla.Styles[SCE_NSIS_SECTIONDEF].Bold = true;
scintilla.Styles[SCE_NSIS_SECTIONDEF].ForeColor = lexerColors[LexerType.Nsis, "SectionFore"];
scintilla.Styles[SCE_NSIS_SECTIONDEF].BackColor = lexerColors[LexerType.Nsis, "SectionBack"];
// SUBSECTION, fontStyle = 1
scintilla.Styles[SCE_NSIS_SUBSECTIONDEF].Bold = true;
scintilla.Styles[SCE_NSIS_SUBSECTIONDEF].ForeColor = lexerColors[LexerType.Nsis, "SubSectionFore"];
scintilla.Styles[SCE_NSIS_SUBSECTIONDEF].BackColor = lexerColors[LexerType.Nsis, "SubSectionBack"];
// IF DEFINE, fontStyle = 0
scintilla.Styles[SCE_NSIS_IFDEFINEDEF].ForeColor = lexerColors[LexerType.Nsis, "IfDefineFore"];
scintilla.Styles[SCE_NSIS_IFDEFINEDEF].BackColor = lexerColors[LexerType.Nsis, "IfDefineBack"];
// MACRO, fontStyle = 1
scintilla.Styles[SCE_NSIS_MACRODEF].Bold = true;
scintilla.Styles[SCE_NSIS_MACRODEF].ForeColor = lexerColors[LexerType.Nsis, "MacroFore"];
scintilla.Styles[SCE_NSIS_MACRODEF].BackColor = lexerColors[LexerType.Nsis, "MacroBack"];
// STRING VAR, fontStyle = 0
scintilla.Styles[SCE_NSIS_STRINGVAR].ForeColor = lexerColors[LexerType.Nsis, "StringVarFore"];
scintilla.Styles[SCE_NSIS_STRINGVAR].BackColor = lexerColors[LexerType.Nsis, "StringVarBack"];
// NUMBER, fontStyle = 0
scintilla.Styles[SCE_NSIS_NUMBER].ForeColor = lexerColors[LexerType.Nsis, "NumberFore"];
scintilla.Styles[SCE_NSIS_NUMBER].BackColor = lexerColors[LexerType.Nsis, "NumberBack"];
// SECTION GROUP, fontStyle = 1
scintilla.Styles[SCE_NSIS_SECTIONGROUP].Bold = true;
scintilla.Styles[SCE_NSIS_SECTIONGROUP].ForeColor = lexerColors[LexerType.Nsis, "SectionGroupFore"];
scintilla.Styles[SCE_NSIS_SECTIONGROUP].BackColor = lexerColors[LexerType.Nsis, "SectionGroupBack"];
// PAGE EX, fontStyle = 1
scintilla.Styles[SCE_NSIS_PAGEEX].Bold = true;
scintilla.Styles[SCE_NSIS_PAGEEX].ForeColor = lexerColors[LexerType.Nsis, "PageExFore"];
scintilla.Styles[SCE_NSIS_PAGEEX].BackColor = lexerColors[LexerType.Nsis, "PageExBack"];
// FUNCTION DEFINITIONS, fontStyle = 1
scintilla.Styles[SCE_NSIS_FUNCTIONDEF].Bold = true;
scintilla.Styles[SCE_NSIS_FUNCTIONDEF].ForeColor = lexerColors[LexerType.Nsis, "FunctionDefinitionsFore"];
scintilla.Styles[SCE_NSIS_FUNCTIONDEF].BackColor = lexerColors[LexerType.Nsis, "FunctionDefinitionsBack"];
// COMMENT, fontStyle = 0
scintilla.Styles[SCE_NSIS_COMMENTBOX].ForeColor = lexerColors[LexerType.Nsis, "CommentFore"];
scintilla.Styles[SCE_NSIS_COMMENTBOX].BackColor = lexerColors[LexerType.Nsis, "CommentBack"];
scintilla.LexerName = "nsis";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Nsis);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,50 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for plain text.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
class CreateLexerNull: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for a plain text file.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateNullLexer(Scintilla scintilla)
{
ClearStyle(scintilla);
scintilla.LexerName = "null";
return true;
}
}
}
@@ -0,0 +1,117 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the Pascal lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerPascal: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the Pascal programming language.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreatePascalLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// DEFAULT, fontStyle = 0
scintilla.Styles[Style.Pascal.Default].ForeColor = lexerColors[LexerType.Pascal, "DefaultFore"];
scintilla.Styles[Style.Pascal.Default].BackColor = lexerColors[LexerType.Pascal, "DefaultBack"];
// IDENTIFIER, fontStyle = 0
scintilla.Styles[Style.Pascal.Identifier].ForeColor = lexerColors[LexerType.Pascal, "IdentifierFore"];
scintilla.Styles[Style.Pascal.Identifier].BackColor = lexerColors[LexerType.Pascal, "IdentifierBack"];
// COMMENT, fontStyle = 0
scintilla.Styles[Style.Pascal.Comment].ForeColor = lexerColors[LexerType.Pascal, "CommentFore"];
scintilla.Styles[Style.Pascal.Comment].BackColor = lexerColors[LexerType.Pascal, "CommentBack"];
// COMMENT LINE, fontStyle = 0
scintilla.Styles[Style.Pascal.Comment2].ForeColor = lexerColors[LexerType.Pascal, "Comment2Fore"];
scintilla.Styles[Style.Pascal.Comment2].BackColor = lexerColors[LexerType.Pascal, "Comment2Back"];
// COMMENT DOC, fontStyle = 0
scintilla.Styles[Style.Pascal.CommentLine].ForeColor = lexerColors[LexerType.Pascal, "CommentLineFore"];
scintilla.Styles[Style.Pascal.CommentLine].BackColor = lexerColors[LexerType.Pascal, "CommentLineBack"];
// PREPROCESSOR, fontStyle = 0
scintilla.Styles[Style.Pascal.Preprocessor].ForeColor = lexerColors[LexerType.Pascal, "PreprocessorFore"];
scintilla.Styles[Style.Pascal.Preprocessor].BackColor = lexerColors[LexerType.Pascal, "PreprocessorBack"];
// PREPROCESSOR2, fontStyle = 0
scintilla.Styles[Style.Pascal.Preprocessor2].ForeColor = lexerColors[LexerType.Pascal, "Preprocessor2Fore"];
scintilla.Styles[Style.Pascal.Preprocessor2].BackColor = lexerColors[LexerType.Pascal, "Preprocessor2Back"];
// NUMBER, fontStyle = 0
scintilla.Styles[Style.Pascal.Number].ForeColor = lexerColors[LexerType.Pascal, "NumberFore"];
scintilla.Styles[Style.Pascal.Number].BackColor = lexerColors[LexerType.Pascal, "NumberBack"];
// HEX NUMBER, fontStyle = 0
scintilla.Styles[Style.Pascal.HexNumber].ForeColor = lexerColors[LexerType.Pascal, "HexNumberFore"];
scintilla.Styles[Style.Pascal.HexNumber].BackColor = lexerColors[LexerType.Pascal, "HexNumberBack"];
// INSTRUCTION WORD, fontStyle = 1
scintilla.Styles[Style.Pascal.Word].Bold = true;
scintilla.Styles[Style.Pascal.Word].ForeColor = lexerColors[LexerType.Pascal, "WordFore"];
scintilla.Styles[Style.Pascal.Word].BackColor = lexerColors[LexerType.Pascal, "WordBack"];
// STRING, fontStyle = 0
scintilla.Styles[Style.Pascal.String].ForeColor = lexerColors[LexerType.Pascal, "StringFore"];
scintilla.Styles[Style.Pascal.String].BackColor = lexerColors[LexerType.Pascal, "StringBack"];
// CHARACTER, fontStyle = 0
scintilla.Styles[Style.Pascal.Character].ForeColor = lexerColors[LexerType.Pascal, "CharacterFore"];
scintilla.Styles[Style.Pascal.Character].BackColor = lexerColors[LexerType.Pascal, "CharacterBack"];
// OPERATOR, fontStyle = 1
scintilla.Styles[Style.Pascal.Operator].Bold = true;
scintilla.Styles[Style.Pascal.Operator].ForeColor = lexerColors[LexerType.Pascal, "OperatorFore"];
scintilla.Styles[Style.Pascal.Operator].BackColor = lexerColors[LexerType.Pascal, "OperatorBack"];
// ASM, fontStyle = 1
scintilla.Styles[Style.Pascal.Asm].Bold = true;
scintilla.Styles[Style.Pascal.Asm].ForeColor = lexerColors[LexerType.Pascal, "ForeColorFore"];
scintilla.Styles[Style.Pascal.Asm].BackColor = lexerColors[LexerType.Pascal, "ForeColorBack"];
scintilla.LexerName = "pascal";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Pascal);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,78 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the PHP lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerPhp: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the PHP programming language.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreatePhpLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
//ClearStyle(scintilla);
////..therefore the weird logic.. (which might malfunction)..
//SetPhpStyles(scintilla, lexerColors);
//SetHtmlStyles(scintilla, lexerColors);
//scintilla.LexerName = "phpscript";
////ScintillaKeyWords.SetKeywords(scintilla, LexerType.PHP);
//SetScriptedHtml(LexerType.PHP, scintilla, lexerColors);
//if (foldOn)
// AddFolding(scintilla);
//return true;
ClearStyle(scintilla);
//..therefore the weird logic.. (which might malfunction)..
SetHtmlStyles(scintilla, lexerColors);
SetPhpStyles(scintilla, lexerColors);
SetJSStyles(scintilla, lexerColors);
scintilla.LexerName = "hypertext";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.HTML);
SetScriptedHtml(LexerType.HTML, scintilla, lexerColors);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,146 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the Windows PowerShell lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerPowerShell: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the Windows PowerShell script language.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreatePowerShellLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// DEFAULT, fontStyle = 0, styleId = 0
scintilla.Styles[Style.PowerShell.Default].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "DefaultFore"];
scintilla.Styles[Style.PowerShell.Default].BackColor =
lexerColors[LexerType.WindowsPowerShell, "DefaultBack"];
// COMMENT, fontStyle = 0, styleId = 1
scintilla.Styles[Style.PowerShell.Comment].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "CommentFore"];
scintilla.Styles[Style.PowerShell.Comment].BackColor =
lexerColors[LexerType.WindowsPowerShell, "CommentBack"];
// STRING, fontStyle = 0, styleId = 2
scintilla.Styles[Style.PowerShell.String].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "StringFore"];
scintilla.Styles[Style.PowerShell.String].BackColor =
lexerColors[LexerType.WindowsPowerShell, "StringBack"];
// CHARACTER, fontStyle = 0, styleId = 3
scintilla.Styles[Style.PowerShell.Character].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "CharacterFore"];
scintilla.Styles[Style.PowerShell.Character].BackColor =
lexerColors[LexerType.WindowsPowerShell, "CharacterBack"];
// NUMBER, fontStyle = 0, styleId = 4
scintilla.Styles[Style.PowerShell.Number].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "NumberFore"];
scintilla.Styles[Style.PowerShell.Number].BackColor =
lexerColors[LexerType.WindowsPowerShell, "NumberBack"];
// VARIABLE, fontStyle = 1, styleId = 5
scintilla.Styles[Style.PowerShell.Variable].Bold = true;
scintilla.Styles[Style.PowerShell.Variable].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "VariableFore"];
scintilla.Styles[Style.PowerShell.Variable].BackColor =
lexerColors[LexerType.WindowsPowerShell, "VariableBack"];
// OPERATOR, fontStyle = 1, styleId = 6
scintilla.Styles[Style.PowerShell.Operator].Bold = true;
scintilla.Styles[Style.PowerShell.Operator].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "OperatorFore"];
scintilla.Styles[Style.PowerShell.Operator].BackColor =
lexerColors[LexerType.WindowsPowerShell, "OperatorBack"];
// INSTRUCTION WORD, fontStyle = 1, styleId = 8
scintilla.Styles[Style.PowerShell.Keyword].Bold = true;
scintilla.Styles[Style.PowerShell.Keyword].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "InstructionWordFore"];
scintilla.Styles[Style.PowerShell.Keyword].BackColor =
lexerColors[LexerType.WindowsPowerShell, "InstructionWordBack"];
// CMDLET, fontStyle = 0, styleId = 9
scintilla.Styles[Style.PowerShell.Cmdlet].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "CommandletFore"];
scintilla.Styles[Style.PowerShell.Cmdlet].BackColor =
lexerColors[LexerType.WindowsPowerShell, "CommandletBack"];
// ALIAS, fontStyle = 0, styleId = 10
scintilla.Styles[Style.PowerShell.Alias].ForeColor = lexerColors[LexerType.WindowsPowerShell, "AliasFore"];
scintilla.Styles[Style.PowerShell.Alias].BackColor = lexerColors[LexerType.WindowsPowerShell, "AliasBack"];
// COMMENT STREAM, fontStyle = 0, styleId = 13
scintilla.Styles[Style.PowerShell.CommentStream].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "CommentStreamFore"];
scintilla.Styles[Style.PowerShell.CommentStream].BackColor =
lexerColors[LexerType.WindowsPowerShell, "CommentStreamBack"];
// HERE STRING, fontStyle = 0, styleId = 14
scintilla.Styles[Style.PowerShell.HereString].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "HereStringFore"];
scintilla.Styles[Style.PowerShell.HereString].BackColor =
lexerColors[LexerType.WindowsPowerShell, "HereStringBack"];
// HERE CHARACTER, fontStyle = 0, styleId = 15
scintilla.Styles[Style.PowerShell.HereCharacter].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "HereCharacterFore"];
scintilla.Styles[Style.PowerShell.HereCharacter].BackColor =
lexerColors[LexerType.WindowsPowerShell, "HereCharacterBack"];
// COMMENT DOC KEYWORD, fontStyle = 1, styleId = 16
scintilla.Styles[Style.PowerShell.CommentDocKeyword].Bold = true;
scintilla.Styles[Style.PowerShell.CommentDocKeyword].ForeColor =
lexerColors[LexerType.WindowsPowerShell, "CommentDocKeywordFore"];
scintilla.Styles[Style.PowerShell.CommentDocKeyword].BackColor =
lexerColors[LexerType.WindowsPowerShell, "CommentDocKeywordBack"];
ScintillaKeyWords.SetKeywords(scintilla, LexerType.WindowsPowerShell);
scintilla.LexerName = "powershell";
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,120 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the Python lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerPython: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the Python programming language.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreatePythonLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// DEFAULT, fontStyle = 0, styleId = 0
scintilla.Styles[Style.Python.Default].ForeColor = lexerColors[LexerType.Python, "DefaultFore"];
scintilla.Styles[Style.Python.Default].BackColor = lexerColors[LexerType.Python, "DefaultBack"];
// COMMENTLINE, fontStyle = 0, styleId = 1
scintilla.Styles[Style.Python.CommentLine].ForeColor = lexerColors[LexerType.Python, "CommentLineFore"];
scintilla.Styles[Style.Python.CommentLine].BackColor = lexerColors[LexerType.Python, "CommentLineBack"];
// NUMBER, fontStyle = 0, styleId = 2
scintilla.Styles[Style.Python.Number].ForeColor = lexerColors[LexerType.Python, "NumberFore"];
scintilla.Styles[Style.Python.Number].BackColor = lexerColors[LexerType.Python, "NumberBack"];
// STRING, fontStyle = 0, styleId = 3
scintilla.Styles[Style.Python.String].ForeColor = lexerColors[LexerType.Python, "StringFore"];
scintilla.Styles[Style.Python.String].BackColor = lexerColors[LexerType.Python, "StringBack"];
// CHARACTER, fontStyle = 0, styleId = 4
scintilla.Styles[Style.Python.Character].ForeColor = lexerColors[LexerType.Python, "CharacterFore"];
scintilla.Styles[Style.Python.Character].BackColor = lexerColors[LexerType.Python, "CharacterBack"];
// KEYWORDS, fontStyle = 1, styleId = 5
scintilla.Styles[Style.Python.Word].Bold = true;
scintilla.Styles[Style.Python.Word].ForeColor = lexerColors[LexerType.Python, "WordFore"];
scintilla.Styles[Style.Python.Word].BackColor = lexerColors[LexerType.Python, "WordBack"];
// TRIPLE, fontStyle = 0, styleId = 6
scintilla.Styles[Style.Python.Triple].ForeColor = lexerColors[LexerType.Python, "TripleFore"];
scintilla.Styles[Style.Python.Triple].BackColor = lexerColors[LexerType.Python, "TripleBack"];
// TRIPLEDOUBLE, fontStyle = 0, styleId = 7
scintilla.Styles[Style.Python.TripleDouble].ForeColor = lexerColors[LexerType.Python, "TripleDoubleFore"];
scintilla.Styles[Style.Python.TripleDouble].BackColor = lexerColors[LexerType.Python, "TripleDoubleBack"];
// CLASSNAME, fontStyle = 1, styleId = 8
scintilla.Styles[Style.Python.ClassName].Bold = true;
scintilla.Styles[Style.Python.ClassName].ForeColor = lexerColors[LexerType.Python, "ClassNameFore"];
scintilla.Styles[Style.Python.ClassName].BackColor = lexerColors[LexerType.Python, "ClassNameBack"];
// DEFNAME, fontStyle = 0, styleId = 9
scintilla.Styles[Style.Python.DefName].ForeColor = lexerColors[LexerType.Python, "DefNameFore"];
scintilla.Styles[Style.Python.DefName].BackColor = lexerColors[LexerType.Python, "DefNameBack"];
// OPERATOR, fontStyle = 1, styleId = 10
scintilla.Styles[Style.Python.Operator].Bold = true;
scintilla.Styles[Style.Python.Operator].ForeColor = lexerColors[LexerType.Python, "OperatorFore"];
scintilla.Styles[Style.Python.Operator].BackColor = lexerColors[LexerType.Python, "OperatorBack"];
// IDENTIFIER, fontStyle = 0, styleId = 11
scintilla.Styles[Style.Python.Identifier].ForeColor = lexerColors[LexerType.Python, "IdentifierFore"];
scintilla.Styles[Style.Python.Identifier].BackColor = lexerColors[LexerType.Python, "IdentifierBack"];
// COMMENTBLOCK, fontStyle = 0, styleId = 12
scintilla.Styles[Style.Python.CommentBlock].ForeColor = lexerColors[LexerType.Python, "CommentBlockFore"];
scintilla.Styles[Style.Python.CommentBlock].BackColor = lexerColors[LexerType.Python, "CommentBlockBack"];
// DECORATOR, fontStyle = 2, styleId = 15
scintilla.Styles[Style.Python.Decorator].Italic = true;
scintilla.Styles[Style.Python.Decorator].ForeColor = lexerColors[LexerType.Python, "DecoratorFore"];
scintilla.Styles[Style.Python.Decorator].BackColor = lexerColors[LexerType.Python, "DecoratorBack"];
scintilla.LexerName = "python";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Python);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,97 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the SQL lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerSql: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the Structured Query Language (SQL).
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateSqlLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// KEYWORD, fontStyle = 1
scintilla.Styles[Style.Sql.Word].Bold = true;
scintilla.Styles[Style.Sql.Word].ForeColor = lexerColors[LexerType.SQL, "WordFore"];
scintilla.Styles[Style.Sql.Word].BackColor = lexerColors[LexerType.SQL, "WordBack"];
// NUMBER, fontStyle = 0
scintilla.Styles[Style.Sql.Number].ForeColor = lexerColors[LexerType.SQL, "NumberFore"];
scintilla.Styles[Style.Sql.Number].BackColor = lexerColors[LexerType.SQL, "NumberBack"];
// STRING, fontStyle = 0
scintilla.Styles[Style.Sql.String].ForeColor = lexerColors[LexerType.SQL, "StringFore"];
scintilla.Styles[Style.Sql.String].BackColor = lexerColors[LexerType.SQL, "StringBack"];
// STRING2, fontStyle = 0
scintilla.Styles[Style.Sql.Character].ForeColor =
lexerColors[LexerType.SQL, "CharacterFore"];
scintilla.Styles[Style.Sql.Character].BackColor =
lexerColors[LexerType.SQL, "CharacterBack"];
// OPERATOR, fontStyle = 1
scintilla.Styles[Style.Sql.Operator].Bold = true;
scintilla.Styles[Style.Sql.Operator].ForeColor =
lexerColors[LexerType.SQL, "OperatorFore"];
scintilla.Styles[Style.Sql.Operator].BackColor =
lexerColors[LexerType.SQL, "OperatorBack"];
// COMMENT, fontStyle = 0
scintilla.Styles[Style.Sql.Comment].ForeColor = lexerColors[LexerType.SQL, "CommentFore"];
scintilla.Styles[Style.Sql.Comment].BackColor = lexerColors[LexerType.SQL, "CommentBack"];
// COMMENT LINE, fontStyle = 0
scintilla.Styles[Style.Sql.CommentLine].ForeColor =
lexerColors[LexerType.SQL, "CommentLineFore"];
scintilla.Styles[Style.Sql.CommentLine].BackColor =
lexerColors[LexerType.SQL, "CommentLineBack"];
scintilla.LexerName = "sql";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.SQL);
LexerFoldProperties.SetScintillaProperties(scintilla, LexerFoldProperties.SqlFolding);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,96 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the Batch lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerVb: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the batch script file.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateVbLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// DEFAULT, fontStyle = 0, styleId = 7
scintilla.Styles[Style.Vb.Default].ForeColor = lexerColors[LexerType.VbDotNet, "DefaultFore"];
scintilla.Styles[Style.Vb.Default].BackColor = lexerColors[LexerType.VbDotNet, "DefaultBack"];
// COMMENT, fontStyle = 0, styleId = 1
scintilla.Styles[Style.Vb.Comment].ForeColor = lexerColors[LexerType.VbDotNet, "CommentFore"];
scintilla.Styles[Style.Vb.Comment].BackColor = lexerColors[LexerType.VbDotNet, "CommentBack"];
// NUMBER, fontStyle = 1, styleId = 2
scintilla.Styles[Style.Vb.Number].Bold = true;
scintilla.Styles[Style.Vb.Number].ForeColor = lexerColors[LexerType.VbDotNet, "NumberFore"];
scintilla.Styles[Style.Vb.Number].BackColor = lexerColors[LexerType.VbDotNet, "NumberBack"];
// WORD, fontStyle = 0, styleId = 3
scintilla.Styles[Style.Vb.Keyword].ForeColor = lexerColors[LexerType.VbDotNet, "WordFore"];
scintilla.Styles[Style.Vb.Keyword].BackColor = lexerColors[LexerType.VbDotNet, "WordBack"];
// WORD2, fontStyle = 0, styleId = 10
scintilla.Styles[Style.Vb.Keyword2].ForeColor = lexerColors[LexerType.VbDotNet, "Word2Fore"];
scintilla.Styles[Style.Vb.Keyword2].BackColor = lexerColors[LexerType.VbDotNet, "Word2Back"];
// STRING, fontStyle = 0, styleId = 4
scintilla.Styles[Style.Vb.String].ForeColor = lexerColors[LexerType.VbDotNet, "StringFore"];
scintilla.Styles[Style.Vb.String].BackColor = lexerColors[LexerType.VbDotNet, "StringBack"];
// PREPROCESSOR, fontStyle = 0, styleId = 5
scintilla.Styles[Style.Vb.Preprocessor].ForeColor = lexerColors[LexerType.VbDotNet, "PreprocessorFore"];
scintilla.Styles[Style.Vb.Preprocessor].BackColor = lexerColors[LexerType.VbDotNet, "PreprocessorBack"];
// OPERATOR, fontStyle = 1, styleId = 6
scintilla.Styles[Style.Vb.Operator].Bold = true;
scintilla.Styles[Style.Vb.Operator].ForeColor = lexerColors[LexerType.VbDotNet, "OperatorFore"];
scintilla.Styles[Style.Vb.Operator].BackColor = lexerColors[LexerType.VbDotNet, "OperatorBack"];
// DATE, fontStyle = 0, styleId = 8
scintilla.Styles[Style.Vb.Date].ForeColor = lexerColors[LexerType.VbDotNet, "DateFore"];
scintilla.Styles[Style.Vb.Date].BackColor = lexerColors[LexerType.VbDotNet, "DateBack"];
scintilla.LexerName = "vb";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.VbDotNet);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,135 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
using VPKSoft.ScintillaLexers.LexerColors;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the XML lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerXml: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the XML (The eXtensible Markup Language).
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateXmlLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
// XMLSTART, fontStyle = 0
scintilla.Styles[Style.Xml.XmlStart].ForeColor =
lexerColors[LexerType.Xml, "XmlStartFore"];
scintilla.Styles[Style.Xml.XmlStart].BackColor =
lexerColors[LexerType.Xml, "XmlStartBack"];
// XMLEND, fontStyle = 0
scintilla.Styles[Style.Xml.XmlEnd].ForeColor = lexerColors[LexerType.Xml, "XmlEndFore"];
scintilla.Styles[Style.Xml.XmlEnd].BackColor = lexerColors[LexerType.Xml, "XmlEndBack"];
// DEFAULT, fontStyle = 1
scintilla.Styles[Style.Xml.Default].Bold = true;
scintilla.Styles[Style.Xml.Default].ForeColor = lexerColors[LexerType.Xml, "DefaultFore"];
scintilla.Styles[Style.Xml.Default].BackColor = lexerColors[LexerType.Xml, "DefaultBack"];
// COMMENT, fontStyle = 0
scintilla.Styles[Style.Xml.Comment].ForeColor = lexerColors[LexerType.Xml, "CommentFore"];
scintilla.Styles[Style.Xml.Comment].BackColor = lexerColors[LexerType.Xml, "CommentBack"];
// NUMBER, fontStyle = 0
scintilla.Styles[Style.Xml.Number].ForeColor = lexerColors[LexerType.Xml, "NumberFore"];
scintilla.Styles[Style.Xml.Number].BackColor = lexerColors[LexerType.Xml, "NumberBack"];
// DOUBLESTRING, fontStyle = 1
scintilla.Styles[Style.Xml.DoubleString].Bold = true;
scintilla.Styles[Style.Xml.DoubleString].ForeColor =
lexerColors[LexerType.Xml, "DoubleStringFore"];
scintilla.Styles[Style.Xml.DoubleString].BackColor =
lexerColors[LexerType.Xml, "DoubleStringBack"];
// SINGLESTRING, fontStyle = 1
scintilla.Styles[Style.Xml.SingleString].Bold = true;
scintilla.Styles[Style.Xml.SingleString].ForeColor =
lexerColors[LexerType.Xml, "SingleStringFore"];
scintilla.Styles[Style.Xml.SingleString].BackColor =
lexerColors[LexerType.Xml, "SingleStringBack"];
// TAG, fontStyle = 0
scintilla.Styles[Style.Xml.Tag].ForeColor = lexerColors[LexerType.Xml, "TagFore"];
scintilla.Styles[Style.Xml.Tag].BackColor = lexerColors[LexerType.Xml, "TagBack"];
// TAGEND, fontStyle = 0
scintilla.Styles[Style.Xml.TagEnd].ForeColor = lexerColors[LexerType.Xml, "TagEndFore"];
scintilla.Styles[Style.Xml.TagEnd].BackColor = lexerColors[LexerType.Xml, "TagEndBack"];
// TAGUNKNOWN, fontStyle = 0
scintilla.Styles[Style.Xml.TagUnknown].ForeColor =
lexerColors[LexerType.Xml, "TagUnknownFore"];
scintilla.Styles[Style.Xml.TagUnknown].BackColor =
lexerColors[LexerType.Xml, "TagUnknownBack"];
// ATTRIBUTE, fontStyle = 0
scintilla.Styles[Style.Xml.Attribute].ForeColor =
lexerColors[LexerType.Xml, "AttributeFore"];
scintilla.Styles[Style.Xml.Attribute].BackColor =
lexerColors[LexerType.Xml, "AttributeBack"];
// ATTRIBUTEUNKNOWN, fontStyle = 0
scintilla.Styles[Style.Xml.AttributeUnknown].ForeColor =
lexerColors[LexerType.Xml, "AttributeUnknownFore"];
scintilla.Styles[Style.Xml.AttributeUnknown].BackColor =
lexerColors[LexerType.Xml, "AttributeUnknownBack"];
// SGMLDEFAULT, fontStyle = 0
scintilla.Styles[21].ForeColor = lexerColors[LexerType.Xml, "SgmlDefaultFore"];
scintilla.Styles[21].BackColor = lexerColors[LexerType.Xml, "SgmlDefaultBack"];
// CDATA, fontStyle = 0
scintilla.Styles[Style.Xml.CData].ForeColor = lexerColors[LexerType.Xml, "CDataFore"];
scintilla.Styles[Style.Xml.CData].BackColor = lexerColors[LexerType.Xml, "CDataBack"];
// ENTITY, fontStyle = 2
scintilla.Styles[Style.Xml.Entity].Italic = true;
scintilla.Styles[Style.Xml.Entity].ForeColor = lexerColors[LexerType.Xml, "EntityFore"];
scintilla.Styles[Style.Xml.Entity].BackColor = lexerColors[LexerType.Xml, "EntityBack"];
scintilla.LexerName = "xml";
// folding for a XML lexer..
LexerFoldProperties.SetScintillaProperties(scintilla, LexerFoldProperties.XmlFolding);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,120 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ScintillaNET;
using VPKSoft.ScintillaLexers.HelperClasses;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class for the YAML lexer.
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
/// </summary>
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
public class CreateLexerYaml: CreateLexerCommon
{
/// <summary>
/// Creates the lexer for a given Scintilla class instance for the YAML (YAML Ain't Markup Language).
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
/// <returns>True if the operation was successful; otherwise false.</returns>
public static bool CreateYamlLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
{
ClearStyle(scintilla);
#region YAML_CONSTANTS
const int SCE_YAML_DEFAULT = 0;
const int SCE_YAML_COMMENT = 1;
const int SCE_YAML_IDENTIFIER = 2;
const int SCE_YAML_KEYWORD = 3;
const int SCE_YAML_NUMBER = 4;
const int SCE_YAML_REFERENCE = 5;
const int SCE_YAML_DOCUMENT = 6;
const int SCE_YAML_TEXT = 7;
const int SCE_YAML_ERROR = 8;
const int SCE_YAML_OPERATOR = 9;
#endregion
// DEFAULT, fontStyle = 0
scintilla.Styles[SCE_YAML_DEFAULT].ForeColor = lexerColors[LexerType.YAML, "YamlDefaultFore"];
scintilla.Styles[SCE_YAML_DEFAULT].BackColor = lexerColors[LexerType.YAML, "YamlDefaultBack"];
// COMMENT, fontStyle = 1
scintilla.Styles[SCE_YAML_COMMENT].ForeColor = lexerColors[LexerType.YAML, "CommentFore"];
scintilla.Styles[SCE_YAML_COMMENT].BackColor = lexerColors[LexerType.YAML, "CommentBack"];
// IDENTIFIER, fontStyle = 2
scintilla.Styles[SCE_YAML_IDENTIFIER].Bold = true;
scintilla.Styles[SCE_YAML_IDENTIFIER].ForeColor = lexerColors[LexerType.YAML, "IdentifierFore"];
scintilla.Styles[SCE_YAML_IDENTIFIER].BackColor = lexerColors[LexerType.YAML, "IdentifierBack"];
// KEYWORD, fontStyle = 3
scintilla.Styles[SCE_YAML_KEYWORD].Bold = true;
scintilla.Styles[SCE_YAML_KEYWORD].ForeColor = lexerColors[LexerType.YAML, "KeywordFore"];
scintilla.Styles[SCE_YAML_KEYWORD].BackColor = lexerColors[LexerType.YAML, "KeywordBack"];
// NUMBER, fontStyle = 4
scintilla.Styles[SCE_YAML_NUMBER].ForeColor = lexerColors[LexerType.YAML, "NumberFore"];
scintilla.Styles[SCE_YAML_NUMBER].BackColor = lexerColors[LexerType.YAML, "NumberBack"];
// REFERENCE, fontStyle = 5
scintilla.Styles[SCE_YAML_REFERENCE].ForeColor = lexerColors[LexerType.YAML, "ReferenceFore"];
scintilla.Styles[SCE_YAML_REFERENCE].BackColor = lexerColors[LexerType.YAML, "ReferenceBack"];
// DOCUMENT, fontStyle = 6
scintilla.Styles[SCE_YAML_DOCUMENT].ForeColor = lexerColors[LexerType.YAML, "DocumentFore"];
scintilla.Styles[SCE_YAML_DOCUMENT].BackColor = lexerColors[LexerType.YAML, "DocumentBack"];
// TEXT, fontStyle = 7
scintilla.Styles[SCE_YAML_TEXT].Bold = true;
scintilla.Styles[SCE_YAML_TEXT].ForeColor = lexerColors[LexerType.YAML, "TextFore"];
scintilla.Styles[SCE_YAML_TEXT].BackColor = lexerColors[LexerType.YAML, "TextBack"];
// ERROR, fontStyle = 8
scintilla.Styles[SCE_YAML_ERROR].ForeColor = lexerColors[LexerType.YAML, "ErrorFore"];
scintilla.Styles[SCE_YAML_ERROR].BackColor = lexerColors[LexerType.YAML, "ErrorBack"];
// OPERATOR, fontStyle = 9
scintilla.Styles[SCE_YAML_OPERATOR].ForeColor = lexerColors[LexerType.YAML, "OperatorFore"];
scintilla.Styles[SCE_YAML_OPERATOR].BackColor = lexerColors[LexerType.YAML, "OperatorBack"];
scintilla.LexerName = "yaml";
ScintillaKeyWords.SetKeywords(scintilla, LexerType.YAML);
if (foldOn)
AddFolding(scintilla);
return true;
}
}
}
@@ -0,0 +1,134 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System.Collections.Generic;
using ScintillaNET;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
{
/// <summary>
/// A class containing code folding properties for different lexers.
/// </summary>
public class LexerFoldProperties
{
/// <summary>
/// Gets or sets the name of the fold property.
/// </summary>
/// <value>The name of the fold property.</value>
public string FoldPropertyName { get; set; }
/// <summary>
/// Gets or sets the fold property value.
/// </summary>
/// <value>The fold property value.</value>
public string FoldPropertyValue { get; set; }
/// <summary>
/// Gets or sets the default folding properties for all lexers.
/// </summary>
public static List<LexerFoldProperties> DefaultFolding { get; set; } = new List<LexerFoldProperties>(new[]
{
new LexerFoldProperties {FoldPropertyName = "fold", FoldPropertyValue = "1"},
new LexerFoldProperties {FoldPropertyName = "fold.compact", FoldPropertyValue = "1"},
new LexerFoldProperties {FoldPropertyName = "fold.preprocessor", FoldPropertyValue = "1"},
});
/// <summary>
/// Gets or sets the additional folding properties for the XML (eXtensible Markup Language) lexer.
/// </summary>
public static List<LexerFoldProperties> XmlFolding { get; set; } = new List<LexerFoldProperties>(new[]
{
new LexerFoldProperties {FoldPropertyName = "fold.html", FoldPropertyValue = "1"},
new LexerFoldProperties {FoldPropertyName = "html.tags.case.sensitive", FoldPropertyValue = "1"},
});
/// <summary>
/// Gets or sets the additional folding properties for the SQL (Structured Query Language) lexer.
/// </summary>
public static List<LexerFoldProperties> SqlFolding { get; set; } = new List<LexerFoldProperties>(new[]
{
new LexerFoldProperties {FoldPropertyName = "fold.sql.at.else", FoldPropertyValue = "1"}, // for a SQL lexer..
new LexerFoldProperties {FoldPropertyName = "fold.comment", FoldPropertyValue = "1"}, // for a SQL lexer..
new LexerFoldProperties {FoldPropertyName = "sql.backslash.escapes", FoldPropertyValue = "1"}, // for a SQL lexer.. (Enables backslash as an escape character in SQL.)
new LexerFoldProperties {FoldPropertyName = "lexer.sql.numbersign.comment", FoldPropertyValue = "1"}, // for a SQL lexer.. (If lexer.sql.numbersign.comment property is set to 0 a line beginning with '#' will not be a comment.)
new LexerFoldProperties {FoldPropertyName = "lexer.sql.allow.dotted.word", FoldPropertyValue = "1"}, // for a SQL lexer.. (set to 1 to colorize recognized words with dots (recommended for Oracle PL/SQL objects))
});
/// <summary>
/// Gets or sets the additional folding properties for the HTML (Hypertext Markup Language) lexer.
/// </summary>
public static List<LexerFoldProperties> HyperTextFolding { get; set; } = new List<LexerFoldProperties>(new[]
{
new LexerFoldProperties {FoldPropertyName = "fold.hypertext.comment", FoldPropertyValue = "1"},
new LexerFoldProperties {FoldPropertyName = "fold.hypertext.heredoc", FoldPropertyValue = "1"},
new LexerFoldProperties {FoldPropertyName = "fold.html.preprocessor", FoldPropertyValue = "1"},
new LexerFoldProperties {FoldPropertyName = "fold.html", FoldPropertyValue = "1"},
});
/// <summary>
/// Sets the <see cref="Scintilla"/> properties.
/// </summary>
/// <param name="scintilla">The <see cref="Scintilla"/> instance of which properties to set.</param>
/// <param name="foldProperties">A list of fold properties.</param>
public static void SetScintillaProperties(Scintilla scintilla, List<LexerFoldProperties> foldProperties)
{
foreach (var foldProperty in foldProperties)
{
scintilla.SetProperty(foldProperty.FoldPropertyName, foldProperty.FoldPropertyValue);
}
}
/// <summary>
/// Sets the default folding for all lexers.
/// </summary>
/// <param name="scintilla">The <see cref="Scintilla"/> instance of which default folding properties to set.</param>
public static void FoldDefault(Scintilla scintilla)
{
SetScintillaProperties(scintilla, DefaultFolding);
}
/// <summary>
/// Sets the fold properties to a given lexer type.
/// </summary>
/// <param name="scintilla">The <see cref="Scintilla"/> of which fold properties to set.</param>
/// <param name="lexerType">Type of the lexer.</param>
public static void SetFoldProperties(Scintilla scintilla, LexerType lexerType)
{
switch (lexerType)
{
case LexerType.HTML:
SetScintillaProperties(scintilla, HyperTextFolding); break;
case LexerType.SQL:
SetScintillaProperties(scintilla, SqlFolding); break;
case LexerType.Xml:
SetScintillaProperties(scintilla, XmlFolding); break;
default:
SetScintillaProperties(scintilla, DefaultFolding); break;
}
}
}
}
@@ -0,0 +1,46 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaNET;
namespace VPKSoft.ScintillaLexers
{
/// <summary>
/// A class to set the basic font style for the <see cref="Scintilla"/>.
/// </summary>
public static class GlobalScintillaFont
{
/// <summary>
/// Gets or sets the size of the font for the <see cref="Scintilla"/> controls.
/// </summary>
public static int FontSize { get; set; } = 10;
/// <summary>
/// Gets or sets the name of the font family for the <see cref="Scintilla"/> controls.
/// </summary>
public static string FontFamilyName { get; set; } = "Consolas";
}
}
@@ -0,0 +1,205 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.HelperClasses
{
/// <summary>
/// A class containing lexer known file extensions for different lexers.
/// </summary>
public class LexerFileExtensions
{
/// <summary>
/// Gets or sets the type of the lexer.
/// </summary>
public LexerType LexerType { get; set; }
/// <summary>
/// Gets or sets the file extension list for a lexer.
/// </summary>
public string FileExtensionList { get; set; }
/// <summary>
/// A list of strings used to detect if a file by it's starting contents is a XML file.
/// </summary>
public static List<string> XmlFileDetectionStrings = new List<string>(
new []{"<?xml "}
);
/// <summary>
/// Gets a value indicating if the given file is an XML file.
/// There are so many different extensions for XML files so it's better to peek inside the file if necessary.
/// </summary>
/// <param name="fileName">Name of the file to check for being a XML file.</param>
/// <returns></returns>
public static bool IsXmlFile(string fileName)
{
string ext = Path.GetExtension(fileName)?.ToLowerInvariant();
var extensions = FileExtensions.FirstOrDefault(f => f.FileExtensionList.ToLowerInvariant().Split(' ').Contains(ext));
if (extensions != null && // first through extensions as it is faster..
extensions.LexerType == LexerType.Xml)
{
return true;
}
try
{
using (var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite))
{
using (var textReader = new StreamReader(fileStream))
{
var bufferSize = XmlFileDetectionStrings.Max(f => f.Length);
var buffer = new char[bufferSize];
textReader.ReadBlock(buffer, 0, bufferSize);
var stringBuilder = new StringBuilder();
stringBuilder.Append(buffer);
var compareString = stringBuilder.ToString();
foreach (var xmlFileDetectionString in XmlFileDetectionStrings)
{
if (compareString.StartsWith(xmlFileDetectionString, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
}
}
catch
{
return false;
}
}
/// <summary>
/// Gets or sets the value whether to peek inside to a file to check if the file is a XML file.
/// </summary>
public static bool DetectXmlFileFromFileContents { get; set; } = true;
/// <summary>
/// Gets or sets the file extensions for specified lexers.
/// </summary>
public static List<LexerFileExtensions> FileExtensions { get; set; } = new List<LexerFileExtensions>(new []
{
// File extensions for XML files.
new LexerFileExtensions { LexerType = LexerType.Xml, FileExtensionList = ".xml .xaml .xsl .xslt .xsd .xul .kml .svg .mxml .xsml .wsdl .xlf " +
".xliff .xbl .sxbl .sitemap .gml .gpx .plist .resx .csproj .nuspec" },
// File extensions for C# files.
new LexerFileExtensions { LexerType = LexerType.Cs, FileExtensionList = ".cs" },
// File extensions for C++ files.
new LexerFileExtensions { LexerType = LexerType.Cpp, FileExtensionList = ".h .hpp .hxx .cpp .cxx .cc .ino" },
// File extensions for SQL files.
new LexerFileExtensions { LexerType = LexerType.SQL, FileExtensionList = ".sql .sql_script" },
// File extensions for a batch file.
new LexerFileExtensions { LexerType = LexerType.Batch, FileExtensionList = ".bat .cmd .btm .nt" },
// File extensions for plain text files.
new LexerFileExtensions { LexerType = LexerType.Text, FileExtensionList = ".txt" },
// File extensions for the NSIS (Nullsoft Scriptable Install System).
new LexerFileExtensions { LexerType = LexerType.Nsis, FileExtensionList = ".nsi .nsh" },
// File extensions for the Inno Setup programming language.
new LexerFileExtensions { LexerType = LexerType.InnoSetup, FileExtensionList = ".iss" },
// File extensions for the Pascal programming language.
new LexerFileExtensions { LexerType = LexerType.Pascal, FileExtensionList = ".pas" },
// File extensions for the PHP programming language.
new LexerFileExtensions { LexerType = LexerType.PHP, FileExtensionList = ".php3 .phtml .php" },
// File extensions for the HTML markup language.
new LexerFileExtensions { LexerType = LexerType.HTML, FileExtensionList = ".html .htm .shtml .shtm .xhtml .xht .hta" },
// File extensions for the Windows PowerShell script files.
new LexerFileExtensions { LexerType = LexerType.WindowsPowerShell, FileExtensionList = ".ps1 .psd1 .psm1" },
// File extensions for the INI setting files.
new LexerFileExtensions { LexerType = LexerType.INI, FileExtensionList = ".ini" },
// File extension for the Python programming language files.
new LexerFileExtensions { LexerType = LexerType.Python, FileExtensionList = ".py .pyw" },
// File extension for the YAML (YAML Ain't Markup Language) language files.
new LexerFileExtensions { LexerType = LexerType.Python, FileExtensionList = ".yml .yaml" },
// File extension for the Java programming language.
new LexerFileExtensions { LexerType = LexerType.Java, FileExtensionList = ".java" },
// File extension for the JavaScript scripting language.
new LexerFileExtensions { LexerType = LexerType.JavaScript, FileExtensionList = ".js .mjs" },
// File extension for the Cascading Style Sheets (CSS).
new LexerFileExtensions { LexerType = LexerType.Css, FileExtensionList = ".css" },
// File extensions for the Visual Basic .NET programming language.
new LexerFileExtensions { LexerType = LexerType.VbDotNet, FileExtensionList = ".vb" },
// File extensions for the JavaScript Object Notation (Json) data format.
new LexerFileExtensions { LexerType = LexerType.Json, FileExtensionList = ".json" },
// new LexerFileExtensions { LexerType = LexerType.xxx, FileExtensionList = "" },
});
/// <summary>
/// Gets a lexer type from a given file name.
/// </summary>
/// <param name="fileName">Name of the file from which to get the lexer type from.</param>
/// <returns>A LexerType enumeration value.</returns>
public static LexerType LexerTypeFromFileName(string fileName)
{
string ext = Path.GetExtension(fileName)?.ToLowerInvariant();
var extensions = FileExtensions.FirstOrDefault(f => f.FileExtensionList.ToLowerInvariant().Split(' ').Contains(ext));
if (extensions != null)
{
return extensions.LexerType;
}
if (DetectXmlFileFromFileContents && IsXmlFile(fileName))
{
return LexerType.Xml;
}
return LexerType.Unknown;
}
}
}
@@ -0,0 +1,94 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using ScintillaNET;
namespace VPKSoft.ScintillaLexers.HelperClasses
{
/// <summary>
/// A helper class for Class LexerTypeName.
/// </summary>
public class LexerTypeName
{
/// <summary>
/// The NSIS (Nullsoft Scriptable Install System) lexer value.
/// </summary>
public const int SCLEX_NSIS = 43;
/// <summary>
/// The Inno Setup lexer value.
/// </summary>
public const int SCLEX_INNOSETUP = 76;
/// <summary>
/// The YAML (YAML Ain't Markup Language) lexer value.
/// </summary>
public const int SCLEX_YAML = 48;
/// <summary>
/// A list of currently supported lexers by this library.
/// </summary>
public static readonly List<Tuple<LexerEnumerations.LexerType, string,string>> LexerTypeNameList = new List<Tuple<LexerEnumerations.LexerType, string,string>>(
new[]
{
Tuple.Create(LexerEnumerations.LexerType.Unknown, "text","Text"),
Tuple.Create(LexerEnumerations.LexerType.Cs, "cs", "C#"),
Tuple.Create(LexerEnumerations.LexerType.Cpp, "cpp", "C++"),
Tuple.Create(LexerEnumerations.LexerType.Xml, "xml", "XML"),
Tuple.Create(LexerEnumerations.LexerType.Text, "text", "Text"),
Tuple.Create(LexerEnumerations.LexerType.Nsis, "nsis", "Nsis"),
Tuple.Create(LexerEnumerations.LexerType.InnoSetup, "inno", "InnoSetup"),
Tuple.Create(LexerEnumerations.LexerType.SQL, "sql", "SQL"),
Tuple.Create(LexerEnumerations.LexerType.Batch, "batch", "Batch"),
Tuple.Create(LexerEnumerations.LexerType.Pascal, "pascal", "Pascal"),
Tuple.Create(LexerEnumerations.LexerType.PHP, "php", "PHP"),
Tuple.Create(LexerEnumerations.LexerType.WindowsPowerShell, "powershell", "PowerShell"),
Tuple.Create(LexerEnumerations.LexerType.INI, "ini", "INI"),
Tuple.Create(LexerEnumerations.LexerType.Python, "python", "Python"),
Tuple.Create(LexerEnumerations.LexerType.YAML, "yaml", "YAML"),
Tuple.Create(LexerEnumerations.LexerType.Java, "java", "Java"),
Tuple.Create(LexerEnumerations.LexerType.Css, "css", "Css"),
Tuple.Create(LexerEnumerations.LexerType.VbDotNet, "vb", "VB.Net"),
Tuple.Create(LexerEnumerations.LexerType.Json, "json", "Json"),
Tuple.Create(LexerEnumerations.LexerType.HTML, "html", "HTML"),
Tuple.Create(LexerEnumerations.LexerType.JavaScript, "javascript", "JavaScript"),
});
/// <summary>
/// Gets the name of the lexer XML used in Notepad++'s XML style files.
/// </summary>
/// <param name="lexerType">Type of the lexer.</param>
/// <returns>The name of the lexer used in Notepad++'s XML style files if successful; otherwise "text".</returns>
public static string GetLexerXmlName(LexerEnumerations.LexerType lexerType)
{
var result = LexerTypeNameList.FirstOrDefault(f => f.Item1 == lexerType);
return result == null ? "text" : result.Item2;
}
}
}
@@ -0,0 +1,154 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using ScintillaNET;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
namespace VPKSoft.ScintillaLexers.HelperClasses
{
/// <summary>
/// A class for <see cref="Scintilla"/> keywords for different lexers.
/// </summary>
public class ScintillaKeyWords
{
/// <summary>
/// Gets or sets the index of the key word set.
/// </summary>
public int KeyWordSetIndex { get; set; }
/// <summary>
/// Gets or sets the key words belonging to a keyword set.
/// </summary>
public string KeyWords { get; set; }
/// <summary>
/// Gets or sets the type of the lexer of the keyword set.
/// </summary>
public LexerType LexerType { get; set; }
/// <summary>
/// Sets the keywords for a given <see cref="Scintilla"/> instance with a given <see cref="LexerType"/>.
/// </summary>
/// <param name="scintilla">The scintilla instance which keywords to set.</param>
/// <param name="lexerType">Type of the lexer.</param>
public static void SetKeywords(Scintilla scintilla, LexerType lexerType)
{
var keyWords = KeyWordList.Where(f => f.LexerType == lexerType).OrderBy(f => f.KeyWordSetIndex);
foreach (var keyWord in keyWords)
{
scintilla.SetKeywords(keyWord.KeyWordSetIndex, keyWord.KeyWords);
}
}
/// <summary>
/// Gets or sets the key word list containing specific keywords for different lexer types.
/// </summary>
public static List<ScintillaKeyWords> KeyWordList { get; set; } = new List<ScintillaKeyWords>(new []
{
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.Cs, KeyWords = "abstract add alias as ascending async await base break case catch checked continue default delegate descending do dynamic else event explicit extern false finally fixed for foreach from get global goto group if implicit in interface internal into is join let lock namespace new null object operator orderby out override params partial private protected public readonly ref remove return sealed select set sizeof stackalloc switch this throw true try typeof unchecked unsafe using value virtual where while yield"},
new ScintillaKeyWords {KeyWordSetIndex = 1, LexerType = LexerType.Cs, KeyWords = "Int64 DateTime List bool byte char class const decimal double enum float int long sbyte short static string struct uint ulong ushort var void"},
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.Batch, KeyWords = "assoc aux break call cd chcp chdir choice cls cmdextversion color com com1 com2 com3 com4 con copy country ctty date defined del dir do dpath echo else endlocal erase errorlevel exist exit for ftype goto if in loadfix loadhigh lpt lpt1 lpt2 lpt3 lpt4 md mkdir move not nul path pause popd prn prompt pushd rd rem ren rename rmdir set setlocal shift start time title type ver verify vol"}, // Name: instre1
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.Cpp, KeyWords = "alignof and and_eq bitand bitor break case catch compl const_cast continue default delete do dynamic_cast else false for goto if namespace new not not_eq nullptr operator or or_eq reinterpret_cast return sizeof static_assert static_cast switch this throw true try typedef typeid using while xor xor_eq NULL"},
new ScintillaKeyWords {KeyWordSetIndex = 1, LexerType = LexerType.Cpp, KeyWords = "alignas asm auto bool char char16_t char32_t class clock_t const constexpr decltype double enum explicit export extern final float friend inline int int8_t int16_t int32_t int64_t int_fast8_t int_fast16_t int_fast32_t int_fast64_t intmax_t intptr_t long mutable noexcept override private protected ptrdiff_t public register short signed size_t ssize_t static struct template thread_local time_t typename uint8_t uint16_t uint32_t uint64_t uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t uintmax_t uintptr_t union unsigned virtual void volatile wchar_t"},
new ScintillaKeyWords {KeyWordSetIndex = 2, LexerType = LexerType.Cpp, KeyWords = "a addindex addtogroup anchor arg attention author authors b brief bug c callergraph callgraph category cite class code cond copybrief copydetails copydoc copyright date def defgroup deprecated details diafile dir docbookonly dontinclude dot dotfile e else elseif em endcode endcond enddocbookonly enddot endhtmlonly endif endinternal endlatexonly endlink endmanonly endmsc endparblock endrtfonly endsecreflist enduml endverbatim endxmlonly enum example exception extends f$ f[ f] file fn f{ f} headerfile hidecallergraph hidecallgraph hideinitializer htmlinclude htmlonly idlexcept if ifnot image implements include includelineno ingroup interface internal invariant latexinclude latexonly li line link mainpage manonly memberof msc mscfile n name namespace nosubgrouping note overload p package page par paragraph param parblock post pre private privatesection property protected protectedsection protocol public publicsection pure ref refitem related relatedalso relates relatesalso remark remarks result return returns retval rtfonly sa secreflist section see short showinitializer since skip skipline snippet startuml struct subpage subsection subsubsection tableofcontents test throw throws todo tparam typedef union until var verbatim verbinclude version vhdlflow warning weakgroup xmlonly xrefitem"},
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.HTML, KeyWords = "!doctype a abbr accept accept-charset accesskey acronym action address align alink alt applet archive area article aside async audio autocomplete autofocus axis b background base basefont bdi bdo bgcolor bgsound big blink blockquote body border br button canvas caption cellpadding cellspacing center char charoff charset checkbox checked cite class classid clear code codebase codetype col colgroup color cols colspan command compact content contenteditable contextmenu coords data datafld dataformatas datalist datapagesize datasrc datetime dd declare defer del details dfn dialog dir disabled div dl draggable dropzone dt element em embed enctype event face fieldset figcaption figure file font footer for form formaction formenctype formmethod formnovalidate formtarget frame frameborder frameset h1 h2 h3 h4 h5 h6 head header headers height hgroup hidden hr href hreflang hspace html http-equiv i id iframe image img input ins isindex ismap kbd keygen label lang language leftmargin legend li link list listing longdesc main manifest map marginheight marginwidth mark marquee max maxlength media menu menuitem meta meter method min multicol multiple name nav nobr noembed noframes nohref noresize noscript noshade novalidate nowrap object ol onabort onafterprint onautocomplete onautocompleteerror onbeforeonload onbeforeprint onblur oncancel oncanplay oncanplaythrough onchange onclick onclose oncontextmenu oncuechange ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended onerror onfocus onhashchange oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart onmessage onmousedown onmouseenter onmouseleave onmousemove onmouseout onmouseover onmouseup onmousewheel onoffline ononline onpagehide onpageshow onpause onplay onplaying onpointercancel onpointerdown onpointerenter onpointerleave onpointerlockchange onpointerlockerror onpointermove onpointerout onpointerover onpointerup onpopstate onprogress onratechange onreadystatechange onredo onreset onresize onscroll onseeked onseeking onselect onshow onsort onstalled onstorage onsubmit onsuspend ontimeupdate ontoggle onundo onunload onvolumechange onwaiting optgroup option output p param password pattern picture placeholder plaintext pre profile progress prompt public q radio readonly rel required reset rev reversed role rows rowspan rp rt rtc ruby rules s samp sandbox scheme scope scoped script seamless section select selected shadow shape size sizes small source spacer span spellcheck src srcdoc standby start step strike strong style sub submit summary sup svg svg:svg tabindex table target tbody td template text textarea tfoot th thead time title topmargin tr track tt type u ul usemap valign value valuetype var version video vlink vspace wbr width xml xmlns xmp"}, // Name: instre1
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.Nsis, KeyWords = "Abort AddBrandingImage AddSize AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText BringToFront Call CallInstDLL Caption ChangeUI CheckBitmap ClearErrors CompletedText ComponentText CopyFiles CRCCheck CreateDirectory CreateFont CreateShortCut Delete DeleteINISec DeleteINIStr DeleteRegKey DeleteRegValue DetailPrint DetailsButtonText DirText DirVar DirVerify EnableWindow EnumRegKey EnumRegValue Exch Exec ExecShell ExecWait ExpandEnvStrings File FileBufSize FileClose FileErrorText FileOpen FileRead FileReadByte FileReadUTF16LE FileSeek FileWrite FileWriteByte FileWriteUTF16LE FindClose FindFirst FindNext FindWindow FlushINI Function FunctionEnd GetCurInstType GetCurrentAddress GetDlgItem GetDLLVersion GetDLLVersionLocal GetErrorLevel GetExeName GetExePath GetFileTime GetFileTimeLocal GetFullPathName GetFunctionAddress GetInstDirError GetLabelAddress GetTempFileName Goto HideWindow Icon IfAbort IfErrors IfFileExists IfRebootFlag IfSilent InitPluginsDir InstallButtonText InstallColors InstallDir InstallDirRegKey InstProgressFlags InstType InstTypeGetText InstTypeSetText IntCmp IntCmpU IntFmt IntOp IsWindow LangString LangStringUP LicenseBkColor LicenseData LicenseForceSelection LicenseLangString LicenseText LoadLanguageFile LockWindow LogSet LogText ManifestDPIAware ManifestSupportedOS MessageBox MiscButtonText Nop Name OutFile Page PageEx PageExEnd PluginDir Pop Push Quit ReadEnvStr ReadINIStr ReadRegDWORD ReadRegStr Reboot RegDLL Rename RequestExecutionLevel ReserveFile Return RMDir SearchPath Section SectionEnd SectionGetFlags SectionGetInstTypes SectionGetSize SectionGetText SectionGroup SectionGroupEnd SectionIn SectionSetFlags SectionSetInstTypes SectionSetSize SectionSetText SendMessage SetAutoClose SetBrandingImage SetCompress SetCompressionLevel SetCompressor SetCompressorDictSize SetCtlColors SetCurInstType SetDatablockOptimize SetDateSave SetDetailsPrint SetDetailsView SetErrorLevel SetErrors SetFileAttributes SetFont SetOutPath SetOverwrite SetPluginUnload SetRebootFlag SetRegView SetShellVarContext SetSilent SetStaticBkColor ShowInstDetails ShowUninstDetails ShowWindow SilentInstall SilentUnInstall Sleep SpaceTexts StrCmp StrCmpS StrCpy StrLen SubSection SubSectionEnd Unicode UninstallButtonText UninstallCaption UninstallIcon UninstallSubCaption UninstallText UninstPage UnRegDLL UnsafeStrCpy Var VIAddVersionKey VIFileVersion VIProductVersion WindowIcon WriteINIStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegStr WriteUninstaller XPStyle !AddIncludeDir !AddPluginDir !appendfile !cd !define !delfile !echo !else !endif !error !execute !finalize !getdllversion !if !ifdef !ifmacrodef !ifmacrondef !ifndef !include !insertmacro !macro !macroend !macroundef !packhdr !searchparse !searchreplace !system !tempfile !undef !verbose !warning"}, // Name: instre1
new ScintillaKeyWords {KeyWordSetIndex = 1, LexerType = LexerType.Nsis, KeyWords = @"$0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $R0 $R1 $R2 $R3 $R4 $R5 $R6 $R7 $R8 $R9 $ADMINTOOLS $APPDATA $CDBURN_AREA $CMDLINE $COMMONFILES $COMMONFILES32 $COMMONFILES64 $COOKIES $DESKTOP $DOCUMENTS $EXEDIR $EXEFILE $EXEPATH $FAVORITES $FONTS $HISTORY $HWNDPARENT $INTERNET_CACHE $INSTDIR $LANGUAGE $LOCALAPPDATA $MUSIC $NETHOOD ${NSISDIR} $OUTDIR $PICTURES $PLUGINSDIR $PRINTHOOD $PROFILE $PROGRAMFILES $PROGRAMFILES32 $PROGRAMFILES64 $QUICKLAUNCH $RECENT $RESOURCES $RESOURCES_LOCALIZED $SENDTO $SMPROGRAMS $SMSTARTUP $STARTMENU $SYSDIR $TEMP $TEMPLATES $VIDEOS $WINDIR $$ $\n $\r $\t"}, // Name: instre2
new ScintillaKeyWords {KeyWordSetIndex = 2, LexerType = LexerType.Nsis, KeyWords = "ARCHIVE CUR END FILE_ATTRIBUTE_ARCHIVE FILE_ATTRIBUTE_HIDDEN FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_OFFLINE FILE_ATTRIBUTE_READONLY FILE_ATTRIBUTE_SYSTEM FILE_ATTRIBUTE_TEMPORARY HIDDEN HKCC HKCR HKCU HKDD HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER HKEY_DYN_DATA HKEY_LOCAL_MACHINE HKEY_PERFORMANCE_DATA HKEY_USERS HKLM HKPD HKU IDABORT IDCANCEL IDIGNORE IDNO IDOK IDRETRY IDYES MB_ABORTRETRYIGNORE MB_DEFBUTTON1 MB_DEFBUTTON2 MB_DEFBUTTON3 MB_DEFBUTTON4 MB_ICONEXCLAMATION MB_ICONINFORMATION MB_ICONQUESTION MB_ICONSTOP MB_OK MB_OKCANCEL MB_RETRYCANCEL MB_RIGHT MB_SETFOREGROUND MB_TOPMOST MB_USERICON MB_YESNO MB_YESNOCANCEL NORMAL OFFLINE READONLY SET SHCTX SW_HIDE SW_SHOWMAXIMIZED SW_SHOWMINIMIZED SW_SHOWNORMAL SYSTEM TEMPORARY all auto both bottom bzip2 checkbox colored current false force hide ifdiff ifnewer lastused leave left listonly lzma nevershow none normal off on pop push radiobuttons right show silent silentlog smooth textonly top true try zlib"}, // Name: type1
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.InnoSetup, KeyWords = "setup files code types languages messages custommessages components tasks dirs icons ini installdelete langoptions registry run uninstalldelete uninstallrun" },
new ScintillaKeyWords {KeyWordSetIndex = 1, LexerType = LexerType.InnoSetup, KeyWords = @"closeapplicationsfilter restartapplications closeapplications allowcancelduringinstall allownoicons allowrootdirectory allowuncpath alwaysrestart alwaysshowcomponentslist alwaysshowdironreadypage alwaysshowgrouponreadypage alwaysusepersonalgroup appcopyright appenddefaultdirname appenddefaultgroupname appcomments appcontact appid appmodifypath appmutex appname apppublisher apppublisherurl appreadmefile appsupportphone appsupporturl appupdatesurl appvername appversion architecturesallowed architecturesinstallin64bitmode aslrcompatible backcolor backcolor2 backcolordirection backsolid changesassociations changesenvironment compression compressionthreads createappdir createuninstallregkey defaultdialogfontname defaultdirname defaultgroupname defaultuserinfoname defaultuserinfoorg defaultuserinfoserial depcompatible direxistswarning disabledirpage disablefinishedpage disableprogramgrouppage disablereadymemo disablereadypage disablestartupprompt disablewelcomepage diskclustersize diskslicesize diskspanning dontmergeduplicatefiles enabledirdoesntexistwarning encryption extradiskspacerequired flatcomponentslist infoafterfile infobeforefile internalcompresslevel languagedetectionmethod licensefile lzmaalgorithm lzmablocksize lzmadictionarysize lzmamatchfinder lzmanumblockthreads lzmanumfastbytes lzmauseseparateprocess mergeduplicatefiles messagesfile minversion onlybelowversion output outputbasefilename outputdir outputmanifestfile password privilegesrequired privilegesrequiredoverridesallowed reservebytes restartifneededbyrun setupiconfile setuplogging setupmutex showcomponentsizes showlanguagedialog showtaskstreelines showundisplayablelanguages signeduninstaller signeduninstallerdir signtool signtoolminimumtimebetween signtoolretrycount signtoolretrydelay slicesperdisk solidcompression sourcedir terminalservicesaware timestamprounding timestampsinutc touchdate touchtime updateuninstalllogappname uninstallable uninstalldisplayicon uninstalldisplayname uninstalldisplaysize uninstallfilesdir uninstalliconfile uninstalllogmode uninstallrestartcomputer uninstallstyle useduserareaswarning usepreviousappdir usepreviousgroup usepreviouslanguage usepreviousprivileges useprevioussetuptype useprevioustasks useprevioususerinfo usesetupldr userinfopageused versioninfocompany versioninfocopyright versioninfodescription versioninfooriginalfilename versioninfoproductname versioninfoproductversion versioninfoproducttextversion versioninfotextversion versioninfoversion windowresizable windowshowcaption windowstartmaximized windowvisible wizardimagealphaformat wizardimagebackcolor wizardimagefile wizardimagestretch wizardsmallimagebackcolor wizardresizable wizardsizepercent wizardsmallimagefile wizardstyle graphicalinstallerui visualui copyrightfontname copyrightfontsize dialogfontname dialogfontsize dialogfontstandardheight languagecodepage languageid languagename righttoleft titlefontname titlefontsize welcomefontname welcomefontsize" },
new ScintillaKeyWords {KeyWordSetIndex = 2, LexerType = LexerType.InnoSetup, KeyWords = @"{app} {autoappdata} {autocf} {autocf32} {autocf64} {autodesktop} {autodocs} {autopf} {autopf32} {autopf64} {autoprograms} {autostartmenu} {autostartup} {autotemplates} {commoncf} {commoncf32} {commoncf64} {cm:} {cmd} {commonappdata} {commondesktop} {commondocs} {commonpf32} {commonpf64} {commonprograms} {commonstartmenu} {commonstartup} {commontemplates} {computername} {dao} {dotnet11} {dotnet20} {dotnet2032} {dotnet2064} {dotnet40} {dotnet4032} {dotnet4064} {drive:} {fonts} {group} {groupname} {hwnd} {ini:} {language} {localappdata} {log} {param:} {commonpf} {reg:} {sd} {src} {srcexe} {sys} {sysnative} {sysuserinfoname} {sysuserinfoorg} {syswow64} {tmp} {uninstallexe} {userappdata} {userdesktop} {userdocs} {userfavorites} {userinfoname} {userinfoorg} {userinfoserial} {username} {userprograms} {usersendto} {userstartmenu} {userstartup} {usertemplates} {win} {wizardhwnd} 32bit 64bit allowunsafefiles arm64 comparetimestamp confirmoverwrite createallsubdirs deleteafterinstall dontcopy dontverifychecksum fontisnttruetype gacinstall ignoreversion isreadme nocompression notcontentindexed noencryption noregerror onlyifdestfileexists onlyifdoesntexist overwritereadonly promptifolder recursesubdirs regserver regtypelib replacesameversion restartreplace setntfscompression sharedfile skipifsourcedoesntexist solidbreak sortfilesbyextension sortfilesbyname touch uninsneveruninstall uninsnosharedfileprompt uninsremovereadonly uninsrestartdelete unsetntfscompression none string expandsz multisz dword qword binary hka hkcr hkcu hklm hku hkcc preventpinning excludefromshowinnewinstall sign signonce" },
new ScintillaKeyWords {KeyWordSetIndex = 3, LexerType = LexerType.InnoSetup, KeyWords = @"define dim redim undef include file emit expr insert append if elif else endif ifdef ifndef ifexist ifnexist for sub endsub pragma error" },
new ScintillaKeyWords {KeyWordSetIndex = 4, LexerType = LexerType.InnoSetup, KeyWords = "and array as begin case const div do downto else end except external finally for function goto if in is label mod nil not of or procedure program record repeat set shl shr then to try type until var while with xor backbuttonclick cancelbuttonclick checkpassword checkserial curpagechanged curstepchanged curuninstallstepchanged deinitializesetup deinitializeuninstall getcustomsetupexitcode initializesetup initializeuninstall initializeuninstallprogressform initializewizard needrestart nextbuttonclick preparetoinstall registerpreviousdata shouldskippage uninstallneedrestart updatereadymemo" },
new ScintillaKeyWords {KeyWordSetIndex = 5, LexerType = LexerType.InnoSetup, KeyWords = "afterinstall appusermodelid attribs beforeinstall check comment copymode description destdir destname excludes externalsize filename flags fontinstall groupdescription hotkey iconfilename iconindex key name parameters permissions root runonceid section source statusmsg string strongassemblyname subkey type valuedata valuename valuetype verb workingdir" },
/* Inno Setup keywords with CaSE senSItiVITy and special characters
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.InnoSetup, KeyWords = "[Setup] [Files] [Code] [Types] [Languages] [Messages] [CustomMessages] [Components] [Tasks] [Dirs] [Icons] [INI] [InstallDelete] [LangOptions] [Registry] [Run] [UninstallDelete] [UninstallRun]" },
new ScintillaKeyWords {KeyWordSetIndex = 1, LexerType = LexerType.InnoSetup, KeyWords = @"CloseApplicationsFilter RestartApplications CloseApplications AllowCancelDuringInstall AllowNoIcons AllowRootDirectory AllowUNCPath AlwaysRestart AlwaysShowComponentsList AlwaysShowDirOnReadyPage AlwaysShowGroupOnReadyPage AlwaysUsePersonalGroup AppCopyright AppendDefaultDirName AppendDefaultGroupName AppComments AppContact AppId AppModifyPath AppMutex AppName AppPublisher AppPublisherURL AppReadmeFile AppSupportPhone AppSupportURL AppUpdatesURL AppVerName AppVersion ArchitecturesAllowed ArchitecturesInstallIn64BitMode ASLRCompatible BackColor BackColor2 BackColorDirection BackSolid ChangesAssociations ChangesEnvironment Compression CompressionThreads CreateAppDir CreateUninstallRegKey DefaultDialogFontName DefaultDirName DefaultGroupName DefaultUserInfoName DefaultUserInfoOrg DefaultUserInfoSerial DEPCompatible DirExistsWarning DisableDirPage DisableFinishedPage DisableProgramGroupPage DisableReadyMemo DisableReadyPage DisableStartupPrompt DisableWelcomePage DiskClusterSize DiskSliceSize DiskSpanning DontMergeDuplicateFiles EnableDirDoesntExistWarning Encryption ExtraDiskSpaceRequired FlatComponentsList InfoAfterFile InfoBeforeFile InternalCompressLevel LanguageDetectionMethod LicenseFile LZMAAlgorithm LZMABlockSize LZMADictionarySize LZMAMatchFinder LZMANumBlockThreads LZMANumFastBytes LZMAUseSeparateProcess MergeDuplicateFiles MessagesFile MinVersion OnlyBelowVersion Output OutputBaseFilename OutputDir OutputManifestFile Password PrivilegesRequired PrivilegesRequiredOverridesAllowed ReserveBytes RestartIfNeededByRun SetupIconFile SetupLogging SetupMutex ShowComponentSizes ShowLanguageDialog ShowTasksTreeLines ShowUndisplayableLanguages SignedUninstaller SignedUninstallerDir SignTool SignToolMinimumTimeBetween SignToolRetryCount SignToolRetryDelay SlicesPerDisk SolidCompression SourceDir TerminalServicesAware TimeStampRounding TimeStampsInUTC TouchDate TouchTime UpdateUninstallLogAppName Uninstallable UninstallDisplayIcon UninstallDisplayName UninstallDisplaySize UninstallFilesDir UninstallIconFile UninstallLogMode UninstallRestartComputer UninstallStyle UsedUserAreasWarning UsePreviousAppDir UsePreviousGroup UsePreviousLanguage UsePreviousPrivileges UsePreviousSetupType UsePreviousTasks UsePreviousUserInfo UseSetupLdr UserInfoPageUsed VersionInfoCompany VersionInfoCopyright VersionInfoDescription VersionInfoOriginalFileName VersionInfoProductName VersionInfoProductVersion VersionInfoProductTextVersion VersionInfoTextVersion VersionInfoVersion WindowResizable WindowShowCaption WindowStartMaximized WindowVisible WizardImageAlphaFormat WizardImageBackColor WizardImageFile WizardImageStretch WizardSmallImageBackColor WizardResizable WizardSizePercent WizardSmallImageFile WizardStyle GraphicalInstallerUI VisualUI CopyrightFontName CopyrightFontSize DialogFontName DialogFontSize DialogFontStandardHeight LanguageCodePage LanguageID LanguageName RightToLeft TitleFontName TitleFontSize WelcomeFontName WelcomeFontSize" },
new ScintillaKeyWords {KeyWordSetIndex = 2, LexerType = LexerType.InnoSetup, KeyWords = @"{app} {autoappdata} {autocf} {autocf32} {autocf64} {autodesktop} {autodocs} {autopf} {autopf32} {autopf64} {autoprograms} {autostartmenu} {autostartup} {autotemplates} {commoncf} {commoncf32} {commoncf64} {cm:} {cmd} {commonappdata} {commondesktop} {commondocs} {commonpf32} {commonpf64} {commonprograms} {commonstartmenu} {commonstartup} {commontemplates} {computername} {dao} {dotnet11} {dotnet20} {dotnet2032} {dotnet2064} {dotnet40} {dotnet4032} {dotnet4064} {drive:} {fonts} {group} {groupname} {hwnd} {ini:} {language} {localappdata} {log} {param:} {commonpf} {reg:} {sd} {src} {srcexe} {sys} {sysnative} {sysuserinfoname} {sysuserinfoorg} {syswow64} {tmp} {uninstallexe} {userappdata} {userdesktop} {userdocs} {userfavorites} {userinfoname} {userinfoorg} {userinfoserial} {username} {userprograms} {usersendto} {userstartmenu} {userstartup} {usertemplates} {win} {wizardhwnd} 32bit 64bit allowunsafefiles arm64 comparetimestamp confirmoverwrite createallsubdirs deleteafterinstall dontcopy dontverifychecksum fontisnttruetype gacinstall ignoreversion isreadme nocompression notcontentindexed noencryption noregerror onlyifdestfileexists onlyifdoesntexist overwritereadonly promptifolder recursesubdirs regserver regtypelib replacesameversion restartreplace setntfscompression sharedfile skipifsourcedoesntexist solidbreak sortfilesbyextension sortfilesbyname touch uninsneveruninstall uninsnosharedfileprompt uninsremovereadonly uninsrestartdelete unsetntfscompression none string expandsz multisz dword qword binary HKA HKCR HKCU HKLM HKU HKCC preventpinning excludefromshowinnewinstall sign signonce" },
new ScintillaKeyWords {KeyWordSetIndex = 3, LexerType = LexerType.InnoSetup, KeyWords = @"#define #dim #redim #undef #include #file #emit #expr #insert #append #if #elif #else #endif #ifdef #ifndef #ifexist #ifnexist #for #sub #endsub #pragma #error" },
new ScintillaKeyWords {KeyWordSetIndex = 4, LexerType = LexerType.InnoSetup, KeyWords = "and array as begin case const div do downto else end except external finally for function goto if in is label mod nil not of or procedure program record repeat set shl shr then to try type until var while with xor BackButtonClick CancelButtonClick CheckPassword CheckSerial CurPageChanged CurStepChanged CurUninstallStepChanged DeinitializeSetup DeinitializeUninstall GetCustomSetupExitCode InitializeSetup InitializeUninstall InitializeUninstallProgressForm InitializeWizard NeedRestart NextButtonClick PrepareToInstall RegisterPreviousData ShouldSkipPage UninstallNeedRestart UpdateReadyMemo" },
new ScintillaKeyWords {KeyWordSetIndex = 5, LexerType = LexerType.InnoSetup, KeyWords = "AfterInstall AppUserModelID Attribs BeforeInstall Check Comment CopyMode Description DestDir DestName Excludes ExternalSize Filename Flags FontInstall GroupDescription HotKey IconFilename IconIndex Key Name Parameters Permissions Root RunOnceId Section Source StatusMsg String StrongAssemblyName Subkey Type ValueData ValueName ValueType Verb WorkingDir" },
*/
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.Pascal, KeyWords = "and array asm begin case cdecl class const constructor default destructor div do downto else end end. except exit exports external far file finalization finally for function goto if implementation in index inherited initialization inline interface label library message mod near nil not object of on or out overload override packed pascal private procedure program property protected public published raise read record register repeat resourcestring safecall set shl shr stdcall stored string then threadvar to try type unit until uses var virtual while with write xor"}, // Name: instre1
new ScintillaKeyWords {KeyWordSetIndex = 4, LexerType = LexerType.PHP, KeyWords = // Name: instre1
"function public private __autoload __class__ __compiler_halt_offset__ __construct __destruct __dir__ __file__ __function__ __halt_compiler __line__ __method__ __namespace__ __sleep __trait__ __wakeup _cookie _files _get _post abday_1 abday_2 abday_3 abday_4 abday_5 abday_6 abday_7 abmon_1 abmon_10 abmon_11 abmon_12 abmon_2 abmon_3 abmon_4 abmon_5 abmon_6 abmon_7 abmon_8 abmon_9 abs abstract acos acosh addcslashes addslashes af_inet af_inet6 af_unix al_bits al_buffer al_channels al_cone_inner_angle al_cone_outer_angle al_cone_outer_gain al_direction al_false al_format_mono16 al_format_mono8 al_format_stereo16 al_format_stereo8 al_frequency al_gain al_initial al_looping al_max_distance al_max_gain al_min_gain al_orientation al_paused al_pitch al_playing al_position al_reference_distance al_rolloff_factor al_size al_source_relative al_source_state al_stopped al_true al_velocity alc_frequency alc_refresh alc_sync alt_digits am_str and apache_child_terminate apache_get_modules apache_get_version apache_getenv apache_lookup_uri apache_map apache_note apache_request_headers apache_reset_timeout apache_response_headers apache_setenv apc_add apc_bin_dump apc_bin_dumpfile apc_bin_load apc_bin_loadfile apc_bin_verify_crc32 apc_bin_verify_md5 apc_cache_info apc_cas apc_clear_cache apc_compile_file apc_dec apc_define_constants apc_delete apc_delete_file apc_exists apc_fetch apc_inc apc_iter_all apc_iter_atime apc_iter_ctime apc_iter_device apc_iter_dtime apc_iter_filename apc_iter_inode apc_iter_key apc_iter_md5 apc_iter_mem_size apc_iter_mtime apc_iter_none apc_iter_num_hits apc_iter_refcount apc_iter_ttl apc_iter_type apc_iter_value apc_list_active apc_list_deleted apc_load_constants apc_sma_info apc_store apd_breakpoint apd_callstack apd_clunk apd_continue apd_croak apd_dump_function_table apd_dump_persistent_resources apd_dump_regular_resources apd_echo apd_get_active_symbols apd_set_pprof_trace apd_set_session apd_set_session_trace apd_set_session_trace_socket apd_version args_trace array array_change_key_case array_chunk array_column array_combine array_count_values array_diff array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill array_fill_keys array_filter array_filter_use_both array_filter_use_key array_flip array_intersect array_intersect_assoc array_intersect_key array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map array_merge array_merge_recursive array_multisort array_pad array_pop array_product array_push array_rand array_reduce array_replace array_replace_recursive array_reverse array_search array_shift array_slice array_sort array_splice array_sum array_udiff array_udiff_assoc array_udiff_uassoc array_uintersect array_uintersect_assoc array_uintersect_uassoc array_unique array_unshift array_values array_walk array_walk_recursive arrayaccess arrayiterator arrayobject arsort as asin asinh asort assert assert_active assert_bail assert_callback assert_options assert_quiet_eval assert_warning assignment_trace atan atan2 atanh base64_decode base64_encode base_convert basename bbcode_add_element bbcode_add_smiley bbcode_arg_double_quote bbcode_arg_html_quote bbcode_arg_quote_escaping bbcode_arg_single_quote bbcode_auto_correct bbcode_correct_reopen_tags bbcode_create bbcode_default_smileys_off bbcode_default_smileys_on bbcode_destroy bbcode_disable_tree_build bbcode_flags_arg_parsing bbcode_flags_cdata_not_allowed bbcode_flags_deny_reopen_child bbcode_flags_one_open_per_level bbcode_flags_remove_if_empty bbcode_flags_smileys_off bbcode_flags_smileys_on bbcode_force_smileys_off bbcode_parse bbcode_set_arg_parser bbcode_set_flags bbcode_set_flags_add bbcode_set_flags_remove bbcode_set_flags_set bbcode_smileys_case_insensitive bbcode_type_arg bbcode_type_noarg bbcode_type_optarg bbcode_type_root bbcode_type_single bcadd bccomp bcdiv bcmod bcmul bcompiler_load bcompiler_load_exe bcompiler_parse_class bcompiler_read bcompiler_write_class bcompiler_write_constant bcompiler_write_exe_footer bcompiler_write_file bcompiler_write_footer bcompiler_write_function bcompiler_write_functions_from_file bcompiler_write_header bcompiler_write_included_filename bcpow bcpowmod bcscale bcsqrt bcsub bin2hex bind_textdomain_codeset bindec bindtextdomain blenc_encrypt blenc_ext_version bool boolean boolval break bson_decode bson_encode bus_adraln bus_adrerr bus_objerr bzclose bzcompress bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite cairo_antialias_default cairo_antialias_gray cairo_antialias_none cairo_antialias_subpixel cairo_content_alpha cairo_content_color cairo_content_color_alpha cairo_create cairo_extend_none cairo_extend_pad cairo_extend_reflect cairo_extend_repeat cairo_fill_rule_even_odd cairo_fill_rule_winding cairo_filter_best cairo_filter_bilinear cairo_filter_fast cairo_filter_gaussian cairo_filter_good cairo_filter_nearest cairo_font_face_get_type cairo_font_face_status cairo_font_options_create cairo_font_options_equal cairo_fon Line truncated
"cairo_svg_version_to_string cal_days_in_month cal_dow_dayno cal_dow_long cal_dow_short cal_easter_always_gregorian cal_easter_always_julian cal_easter_default cal_easter_roman cal_french cal_from_jd cal_gregorian cal_info cal_jewish cal_jewish_add_alafim cal_jewish_add_alafim_geresh cal_jewish_add_gereshayim cal_julian cal_month_french cal_month_gregorian_long cal_month_gregorian_short cal_month_jewish cal_month_julian_long cal_month_julian_short cal_num_cals cal_to_jd calcul_hmac calculhmac call_user_func call_user_func_array call_user_method call_user_method_array callable case case_lower case_upper catch ceil cfunction char_max chdb_create chdir checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split cl_expunge class class_alias class_exists class_implements class_parents class_uses cld_continued cld_dumped cld_exited cld_killed cld_stopped cld_trapped clearstatcache cli_get_process_title cli_set_process_title clone closedir closelog clsctx_all clsctx_inproc_handler clsctx_inproc_server clsctx_local_server clsctx_remote_server clsctx_server codeset collator_asort collator_compare collator_create collator_get_attribute collator_get_error_code collator_get_error_message collator_get_locale collator_get_sort_key collator_get_strength collator_set_attribute collator_set_strength collator_sort collator_sort_with_sort_keys com_create_guid com_event_sink com_get com_get_active_object com_invoke com_load com_load_typelib com_message_pump com_print_typeinfo com_propget com_propput com_set compact connection_aborted connection_normal connection_status connection_timeout const constant continue convert_cyr_string convert_uudecode convert_uuencode copy cos cosh count count_chars count_normal count_recursive cp_acp cp_maccp cp_move cp_oemcp cp_symbol cp_thread_acp cp_uid cp_utf7 cp_utf8 crc32 create_function credits_all credits_docs credits_fullpage credits_general credits_group credits_modules credits_qa credits_sapi crncystr crypt crypt_blowfish crypt_ext_des crypt_md5 crypt_salt_length crypt_sha256 crypt_sha512 crypt_std_des ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_graph ctype_lower ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit cubrid_affected_rows cubrid_assoc cubrid_async cubrid_autocommit_false cubrid_autocommit_true cubrid_bind cubrid_both cubrid_client_encoding cubrid_close cubrid_close_prepare cubrid_close_request cubrid_col_get cubrid_col_size cubrid_column_names cubrid_column_types cubrid_commit cubrid_connect cubrid_connect_with_url cubrid_current_oid cubrid_cursor_current cubrid_cursor_error cubrid_cursor_first cubrid_cursor_last cubrid_cursor_success cubrid_data_seek cubrid_db_name cubrid_disconnect cubrid_drop cubrid_errno cubrid_error cubrid_error_code cubrid_error_code_facility cubrid_error_msg cubrid_exec_query_all cubrid_execute cubrid_facility_cas cubrid_facility_cci cubrid_facility_client cubrid_facility_dbms cubrid_fetch cubrid_fetch_array cubrid_fetch_assoc cubrid_fetch_field cubrid_fetch_lengths cubrid_fetch_object cubrid_fetch_row cubrid_field_flags cubrid_field_len cubrid_field_name cubrid_field_seek cubrid_field_table cubrid_field_type cubrid_free_result cubrid_get cubrid_get_autocommit cubrid_get_charset cubrid_get_class_name cubrid_get_client_info cubrid_get_db_parameter cubrid_get_query_timeout cubrid_get_server_info cubrid_include_oid cubrid_insert_id cubrid_is_instance cubrid_list_dbs cubrid_lob cubrid_lob2_bind cubrid_lob2_close cubrid_lob2_export cubrid_lob2_import cubrid_lob2_new cubrid_lob2_read cubrid_lob2_seek cubrid_lob2_seek64 cubrid_lob2_size cubrid_lob2_size64 cubrid_lob2_tell cubrid_lob2_tell64 cubrid_lob2_write cubrid_lob_close cubrid_lob_export cubrid_lob_get cubrid_lob_send cubrid_lob_size cubrid_lock_read cubrid_lock_write cubrid_move_cursor cubrid_next_result cubrid_no_more_data cubrid_num cubrid_num_cols cubrid_num_fields cubrid_num_rows cubrid_object cubrid_param_isolation_level cubrid_param_lock_timeout cubrid_pconnect cubrid_pconnect_with_url cubrid_ping cubrid_prepare cubrid_put cubrid_query cubrid_real_escape_string cubrid_result cubrid_rollback cubrid_sch_attr_privilege cubrid_sch_attribute cubrid_sch_class cubrid_sch_class_attribute cubrid_sch_class_method cubrid_sch_class_privilege cubrid_sch_constraint cubrid_sch_cross_reference cubrid_sch_direct_super_class cubrid_sch_exported_keys cubrid_sch_imported_keys cubrid_sch_method cubrid_sch_method_file cubrid_sch_primary_key cubrid_sch_query_spec cubrid_sch_subclass cubrid_sch_superclass cubrid_sch_trigger cubrid_sch_vclass cubrid_schema cubrid_seq_drop cubrid_seq_insert cubrid_seq_put cubrid_set_add cubrid_set_autocommit cubrid_set_db_parameter cubrid_set_drop cubrid_set_query_timeout cubrid_unbuffered_query cubrid_version curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_fnmatchfunc_fail curl_fnmatchfunc_match curl_fnmatchfunc_nomatch curl_getinfo curl_http_version_1_0 curl_http_version_1_1 curl_http_version_2_0 c Line truncated
"curlopt_capath curlopt_certinfo curlopt_closepolicy curlopt_connect_only curlopt_connecttimeout curlopt_connecttimeout_ms curlopt_cookie curlopt_cookiefile curlopt_cookiejar curlopt_cookielist curlopt_cookiesession curlopt_crlf curlopt_crlfile curlopt_customrequest curlopt_dirlistonly curlopt_dns_cache_timeout curlopt_dns_servers curlopt_dns_use_global_cache curlopt_egdsocket curlopt_encoding curlopt_failonerror curlopt_file curlopt_filetime curlopt_fnmatch_function curlopt_followlocation curlopt_forbid_reuse curlopt_fresh_connect curlopt_ftp_account curlopt_ftp_alternative_to_user curlopt_ftp_create_missing_dirs curlopt_ftp_filemethod curlopt_ftp_response_timeout curlopt_ftp_skip_pasv_ip curlopt_ftp_ssl curlopt_ftp_ssl_ccc curlopt_ftp_use_eprt curlopt_ftp_use_epsv curlopt_ftp_use_pret curlopt_ftpappend curlopt_ftpascii curlopt_ftplistonly curlopt_ftpport curlopt_ftpsslauth curlopt_gssapi_delegation curlopt_header curlopt_headerfunction curlopt_http200aliases curlopt_http_content_decoding curlopt_http_transfer_decoding curlopt_http_version curlopt_httpauth curlopt_httpget curlopt_httpheader curlopt_httpproxytunnel curlopt_ignore_content_length curlopt_infile curlopt_infilesize curlopt_interface curlopt_ipresolve curlopt_issuercert curlopt_keypasswd curlopt_krb4level curlopt_krblevel curlopt_localport curlopt_localportrange curlopt_low_speed_limit curlopt_low_speed_time curlopt_mail_auth curlopt_mail_from curlopt_mail_rcpt curlopt_max_recv_speed_large curlopt_max_send_speed_large curlopt_maxconnects curlopt_maxfilesize curlopt_maxredirs curlopt_mute curlopt_netrc curlopt_netrc_file curlopt_new_directory_perms curlopt_new_file_perms curlopt_nobody curlopt_noprogress curlopt_noproxy curlopt_nosignal curlopt_passwdfunction curlopt_password curlopt_port curlopt_post curlopt_postfields curlopt_postquote curlopt_postredir curlopt_prequote curlopt_private curlopt_progressfunction curlopt_protocols curlopt_proxy curlopt_proxy_transfer_mode curlopt_proxyauth curlopt_proxypassword curlopt_proxyport curlopt_proxytype curlopt_proxyusername curlopt_proxyuserpwd curlopt_put curlopt_quote curlopt_random_file curlopt_range curlopt_readdata curlopt_readfunction curlopt_redir_protocols curlopt_referer curlopt_resolve curlopt_resume_from curlopt_returntransfer curlopt_rtsp_client_cseq curlopt_rtsp_request curlopt_rtsp_server_cseq curlopt_rtsp_session_id curlopt_rtsp_stream_uri curlopt_rtsp_transport curlopt_safe_upload curlopt_share curlopt_socks5_gssapi_nec curlopt_socks5_gssapi_service curlopt_ssh_auth_types curlopt_ssh_host_public_key_md5 curlopt_ssh_knownhosts curlopt_ssh_private_keyfile curlopt_ssh_public_keyfile curlopt_ssl_cipher_list curlopt_ssl_options curlopt_ssl_sessionid_cache curlopt_ssl_verifyhost curlopt_ssl_verifypeer curlopt_sslcert curlopt_sslcertpasswd curlopt_sslcerttype curlopt_sslengine curlopt_sslengine_default curlopt_sslkey curlopt_sslkeypasswd curlopt_sslkeytype curlopt_sslversion curlopt_stderr curlopt_tcp_keepalive curlopt_tcp_keepidle curlopt_tcp_keepintvl curlopt_tcp_nodelay curlopt_telnetoptions curlopt_tftp_blksize curlopt_timecondition curlopt_timeout curlopt_timeout_ms curlopt_timevalue curlopt_tlsauth_password curlopt_tlsauth_type curlopt_tlsauth_username curlopt_transfer_encoding curlopt_transfertext curlopt_unrestricted_auth curlopt_upload curlopt_url curlopt_use_ssl curlopt_useragent curlopt_username curlopt_userpwd curlopt_verbose curlopt_wildcardmatch curlopt_writefunction curlopt_writeheader curlpause_all curlpause_cont curlpause_recv curlpause_recv_cont curlpause_send curlpause_send_cont curlproto_all curlproto_dict curlproto_file curlproto_ftp curlproto_ftps curlproto_gopher curlproto_http curlproto_https curlproto_imap curlproto_imaps curlproto_ldap curlproto_ldaps curlproto_pop3 curlproto_pop3s curlproto_rtmp curlproto_rtmpe curlproto_rtmps curlproto_rtmpt curlproto_rtmpte curlproto_rtmpts curlproto_rtsp curlproto_scp curlproto_sftp curlproto_smtp curlproto_smtps curlproto_telnet curlproto_tftp curlproxy_http curlproxy_socks4 curlproxy_socks4a curlproxy_socks5 curlproxy_socks5_hostname curlshopt_none curlshopt_share curlshopt_unshare curlssh_auth_any curlssh_auth_default curlssh_auth_host curlssh_auth_keyboard curlssh_auth_none curlssh_auth_password curlssh_auth_publickey curlsslopt_allow_beast curlusessl_all curlusessl_control curlusessl_none curlusessl_try curlversion_now currency_symbol current cyrus_authenticate cyrus_bind cyrus_callback_noliteral cyrus_callback_numbered cyrus_close cyrus_conn_initialresponse cyrus_conn_nonsyncliteral cyrus_connect cyrus_query cyrus_unbind d_fmt d_t_fmt date date_add date_atom date_cookie date_create date_create_from_format date_create_immutable date_create_immutable_from_format date_date_set date_default_timezone_get date_default_timezone_set date_diff date_format date_get_last_errors date_interval_create_from_date_string date_interval_format date_iso8601 date_isodate_set date_modify date_offset_get date_parse date_parse_from_ Line truncated
"dom_not_supported_err dom_php_err dom_syntax_err dom_validation_err dom_wrong_document_err domstring_size_err double doubleval e_all e_compile_error e_compile_warning e_core_error e_core_warning e_deprecated e_error e_notice e_parse e_recoverable_error e_strict e_user_deprecated e_user_error e_user_notice e_user_warning e_warning each easter_date easter_days echo eio_busy eio_cancel eio_chmod eio_chown eio_close eio_custom eio_dt_blk eio_dt_chr eio_dt_cmp eio_dt_dir eio_dt_door eio_dt_fifo eio_dt_lnk eio_dt_max eio_dt_mpb eio_dt_mpc eio_dt_nam eio_dt_nwk eio_dt_reg eio_dt_sock eio_dt_unknown eio_dt_wht eio_dup2 eio_event_loop eio_falloc_fl_keep_size eio_fallocate eio_fchmod eio_fchown eio_fdatasync eio_fstat eio_fstatvfs eio_fsync eio_ftruncate eio_futime eio_get_event_stream eio_get_last_error eio_grp eio_grp_add eio_grp_cancel eio_grp_limit eio_init eio_link eio_lstat eio_mkdir eio_mknod eio_nop eio_npending eio_nready eio_nreqs eio_nthreads eio_o_append eio_o_creat eio_o_excl eio_o_fsync eio_o_nonblock eio_o_rdonly eio_o_rdwr eio_o_trunc eio_o_wronly eio_open eio_poll eio_pri_default eio_pri_max eio_pri_min eio_read eio_readahead eio_readdir eio_readdir_dents eio_readdir_dirs_first eio_readdir_found_unknown eio_readdir_stat_order eio_readlink eio_realpath eio_rename eio_rmdir eio_s_ifblk eio_s_ifchr eio_s_ififo eio_s_ifreg eio_s_ifsock eio_s_irgrp eio_s_iroth eio_s_irusr eio_s_iwgrp eio_s_iwoth eio_s_iwusr eio_s_ixgrp eio_s_ixoth eio_s_ixusr eio_seek eio_seek_cur eio_seek_end eio_seek_set eio_sendfile eio_set_max_idle eio_set_max_parallel eio_set_max_poll_reqs eio_set_max_poll_time eio_set_min_parallel eio_stat eio_statvfs eio_symlink eio_sync eio_sync_file_range eio_sync_file_range_wait_after eio_sync_file_range_wait_before eio_sync_file_range_write eio_syncfs eio_truncate eio_unlink eio_utime eio_write else elseif empty enc7bit enc8bit encbase64 encbinary encother encquotedprintable end enddeclare endfor endforeach endif endswitch endwhile ent_compat ent_disallowed ent_html401 ent_html5 ent_ignore ent_noquotes ent_quotes ent_substitute ent_xhtml ent_xml1 era era_d_fmt era_d_t_fmt era_t_fmt era_year ereg ereg_replace eregi eregi_replace error_clear_last error_get_last error_log error_reporting error_trace escapeshellarg escapeshellcmd ev_persist ev_read ev_signal ev_timeout ev_write eval event_add event_base_free event_base_loop event_base_loopbreak event_base_loopexit event_base_new event_base_priority_init event_base_reinit event_base_set event_buffer_base_set event_buffer_disable event_buffer_enable event_buffer_fd_set event_buffer_free event_buffer_new event_buffer_priority_set event_buffer_read event_buffer_set_callback event_buffer_timeout_set event_buffer_watermark_set event_buffer_write event_del event_free event_new event_priority_set event_set event_timer_add event_timer_del event_timer_new event_timer_set evloop_nonblock evloop_once exec exif_imagetype exif_read_data exif_tagname exif_thumbnail exif_use_mbstring exit exp exp_eof exp_exact exp_fullbuffer exp_glob exp_regexp exp_timeout expect_expectl expect_popen explode expm1 extends extension_loaded extr_if_exists extr_overwrite extr_prefix_all extr_prefix_if_exists extr_prefix_invalid extr_prefix_same extr_refs extr_skip extract ezmlm_hash f_dupfd f_getfd f_getfl f_getlk f_getown f_rdlck f_setfl f_setlk f_setlkw f_setown f_unlck f_wrlck false fann_cascadetrain_on_data fann_cascadetrain_on_file fann_clear_scaling_params fann_copy fann_cos fann_cos_symmetric fann_create_from_file fann_create_shortcut fann_create_shortcut_array fann_create_sparse fann_create_sparse_array fann_create_standard fann_create_standard_array fann_create_train fann_create_train_from_callback fann_descale_input fann_descale_output fann_descale_train fann_destroy fann_destroy_train fann_duplicate_train_data fann_e_cant_allocate_mem fann_e_cant_open_config_r fann_e_cant_open_config_w fann_e_cant_open_td_r fann_e_cant_open_td_w fann_e_cant_read_config fann_e_cant_read_connections fann_e_cant_read_neuron fann_e_cant_read_td fann_e_cant_train_activation fann_e_cant_use_activation fann_e_cant_use_train_alg fann_e_index_out_of_bound fann_e_input_no_match fann_e_no_error fann_e_output_no_match fann_e_scale_not_present fann_e_train_data_mismatch fann_e_train_data_subset fann_e_wrong_config_version fann_e_wrong_num_connections fann_elliot fann_elliot_symmetric fann_errorfunc_linear fann_errorfunc_tanh fann_gaussian fann_gaussian_stepwise fann_gaussian_symmetric fann_get_activation_function fann_get_activation_steepness fann_get_bias_array fann_get_bit_fail fann_get_bit_fail_limit fann_get_cascade_activation_functions fann_get_cascade_activation_functions_count fann_get_cascade_activation_steepnesses fann_get_cascade_activation_steepnesses_count fann_get_cascade_candidate_change_fraction fann_get_cascade_candidate_limit fann_get_cascade_candidate_stagnation_epochs fann_get_cascade_max_cand_epochs fann_get_cascade_max_out_epochs fann_get_cascade_min_cand_epochs f Line truncated
"fdf_get_status fdf_get_value fdf_get_version fdf_header fdf_next_field_name fdf_open fdf_open_string fdf_remove_item fdf_save fdf_save_string fdf_set_ap fdf_set_encoding fdf_set_file fdf_set_flags fdf_set_javascript_action fdf_set_on_import_javascript fdf_set_opt fdf_set_status fdf_set_submit_form_action fdf_set_target_frame fdf_set_value fdf_set_version fdfaa fdfaction fdfap fdfapref fdfas fdfcalculate fdfclearff fdfclrf fdfdown fdfdownap fdfenter fdfexit fdfff fdffile fdfflags fdfformat fdfid fdfif fdfkeystroke fdfnormalap fdfrolloverap fdfsetf fdfsetff fdfstatus fdfup fdfvalidate fdfvalue feof fflush fgetc fgetcsv fgets fgetss file file_append file_binary file_exists file_get_contents file_ignore_new_lines file_no_default_context file_put_contents file_skip_empty_lines file_text file_use_include_path fileatime filectime filegroup fileinfo_continue fileinfo_devices fileinfo_mime fileinfo_mime_encoding fileinfo_mime_type fileinfo_none fileinfo_preserve_atime fileinfo_raw fileinfo_symlink fileinode filemtime fileowner fileperms filepro filepro_fieldcount filepro_fieldname filepro_fieldtype filepro_fieldwidth filepro_retrieve filepro_rowcount filesize filetype filter_callback filter_default filter_flag_allow_fraction filter_flag_allow_hex filter_flag_allow_octal filter_flag_allow_scientific filter_flag_allow_thousand filter_flag_empty_string_null filter_flag_encode_amp filter_flag_encode_high filter_flag_encode_low filter_flag_host_required filter_flag_ipv4 filter_flag_ipv6 filter_flag_no_encode_quotes filter_flag_no_priv_range filter_flag_no_res_range filter_flag_none filter_flag_path_required filter_flag_query_required filter_flag_scheme_required filter_flag_strip_backtick filter_flag_strip_high filter_flag_strip_low filter_force_array filter_has_var filter_id filter_input filter_input_array filter_list filter_null_on_failure filter_require_array filter_require_scalar filter_sanitize_email filter_sanitize_encoded filter_sanitize_full_special_chars filter_sanitize_magic_quotes filter_sanitize_number_float filter_sanitize_number_int filter_sanitize_special_chars filter_sanitize_string filter_sanitize_stripped filter_sanitize_url filter_unsafe_raw filter_validate_boolean filter_validate_email filter_validate_float filter_validate_int filter_validate_ip filter_validate_mac filter_validate_regexp filter_validate_url filter_var filter_var_array final finally finfo_buffer finfo_close finfo_file finfo_open finfo_set_flags firebird/interbase float floatval flock floor flush fmod fnm_casefold fnm_noescape fnm_pathname fnm_period fnmatch fopen for force_deflate force_gzip foreach forward_static_call forward_static_call_array fpassthru fpe_fltdiv fpe_fltinv fpe_fltovf fpe_fltres fpe_fltsub fpe_fltund fpe_intdiv fpe_intovf fprintf fputcsv fputs frac_digits fread frenchtojd fscanf fseek fsockopen fstat ft_internal ft_not ft_peek ft_prefetchtext ft_uid ftell ftok ftp_alloc ftp_ascii ftp_autoresume ftp_autoseek ftp_binary ftp_cdup ftp_chdir ftp_chmod ftp_close ftp_connect ftp_delete ftp_exec ftp_failed ftp_fget ftp_finished ftp_fput ftp_get ftp_get_option ftp_image ftp_login ftp_mdtm ftp_mkdir ftp_moredata ftp_nb_continue ftp_nb_fget ftp_nb_fput ftp_nb_get ftp_nb_put ftp_nlist ftp_pasv ftp_put ftp_pwd ftp_quit ftp_raw ftp_rawlist ftp_rename ftp_rmdir ftp_set_option ftp_site ftp_size ftp_ssl_connect ftp_systype ftp_text ftp_timeout_sec ftruncate func_get_arg func_get_args func_num_args function function_exists function_trace fwrite gc_collect_cycles gc_disable gc_enable gc_enabled gd_bundled gd_extra_version gd_info gd_major_version gc_mem_caches gd_minor_version gd_release_version gd_version geoip_asnum_by_name geoip_asnum_edition geoip_cabledsl_speed geoip_city_edition_rev0 geoip_city_edition_rev1 geoip_continent_code_by_name geoip_corporate_speed geoip_country_code3_by_name geoip_country_code_by_name geoip_country_edition geoip_country_name_by_name geoip_database_info geoip_db_avail geoip_db_filename geoip_db_get_all_info geoip_dialup_speed geoip_domain_by_name geoip_domain_edition geoip_id_by_name geoip_isp_by_name geoip_isp_edition geoip_netspeed_edition geoip_netspeedcell_by_name geoip_org_by_name geoip_org_edition geoip_proxy_edition geoip_record_by_name geoip_region_by_name geoip_region_edition_rev0 geoip_region_edition_rev1 geoip_region_name_by_code geoip_setup_custom_directory geoip_time_zone_by_country_and_region geoip_unknown_speed get_browser get_called_class get_cfg_var get_class get_class_methods get_class_vars get_current_user get_declared_classes get_declared_interfaces get_declared_traits get_defined_constants get_defined_functions get_defined_vars get_extension_funcs get_headers get_html_translation_table get_include_path get_included_files get_loaded_extensions get_magic_quotes_gpc get_magic_quotes_runtime get_meta_tags get_object_vars get_parent_class get_required_files get_resource_type get_resources getallheaders getcwd getdate getdir getenv gethostbyaddr gethostbyname gethostbyname Line truncated
"http_deflate_level_max http_deflate_level_min http_deflate_strategy_def http_deflate_strategy_filt http_deflate_strategy_fixed http_deflate_strategy_huff http_deflate_strategy_rle http_deflate_type_gzip http_deflate_type_raw http_deflate_type_zlib http_e_encoding http_e_header http_e_invalid_param http_e_malformed_headers http_e_message_type http_e_querystring http_e_request http_e_request_method http_e_request_pool http_e_response http_e_runtime http_e_socket http_e_url http_encoding_stream_flush_full http_encoding_stream_flush_none http_encoding_stream_flush_sync http_get http_get_request_body http_get_request_body_stream http_get_request_headers http_head http_inflate http_ipresolve_any http_ipresolve_v4 http_ipresolve_v6 http_match_etag http_match_modified http_match_request_header http_meth_acl http_meth_baseline_control http_meth_checkin http_meth_checkout http_meth_connect http_meth_copy http_meth_delete http_meth_get http_meth_head http_meth_label http_meth_lock http_meth_merge http_meth_mkactivity http_meth_mkcol http_meth_mkworkspace http_meth_move http_meth_options http_meth_post http_meth_propfind http_meth_proppatch http_meth_put http_meth_report http_meth_trace http_meth_uncheckout http_meth_unlock http_meth_update http_meth_version_control http_msg_none http_msg_request http_msg_response http_negotiate_charset http_negotiate_content_type http_negotiate_language http_params_allow_comma http_params_allow_failure http_params_default http_params_raise_error http_parse_cookie http_parse_headers http_parse_message http_parse_params http_persistent_handles_clean http_persistent_handles_count http_persistent_handles_ident http_post_data http_post_fields http_proxy_http http_proxy_socks4 http_proxy_socks5 http_put_data http_put_file http_put_stream http_querystring_type_array http_querystring_type_bool http_querystring_type_float http_querystring_type_int http_querystring_type_object http_querystring_type_string http_redirect http_redirect_found http_redirect_perm http_redirect_post http_redirect_proxy http_redirect_temp http_request http_request_body_encode http_request_method_exists http_request_method_name http_request_method_register http_request_method_unregister http_response_code http_send_content_disposition http_send_content_type http_send_data http_send_file http_send_last_modified http_send_status http_send_stream http_ssl_version_any http_ssl_version_sslv2 http_ssl_version_sslv3 http_ssl_version_tlsv1 http_support http_support_encodings http_support_magicmime http_support_requests http_support_sslrequests http_throttle http_url_join_path http_url_join_query http_url_replace http_url_strip_all http_url_strip_auth http_url_strip_fragment http_url_strip_pass http_url_strip_path http_url_strip_port http_url_strip_query http_url_strip_user http_version_1_0 http_version_1_1 http_version_any hypot ibase_add_user ibase_affected_rows ibase_backup ibase_bkp_convert ibase_bkp_ignore_checksums ibase_bkp_ignore_limbo ibase_bkp_metadata_only ibase_bkp_no_garbage_collect ibase_bkp_non_transportable ibase_bkp_old_descriptions ibase_blob_add ibase_blob_cancel ibase_blob_close ibase_blob_create ibase_blob_echo ibase_blob_get ibase_blob_import ibase_blob_info ibase_blob_open ibase_close ibase_commit ibase_commit_ret ibase_committed ibase_concurrency ibase_connect ibase_consistency ibase_db_info ibase_default ibase_delete_user ibase_drop_db ibase_errcode ibase_errmsg ibase_execute ibase_fetch_arrays ibase_fetch_assoc ibase_fetch_blobs ibase_fetch_object ibase_fetch_row ibase_field_info ibase_free_event_handler ibase_free_query ibase_free_result ibase_gen_id ibase_maintain_db ibase_modify_user ibase_name_result ibase_nowait ibase_num_fields ibase_num_params ibase_param_info ibase_pconnect ibase_prepare ibase_prp_access_mode ibase_prp_activate ibase_prp_am_readonly ibase_prp_am_readwrite ibase_prp_db_online ibase_prp_deny_new_attachments ibase_prp_deny_new_transactions ibase_prp_page_buffers ibase_prp_res ibase_prp_res_use_full ibase_prp_reserve_space ibase_prp_set_sql_dialect ibase_prp_shutdown_db ibase_prp_sweep_interval ibase_prp_wm_async ibase_prp_wm_sync ibase_prp_write_mode ibase_query ibase_read ibase_res_create ibase_res_deactivate_idx ibase_res_no_shadow ibase_res_no_validity ibase_res_one_at_a_time ibase_res_replace ibase_res_use_all_space ibase_restore ibase_rollback ibase_rollback_ret ibase_rpr_check_db ibase_rpr_full ibase_rpr_ignore_checksum ibase_rpr_kill_shadows ibase_rpr_mend_db ibase_rpr_sweep_db ibase_rpr_validate_db ibase_server_info ibase_service_attach ibase_service_detach ibase_set_event_handler ibase_sts_data_pages ibase_sts_db_log ibase_sts_hdr_pages ibase_sts_idx_pages ibase_sts_sys_relations ibase_svc_get_env ibase_svc_get_env_lock ibase_svc_get_env_msg ibase_svc_get_users ibase_svc_implementation ibase_svc_server_version ibase_svc_svr_db_info ibase_svc_user_dbpath ibase_trans ibase_unixtime ibase_wait ibase_wait_event ibase_write iconv iconv_get_encoding iconv_impl Line truncated
"imap_mailboxmsginfo imap_mime_header_decode imap_msgno imap_mutf7_to_utf8 imap_num_msg imap_num_recent imap_open imap_opentimeout imap_ping imap_qprint imap_readtimeout imap_rename imap_renamemailbox imap_reopen imap_rfc822_parse_adrlist imap_rfc822_parse_headers imap_rfc822_write_address imap_savebody imap_scan imap_scanmailbox imap_search imap_set_quota imap_setacl imap_setflag_full imap_sort imap_status imap_subscribe imap_thread imap_timeout imap_uid imap_undelete imap_unsubscribe imap_utf7_decode imap_utf7_encode imap_utf8 imap_utf8_to_mutf7 imap_writetimeout img_affine_rotate img_affine_scale img_affine_shear_horizontal img_affine_shear_vertical img_affine_translate img_arc_chord img_arc_edged img_arc_nofill img_arc_pie img_arc_rounded img_bell img_bessel img_bicubic img_bicubic_fixed img_bilinear_fixed img_blackman img_box img_bspline img_catmullrom img_color_brushed img_color_styled img_color_styledbrushed img_color_tiled img_color_transparent img_crop_black img_crop_default img_crop_sides img_crop_threshold img_crop_transparent img_crop_white img_effect_alphablend img_effect_normal img_effect_overlay img_effect_replace img_filter_brightness img_filter_colorize img_filter_contrast img_filter_edgedetect img_filter_emboss img_filter_gaussian_blur img_filter_grayscale img_filter_mean_removal img_filter_negate img_filter_pixelate img_filter_selective_blur img_filter_smooth img_flip_both img_flip_horizontal img_flip_vertical img_gaussian img_gd2_compressed img_gd2_raw img_generalized_cubic img_gif img_hamming img_hanning img_hermite img_jpeg img_jpg img_mitchell img_nearest_neighbour img_png img_power img_quadratic img_sinc img_triangle img_wbmp img_weighted4 img_xpm implements implode import_request_variables in_access in_all_events in_array in_attrib in_close in_close_nowrite in_close_write in_create in_delete in_delete_self in_dont_follow in_ignored in_isdir in_mask_add in_modify in_move in_move_self in_moved_from in_moved_to in_oneshot in_onlydir in_open in_q_overflow in_unmount include include_once inet_ntop inet_pton inf info_all info_configuration info_credits info_environment info_general info_license info_modules info_variables ingres_api_version ingres_assoc ingres_autocommit ingres_autocommit_state ingres_both ingres_charset ingres_close ingres_commit ingres_connect ingres_cursor ingres_cursor_readonly ingres_cursor_update ingres_date_dmy ingres_date_finnish ingres_date_german ingres_date_iso ingres_date_iso4 ingres_date_mdy ingres_date_multinational ingres_date_multinational4 ingres_date_ymd ingres_errno ingres_error ingres_errsqlstate ingres_escape_string ingres_execute ingres_ext_version ingres_fetch_array ingres_fetch_assoc ingres_fetch_object ingres_fetch_proc_return ingres_fetch_row ingres_field_length ingres_field_name ingres_field_nullable ingres_field_precision ingres_field_scale ingres_field_type ingres_free_result ingres_money_leading ingres_money_trailing ingres_next_error ingres_num ingres_num_fields ingres_num_rows ingres_pconnect ingres_prepare ingres_query ingres_result_seek ingres_rollback ingres_set_environment ingres_structure_btree ingres_structure_cbtree ingres_structure_chash ingres_structure_cheap ingres_structure_cisam ingres_structure_hash ingres_structure_heap ingres_structure_isam ingres_unbuffered_query ini_all ini_alter ini_get ini_get_all ini_perdir ini_restore ini_scanner_normal ini_scanner_raw ini_scanner_typed ini_set ini_system ini_user inotify_add_watch inotify_init inotify_queue_len inotify_read inotify_rm_watch input_cookie input_env input_get input_post input_request input_server input_session instanceof insteadof int int_curr_symbol int_frac_digits intdiv integer interface interface_exists intl_error_name intl_get_error_code intl_get_error_message intl_icu_data_version intl_icu_version intl_idna_variant_2003 intl_idna_variant_uts46 intl_is_failure intl_max_locale_len intval ion_clock_skew ion_corrupt_file ion_expired_file ion_license_corrupt ion_license_expired ion_license_header_invalid ion_license_not_found ion_license_property_invalid ion_license_server_invalid ion_no_permissions ion_unauth_append_prepend_file ion_unauth_included_file ion_unauth_including_file ion_untrusted_extension ioncube_check_license_properties ioncube_file_info ioncube_file_is_encoded ioncube_file_not_permissioned ioncube_file_properties ioncube_license_has_expired ioncube_license_matches_server ioncube_license_properties ioncube_licensed_servers ioncube_loader_iversion ioncube_loader_version ioncube_read_file ioncube_server_data ioncube_write_file ip2long ip_multicast_if ip_multicast_loop ip_multicast_ttl ipproto_ip ipproto_ipv6 iptcembed iptcparse ipv6_hoplimit ipv6_multicast_hops ipv6_multicast_if ipv6_multicast_loop ipv6_pktinfo ipv6_recvhoplimit ipv6_recvpktinfo ipv6_recvtclass ipv6_tclass ipv6_unicast_hops is_a is_array is_bool is_callable is_dir is_double is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long is_nan is_null Line truncated
"m_sqrt3 m_sqrtpi m_sslcert_gen_hash m_success m_transactionssent m_transinqueue m_transkeyval m_transnew m_transsend m_uwait m_validateidentifier m_verifyconnection m_verifysslcert magic_quotes_runtime mail mailparse_determine_best_xfer_encoding mailparse_extract_output mailparse_extract_return mailparse_extract_stream mailparse_msg_create mailparse_msg_extract_part mailparse_msg_extract_part_file mailparse_msg_extract_whole_part_file mailparse_msg_free mailparse_msg_get_part mailparse_msg_get_part_data mailparse_msg_get_structure mailparse_msg_parse mailparse_msg_parse_file mailparse_rfc822_parse_addresses mailparse_stream_encode mailparse_uudecode_all main max maxdb_affected_rows maxdb_application maxdb_appversion maxdb_assoc maxdb_assoc_lower maxdb_assoc_upper maxdb_autocommit maxdb_bind_param maxdb_bind_result maxdb_both maxdb_change_user maxdb_character_set_name maxdb_client_encoding maxdb_close maxdb_close_long_data maxdb_commit maxdb_compname maxdb_connect maxdb_connect_errno maxdb_connect_error maxdb_cursorprefix maxdb_data_seek maxdb_debug maxdb_disable_reads_from_master maxdb_disable_rpl_parse maxdb_dump_debug_info maxdb_embedded_connect maxdb_enable_reads_from_master maxdb_enable_rpl_parse maxdb_errno maxdb_error maxdb_escape_string maxdb_execute maxdb_fetch maxdb_fetch_array maxdb_fetch_assoc maxdb_fetch_field maxdb_fetch_field_direct maxdb_fetch_fields maxdb_fetch_lengths maxdb_fetch_object maxdb_fetch_row maxdb_field_count maxdb_field_seek maxdb_field_tell maxdb_free_result maxdb_get_client_info maxdb_get_client_version maxdb_get_host_info maxdb_get_metadata maxdb_get_proto_info maxdb_get_server_info maxdb_get_server_version maxdb_info maxdb_init maxdb_insert_id maxdb_isolationlevel maxdb_kill maxdb_master_query maxdb_more_results maxdb_multi_query maxdb_next_result maxdb_num maxdb_num_fields maxdb_num_rows maxdb_options maxdb_packetcount maxdb_param_count maxdb_ping maxdb_prepare maxdb_query maxdb_real_connect maxdb_real_escape_string maxdb_real_query maxdb_report maxdb_rollback maxdb_rpl_parse_enabled maxdb_rpl_probe maxdb_rpl_query_type maxdb_select_db maxdb_send_long_data maxdb_send_query maxdb_server_end maxdb_server_init maxdb_set_opt maxdb_sqlmode maxdb_sqlstate maxdb_ssl_set maxdb_stat maxdb_statementcachesize maxdb_stmt_affected_rows maxdb_stmt_bind_param maxdb_stmt_bind_result maxdb_stmt_close maxdb_stmt_close_long_data maxdb_stmt_data_seek maxdb_stmt_errno maxdb_stmt_error maxdb_stmt_execute maxdb_stmt_fetch maxdb_stmt_free_result maxdb_stmt_init maxdb_stmt_num_rows maxdb_stmt_param_count maxdb_stmt_prepare maxdb_stmt_reset maxdb_stmt_result_metadata maxdb_stmt_send_long_data maxdb_stmt_sqlstate maxdb_stmt_store_result maxdb_store_result maxdb_thread_id maxdb_thread_safe maxdb_timeout maxdb_unicode maxdb_use_result maxdb_warning_count mb_case_lower mb_case_title mb_case_upper mb_check_encoding mb_convert_case mb_convert_encoding mb_convert_kana mb_convert_variables mb_decode_mimeheader mb_decode_numericentity mb_detect_encoding mb_detect_order mb_encode_mimeheader mb_encode_numericentity mb_encoding_aliases mb_ereg mb_ereg_match mb_ereg_replace mb_ereg_replace_callback mb_ereg_search mb_ereg_search_getpos mb_ereg_search_getregs mb_ereg_search_init mb_ereg_search_pos mb_ereg_search_regs mb_ereg_search_setpos mb_eregi mb_eregi_replace mb_get_info mb_http_input mb_http_output mb_internal_encoding mb_language mb_list_encodings mb_output_handler mb_overload_mail mb_overload_regex mb_overload_string mb_parse_str mb_preferred_mime_name mb_regex_encoding mb_regex_set_options mb_send_mail mb_split mb_strcut mb_strimwidth mb_stripos mb_stristr mb_strlen mb_strpos mb_strrchr mb_strrichr mb_strripos mb_strrpos mb_strstr mb_strtolower mb_strtoupper mb_strwidth mb_substitute_character mb_substr mb_substr_count mbereg mbereg_match mbereg_replace mbereg_search mbereg_search_getpos mbereg_search_getregs mbereg_search_init mbereg_search_pos mbereg_search_regs mbereg_search_setpos mberegi mberegi_replace mbregex_encoding mbsplit mcast_block_source mcast_join_group mcast_join_source_group mcast_leave_group mcast_leave_source_group mcast_unblock_source mcrypt_3des mcrypt_arcfour mcrypt_arcfour_iv mcrypt_blowfish mcrypt_blowfish_compat mcrypt_cast_128 mcrypt_cast_256 mcrypt_cbc mcrypt_cfb mcrypt_create_iv mcrypt_crypt mcrypt_decrypt mcrypt_des mcrypt_dev_random mcrypt_dev_urandom mcrypt_ecb mcrypt_enc_get_algorithms_name mcrypt_enc_get_block_size mcrypt_enc_get_iv_size mcrypt_enc_get_key_size mcrypt_enc_get_modes_name mcrypt_enc_get_supported_key_sizes mcrypt_enc_is_block_algorithm mcrypt_enc_is_block_algorithm_mode mcrypt_enc_is_block_mode mcrypt_enc_self_test mcrypt_encrypt mcrypt_enigna mcrypt_generic mcrypt_generic_deinit mcrypt_generic_end mcrypt_generic_init mcrypt_get_block_size mcrypt_get_cipher_name mcrypt_get_iv_size mcrypt_get_key_size mcrypt_gost mcrypt_idea mcrypt_list_algorithms mcrypt_list_modes mcrypt_loki97 mcrypt_mars mcrypt_mode_cbc mcrypt_mode_cfb mcrypt_mode_ecb mcr Line truncated
"mssql_free_statement mssql_get_last_message mssql_guid_string mssql_init mssql_min_error_severity mssql_min_message_severity mssql_next_result mssql_num mssql_num_fields mssql_num_rows mssql_pconnect mssql_query mssql_result mssql_rows_affected mssql_select_db mt_getrandmax mt_rand mt_srand mysql mysql_affected_rows mysql_assoc mysql_both mysql_client_compress mysql_client_encoding mysql_client_ignore_space mysql_client_interactive mysql_client_ssl mysql_close mysql_connect mysql_create_db mysql_data_seek mysql_db_name mysql_db_query mysql_dbname mysql_drop_db mysql_errno mysql_error mysql_escape_string mysql_fetch_array mysql_fetch_assoc mysql_fetch_field mysql_fetch_lengths mysql_fetch_object mysql_fetch_row mysql_field_flags mysql_field_len mysql_field_name mysql_field_seek mysql_field_table mysql_field_type mysql_fieldflags mysql_fieldlen mysql_fieldname mysql_fieldtable mysql_fieldtype mysql_free_result mysql_freeresult mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql_insert_id mysql_list_dbs mysql_list_fields mysql_list_processes mysql_list_tables mysql_listdbs mysql_listfields mysql_listtables mysql_num mysql_num_fields mysql_num_rows mysql_numfields mysql_numrows mysql_pconnect mysql_ping mysql_query mysql_real_escape_string mysql_result mysql_select_db mysql_selectdb mysql_set_charset mysql_stat mysql_table_name mysql_tablename mysql_thread_id mysql_unbuffered_query mysqli_affected_rows mysqli_assoc mysqli_async mysqli_auto_increment_flag mysqli_autocommit mysqli_begin_transaction mysqli_binary_flag mysqli_bind_param mysqli_bind_result mysqli_blob_flag mysqli_both mysqli_change_user mysqli_character_set_name mysqli_client_can_handle_expired_passwords mysqli_client_compress mysqli_client_encoding mysqli_client_found_rows mysqli_client_ignore_space mysqli_client_interactive mysqli_client_multi_queries mysqli_client_no_schema mysqli_client_ssl mysqli_close mysqli_commit mysqli_connect mysqli_connect_errno mysqli_connect_error mysqli_cursor_type_for_update mysqli_cursor_type_no_cursor mysqli_cursor_type_read_only mysqli_cursor_type_scrollable mysqli_data_seek mysqli_data_truncated mysqli_debug mysqli_debug_trace_enabled mysqli_dump_debug_info mysqli_embedded_server_end mysqli_embedded_server_start mysqli_enum_flag mysqli_errno mysqli_error mysqli_error_list mysqli_escape_string mysqli_execute mysqli_fetch mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field mysqli_fetch_field_direct mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_cache_stats mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_links_stats mysqli_get_metadata mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_get_warnings mysqli_group_flag mysqli_info mysqli_init mysqli_init_command mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_multiple_key_flag mysqli_need_data mysqli_next_result mysqli_no_data mysqli_no_default_value_flag mysqli_not_null_flag mysqli_num mysqli_num_fields mysqli_num_flag mysqli_num_rows mysqli_on_update_now_flag mysqli_opt_can_handle_expired_passwords mysqli_opt_connect_timeout mysqli_opt_int_and_float_native mysqli_opt_local_infile mysqli_opt_net_cmd_buffer_size mysqli_opt_net_read_buffer_size mysqli_opt_ssl_verify_server_cert mysqli_options mysqli_param_count mysqli_part_key_flag mysqli_ping mysqli_poll mysqli_prepare mysqli_pri_key_flag mysqli_query mysqli_read_default_file mysqli_read_default_group mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_refresh_backup_log mysqli_refresh_grant mysqli_refresh_hosts mysqli_refresh_log mysqli_refresh_master mysqli_refresh_slave mysqli_refresh_status mysqli_refresh_tables mysqli_refresh_threads mysqli_release_savepoint mysqli_report mysqli_report_all mysqli_report_error mysqli_report_index mysqli_report_off mysqli_report_strict mysqli_rollback mysqli_savepoint mysqli_select_db mysqli_send_long_data mysqli_server_ps_out_params mysqli_server_public_key mysqli_server_query_no_good_index_used mysqli_server_query_no_index_used mysqli_server_query_was_slow mysqli_set_charset mysqli_set_charset_dir mysqli_set_charset_name mysqli_set_flag mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_set_opt mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_affected_rows mysqli_stmt_attr_cursor_type mysqli_stmt_attr_get mysqli_stmt_attr_prefetch_rows mysqli_stmt_attr_set mysqli_stmt_attr_update_max_length mysqli_stmt_bind_param mysqli_stmt_bind_result mysqli_stmt_close mysqli_stmt_data_seek mysqli_stmt_errno mysqli_stmt_error mysqli_stmt_error_list mysqli_stmt_execute mysqli_stmt_fetch mysqli_stmt_field_count mysqli_stmt_free_result mysqli_stmt_get_result m Line truncated
"ncurses_panel_above ncurses_panel_below ncurses_panel_window ncurses_pnoutrefresh ncurses_prefresh ncurses_putp ncurses_qiflush ncurses_raw ncurses_refresh ncurses_replace_panel ncurses_report_mouse_position ncurses_reset_prog_mode ncurses_reset_shell_mode ncurses_resetty ncurses_savetty ncurses_scr_dump ncurses_scr_init ncurses_scr_restore ncurses_scr_set ncurses_scrl ncurses_show_panel ncurses_slk_attr ncurses_slk_attroff ncurses_slk_attron ncurses_slk_attrset ncurses_slk_clear ncurses_slk_color ncurses_slk_init ncurses_slk_noutrefresh ncurses_slk_refresh ncurses_slk_restore ncurses_slk_set ncurses_slk_touch ncurses_standend ncurses_standout ncurses_start_color ncurses_termattrs ncurses_termname ncurses_timeout ncurses_top_panel ncurses_typeahead ncurses_ungetch ncurses_ungetmouse ncurses_update_panels ncurses_use_default_colors ncurses_use_env ncurses_use_extended_names ncurses_vidattr ncurses_vline ncurses_waddch ncurses_waddstr ncurses_wattroff ncurses_wattron ncurses_wattrset ncurses_wborder ncurses_wclear ncurses_wcolor_set ncurses_werase ncurses_wgetch ncurses_whline ncurses_wmouse_trafo ncurses_wmove ncurses_wnoutrefresh ncurses_wrefresh ncurses_wstandend ncurses_wstandout ncurses_wvline negative_sign new newt_anchor_bottom newt_anchor_left newt_anchor_right newt_anchor_top newt_arg_append newt_arg_last newt_bell newt_button newt_button_bar newt_centered_window newt_checkbox newt_checkbox_get_value newt_checkbox_set_flags newt_checkbox_set_value newt_checkbox_tree newt_checkbox_tree_add_item newt_checkbox_tree_find_item newt_checkbox_tree_get_current newt_checkbox_tree_get_entry_value newt_checkbox_tree_get_multi_selection newt_checkbox_tree_get_selection newt_checkbox_tree_multi newt_checkbox_tree_set_current newt_checkbox_tree_set_entry newt_checkbox_tree_set_entry_value newt_checkbox_tree_set_width newt_checkboxtree_collapsed newt_checkboxtree_expanded newt_checkboxtree_hide_box newt_checkboxtree_selected newt_checkboxtree_unselectable newt_checkboxtree_unselected newt_clear_key_buffer newt_cls newt_colorset_actbutton newt_colorset_actcheckbox newt_colorset_actlistbox newt_colorset_actsellistbox newt_colorset_acttextbox newt_colorset_border newt_colorset_button newt_colorset_checkbox newt_colorset_compactbutton newt_colorset_disentry newt_colorset_emptyscale newt_colorset_entry newt_colorset_fullscale newt_colorset_helpline newt_colorset_label newt_colorset_listbox newt_colorset_root newt_colorset_roottext newt_colorset_sellistbox newt_colorset_shadow newt_colorset_textbox newt_colorset_title newt_colorset_window newt_compact_button newt_component_add_callback newt_component_takes_focus newt_create_grid newt_cursor_off newt_cursor_on newt_delay newt_draw_form newt_draw_root_text newt_entry newt_entry_disabled newt_entry_get_value newt_entry_hidden newt_entry_returnexit newt_entry_scroll newt_entry_set newt_entry_set_filter newt_entry_set_flags newt_exit_component newt_exit_fdready newt_exit_hotkey newt_exit_timer newt_fd_except newt_fd_read newt_fd_write newt_finished newt_flag_border newt_flag_checkbox newt_flag_disabled newt_flag_hidden newt_flag_multiple newt_flag_nof12 newt_flag_password newt_flag_returnexit newt_flag_scroll newt_flag_selected newt_flag_showcursor newt_flag_wrap newt_flags_reset newt_flags_set newt_flags_toggle newt_form newt_form_add_component newt_form_add_components newt_form_add_hot_key newt_form_destroy newt_form_get_current newt_form_nof12 newt_form_run newt_form_set_background newt_form_set_height newt_form_set_size newt_form_set_timer newt_form_set_width newt_form_watch_fd newt_get_screen_size newt_grid_add_components_to_form newt_grid_basic_window newt_grid_component newt_grid_empty newt_grid_flag_growx newt_grid_flag_growy newt_grid_free newt_grid_get_size newt_grid_h_close_stacked newt_grid_h_stacked newt_grid_place newt_grid_set_field newt_grid_simple_window newt_grid_subgrid newt_grid_v_close_stacked newt_grid_v_stacked newt_grid_wrapped_window newt_grid_wrapped_window_at newt_init newt_key_bkspc newt_key_delete newt_key_down newt_key_end newt_key_enter newt_key_escape newt_key_extra_base newt_key_f1 newt_key_f10 newt_key_f11 newt_key_f12 newt_key_f2 newt_key_f3 newt_key_f4 newt_key_f5 newt_key_f6 newt_key_f7 newt_key_f8 newt_key_f9 newt_key_home newt_key_insert newt_key_left newt_key_pgdn newt_key_pgup newt_key_resize newt_key_return newt_key_right newt_key_suspend newt_key_tab newt_key_untab newt_key_up newt_label newt_label_set_text newt_listbox newt_listbox_append_entry newt_listbox_clear newt_listbox_clear_selection newt_listbox_delete_entry newt_listbox_get_current newt_listbox_get_selection newt_listbox_insert_entry newt_listbox_item_count newt_listbox_returnexit newt_listbox_select_item newt_listbox_set_current newt_listbox_set_current_by_key newt_listbox_set_data newt_listbox_set_entry newt_listbox_set_width newt_listitem newt_listitem_get_data newt_listitem_set newt_open_window newt_pop_help_line newt_pop_window newt_push_help_line ne Line truncated
"openssl_algo_sha224 openssl_algo_sha256 openssl_algo_sha384 openssl_algo_sha512 openssl_cipher_3des openssl_cipher_aes_128_cbc openssl_cipher_aes_192_cbc openssl_cipher_aes_256_cbc openssl_cipher_des openssl_cipher_iv_length openssl_cipher_rc2_128 openssl_cipher_rc2_40 openssl_cipher_rc2_64 openssl_csr_export openssl_csr_export_to_file openssl_csr_get_public_key openssl_csr_get_subject openssl_csr_new openssl_csr_sign openssl_decrypt openssl_default_stream_ciphers openssl_dh_compute_key openssl_digest openssl_encrypt openssl_error_string openssl_free_key openssl_get_cert_locations openssl_get_cipher_methods openssl_get_md_methods openssl_get_privatekey openssl_get_publickey openssl_keytype_dh openssl_keytype_dsa openssl_keytype_ec openssl_keytype_rsa openssl_no_padding openssl_open openssl_pbkdf2 openssl_pkcs12_export openssl_pkcs12_export_to_file openssl_pkcs12_read openssl_pkcs1_oaep_padding openssl_pkcs1_padding openssl_pkcs7_decrypt openssl_pkcs7_encrypt openssl_pkcs7_sign openssl_pkcs7_verify openssl_pkey_export openssl_pkey_export_to_file openssl_pkey_free openssl_pkey_get_details openssl_pkey_get_private openssl_pkey_get_public openssl_pkey_new openssl_private_decrypt openssl_private_encrypt openssl_public_decrypt openssl_public_encrypt openssl_random_pseudo_bytes openssl_raw_data openssl_seal openssl_sign openssl_spki_export openssl_spki_export_challenge openssl_spki_new openssl_spki_verify openssl_sslv23_padding openssl_tlsext_server_name openssl_verify openssl_version_number openssl_version_text openssl_x509_check_private_key openssl_x509_checkpurpose openssl_x509_export openssl_x509_export_to_file openssl_x509_fingerprint openssl_x509_free openssl_x509_parse openssl_x509_read openssl_zero_padding or ord output_add_rewrite_var output_reset_rewrite_vars override_function p_cs_precedes p_sep_by_space p_sign_posn pack parent parse_ini_file parse_ini_string parse_str parse_url parsekit_compile_file parsekit_compile_string parsekit_extended_value parsekit_func_arginfo parsekit_is_const parsekit_is_tmp_var parsekit_is_unused parsekit_is_var parsekit_quiet parsekit_result_const parsekit_result_ea_type parsekit_result_jmp_addr parsekit_result_oparray parsekit_result_opline parsekit_result_var parsekit_simple parsekit_usage_unknown parsekit_zend_add parsekit_zend_add_array_element parsekit_zend_add_char parsekit_zend_add_interface parsekit_zend_add_string parsekit_zend_add_var parsekit_zend_assign parsekit_zend_assign_add parsekit_zend_assign_bw_and parsekit_zend_assign_bw_or parsekit_zend_assign_bw_xor parsekit_zend_assign_concat parsekit_zend_assign_dim parsekit_zend_assign_div parsekit_zend_assign_mod parsekit_zend_assign_mul parsekit_zend_assign_obj parsekit_zend_assign_ref parsekit_zend_assign_sl parsekit_zend_assign_sr parsekit_zend_assign_sub parsekit_zend_begin_silence parsekit_zend_bool parsekit_zend_bool_not parsekit_zend_bool_xor parsekit_zend_brk parsekit_zend_bw_and parsekit_zend_bw_not parsekit_zend_bw_or parsekit_zend_bw_xor parsekit_zend_case parsekit_zend_cast parsekit_zend_catch parsekit_zend_clone parsekit_zend_concat parsekit_zend_cont parsekit_zend_declare_class parsekit_zend_declare_function parsekit_zend_declare_inherited_class parsekit_zend_div parsekit_zend_do_fcall parsekit_zend_do_fcall_by_name parsekit_zend_echo parsekit_zend_end_silence parsekit_zend_eval_code parsekit_zend_exit parsekit_zend_ext_fcall_begin parsekit_zend_ext_fcall_end parsekit_zend_ext_nop parsekit_zend_ext_stmt parsekit_zend_fe_fetch parsekit_zend_fe_reset parsekit_zend_fetch_class parsekit_zend_fetch_constant parsekit_zend_fetch_dim_func_arg parsekit_zend_fetch_dim_is parsekit_zend_fetch_dim_r parsekit_zend_fetch_dim_rw parsekit_zend_fetch_dim_tmp_var parsekit_zend_fetch_dim_unset parsekit_zend_fetch_dim_w parsekit_zend_fetch_func_arg parsekit_zend_fetch_is parsekit_zend_fetch_obj_func_arg parsekit_zend_fetch_obj_is parsekit_zend_fetch_obj_r parsekit_zend_fetch_obj_rw parsekit_zend_fetch_obj_unset parsekit_zend_fetch_obj_w parsekit_zend_fetch_r parsekit_zend_fetch_rw parsekit_zend_fetch_unset parsekit_zend_fetch_w parsekit_zend_free parsekit_zend_handle_exception parsekit_zend_import_class parsekit_zend_import_const parsekit_zend_import_function parsekit_zend_include_or_eval parsekit_zend_init_array parsekit_zend_init_ctor_call parsekit_zend_init_fcall_by_name parsekit_zend_init_method_call parsekit_zend_init_static_method_call parsekit_zend_init_string parsekit_zend_instanceof parsekit_zend_internal_class parsekit_zend_internal_function parsekit_zend_is_equal parsekit_zend_is_identical parsekit_zend_is_not_equal parsekit_zend_is_not_identical parsekit_zend_is_smaller parsekit_zend_is_smaller_or_equal parsekit_zend_isset_isempty parsekit_zend_isset_isempty_dim_obj parsekit_zend_isset_isempty_prop_obj parsekit_zend_isset_isempty_var parsekit_zend_jmp parsekit_zend_jmp_no_ctor parsekit_zend_jmpnz parsekit_zend_jmpnz_ex parsekit_zend_jmpz parsekit_zend_jmpz_ex parsekit_zend_jmpznz parsekit_zen Line truncated
"pg_execute pg_fetch_all pg_fetch_all_columns pg_fetch_array pg_fetch_assoc pg_fetch_object pg_fetch_result pg_fetch_row pg_field_is_null pg_field_name pg_field_num pg_field_prtlen pg_field_size pg_field_table pg_field_type pg_field_type_oid pg_fieldisnull pg_fieldname pg_fieldnum pg_fieldprtlen pg_fieldsize pg_fieldtype pg_flush pg_free_result pg_freeresult pg_get_notify pg_get_pid pg_get_result pg_getlastoid pg_host pg_insert pg_last_error pg_last_notice pg_last_oid pg_lo_close pg_lo_create pg_lo_export pg_lo_import pg_lo_open pg_lo_read pg_lo_read_all pg_lo_seek pg_lo_tell pg_lo_truncate pg_lo_unlink pg_lo_write pg_loclose pg_locreate pg_loexport pg_loimport pg_loopen pg_loread pg_loreadall pg_lounlink pg_lowrite pg_meta_data pg_num_fields pg_num_rows pg_numfields pg_numrows pg_options pg_parameter_status pg_pconnect pg_ping pg_port pg_prepare pg_put_line pg_query pg_query_params pg_result pg_result_error pg_result_error_field pg_result_seek pg_result_status pg_select pg_send_execute pg_send_prepare pg_send_query pg_send_query_params pg_set_client_encoding pg_set_error_verbosity pg_setclientencoding pg_socket pg_trace pg_transaction_status pg_tty pg_unescape_bytea pg_untrace pg_update pg_version pgsql_assoc pgsql_bad_response pgsql_both pgsql_command_ok pgsql_connect_async pgsql_connect_force_new pgsql_connection_auth_ok pgsql_connection_awaiting_response pgsql_connection_bad pgsql_connection_made pgsql_connection_ok pgsql_connection_setenv pgsql_connection_started pgsql_conv_force_null pgsql_conv_ignore_default pgsql_conv_ignore_not_null pgsql_copy_in pgsql_copy_out pgsql_diag_context pgsql_diag_internal_position pgsql_diag_internal_query pgsql_diag_message_detail pgsql_diag_message_hint pgsql_diag_message_primary pgsql_diag_severity pgsql_diag_source_file pgsql_diag_source_function pgsql_diag_source_line pgsql_diag_sqlstate pgsql_diag_statement_position pgsql_dml_async pgsql_dml_escape pgsql_dml_exec pgsql_dml_no_conv pgsql_dml_string pgsql_empty_query pgsql_errors_default pgsql_errors_terse pgsql_errors_verbose pgsql_fatal_error pgsql_libpq_version pgsql_libpq_version_str pgsql_nonfatal_error pgsql_num pgsql_polling_active pgsql_polling_failed pgsql_polling_ok pgsql_polling_reading pgsql_polling_writing pgsql_seek_cur pgsql_seek_end pgsql_seek_set pgsql_status_long pgsql_status_string pgsql_transaction_active pgsql_transaction_idle pgsql_transaction_inerror pgsql_transaction_intrans pgsql_transaction_unknown pgsql_tuples_ok php_binary php_binary_read php_bindir php_check_syntax php_config_file_path php_config_file_scan_dir php_datadir php_debug php_egg_logo_guid php_eol php_extension_dir php_extra_version php_ini_loaded_file php_ini_scanned_files php_int_max php_int_size php_libdir php_localstatedir php_logo_guid php_major_version php_mandir php_maxpathlen php_minor_version php_normal_read php_os php_output_handler_clean php_output_handler_cleanable php_output_handler_cont php_output_handler_disabled php_output_handler_end php_output_handler_final php_output_handler_flush php_output_handler_flushable php_output_handler_removable php_output_handler_start php_output_handler_started php_output_handler_stdflags php_output_handler_write php_prefix php_query_rfc1738 php_query_rfc3986 php_real_logo_guid php_release_version php_round_half_down php_round_half_even php_round_half_odd php_round_half_up php_sapi php_sapi_name php_session_active php_session_disabled php_session_none php_shlib_suffix php_strip_whitespace php_svn_auth_param_ignore_ssl_verify_errors php_sysconfdir php_uname php_url_fragment php_url_host php_url_pass php_url_path php_url_port php_url_query php_url_scheme php_url_user php_version php_version_id php_windows_nt_domain_controller php_windows_nt_server php_windows_nt_workstation php_windows_version_build php_windows_version_major php_windows_version_minor php_windows_version_platform php_windows_version_producttype php_windows_version_sp_major php_windows_version_sp_minor php_windows_version_suitemask php_zts phpcredits phpinfo phpversion pi pkcs7_binary pkcs7_detached pkcs7_noattr pkcs7_nocerts pkcs7_nochain pkcs7_nointern pkcs7_nosigs pkcs7_noverify pkcs7_text pm_str png2wbmp png_all_filters png_filter_avg png_filter_none png_filter_paeth png_filter_sub png_filter_up png_no_filter poll_err poll_hup poll_in poll_msg poll_out poll_pri popen pos positive_sign posix_access posix_ctermid posix_errno posix_f_ok posix_get_last_error posix_getcwd posix_getegid posix_geteuid posix_getgid posix_getgrgid posix_getgrnam posix_getgroups posix_getlogin posix_getpgid posix_getpgrp posix_getpid posix_getppid posix_getpwnam posix_getpwuid posix_getrlimit posix_getsid posix_getuid posix_initgroups posix_isatty posix_kill posix_mkfifo posix_mknod posix_r_ok posix_s_ifblk posix_s_ifchr posix_s_ififo posix_s_ifreg posix_s_ifsock posix_setegid posix_seteuid posix_setgid posix_setpgid posix_setrlimit posix_setsid posix_setuid posix_strerror posix_times posix_ttyname posix_uname posix_w_ok posi Line truncated
"radius_framed_compression radius_framed_ip_address radius_framed_ip_netmask radius_framed_ipx_network radius_framed_mtu radius_framed_protocol radius_framed_route radius_framed_routing radius_g_3_fax radius_gandalf radius_get_attr radius_get_tagged_attr_data radius_get_tagged_attr_tag radius_get_vendor_attr radius_hdlc_clear_channel radius_idle_timeout radius_idsl radius_isdn_async_v110 radius_isdn_async_v120 radius_isdn_sync radius_login radius_login_ip_host radius_login_lat_group radius_login_lat_node radius_login_lat_port radius_login_lat_service radius_login_service radius_login_tcp_port radius_microsoft_ms_acct_auth_type radius_microsoft_ms_acct_eap_type radius_microsoft_ms_arap_challenge radius_microsoft_ms_arap_password_change_reason radius_microsoft_ms_bap_usage radius_microsoft_ms_chap2_pw radius_microsoft_ms_chap2_response radius_microsoft_ms_chap2_success radius_microsoft_ms_chap_challenge radius_microsoft_ms_chap_domain radius_microsoft_ms_chap_error radius_microsoft_ms_chap_lm_enc_pw radius_microsoft_ms_chap_mppe_keys radius_microsoft_ms_chap_nt_enc_pw radius_microsoft_ms_chap_pw_1 radius_microsoft_ms_chap_pw_2 radius_microsoft_ms_chap_response radius_microsoft_ms_filter radius_microsoft_ms_link_drop_time_limit radius_microsoft_ms_link_utilization_threshold radius_microsoft_ms_mppe_encryption_policy radius_microsoft_ms_mppe_encryption_types radius_microsoft_ms_mppe_recv_key radius_microsoft_ms_mppe_send_key radius_microsoft_ms_new_arap_password radius_microsoft_ms_old_arap_password radius_microsoft_ms_primary_dns_server radius_microsoft_ms_primary_nbns_server radius_microsoft_ms_ras_vendor radius_microsoft_ms_ras_version radius_microsoft_ms_secondary_dns_server radius_microsoft_ms_secondary_nbns_server radius_mppe_key_len radius_nas_identifier radius_nas_ip_address radius_nas_port radius_nas_port_type radius_nas_prompt radius_option_salt radius_option_tagged radius_outbound radius_piafs radius_port_limit radius_ppp radius_proxy_state radius_put_addr radius_put_attr radius_put_int radius_put_string radius_put_vendor_addr radius_put_vendor_attr radius_put_vendor_int radius_put_vendor_string radius_reply_message radius_request_authenticator radius_salt_encrypt_attr radius_sdsl radius_send_request radius_server_secret radius_service_type radius_session_timeout radius_slip radius_start radius_state radius_stop radius_strerror radius_sync radius_term_admin_reboot radius_term_admin_reset radius_term_callback radius_term_host_request radius_term_idle_timeout radius_term_lost_carrier radius_term_lost_service radius_term_nas_error radius_term_nas_reboot radius_term_nas_request radius_term_port_error radius_term_port_preempted radius_term_port_suspended radius_term_port_unneeded radius_term_service_unavailable radius_term_session_timeout radius_term_user_error radius_term_user_request radius_termination_action radius_user_name radius_user_password radius_vendor_microsoft radius_vendor_specific radius_virtual radius_wireless_ieee_802_11 radius_wireless_other radius_x_25 radius_x_75 radius_xdsl radius_xylogics radixchar rand random_bytes random_int range rar_host_beos rar_host_msdos rar_host_os2 rar_host_unix rar_host_win32 rar_wrapper_cache_stats rawurldecode rawurlencode read_exif_data readdir readfile readgzfile readline readline_add_history readline_callback_handler_install readline_callback_handler_remove readline_callback_read_char readline_clear_history readline_completion_function readline_info readline_list_history readline_on_new_line readline_read_history readline_redisplay readline_write_history readlink real realpath realpath_cache_get realpath_cache_size register_shutdown_function register_tick_function rename rename_function require require_once reset resource resourcebundle_count resourcebundle_create resourcebundle_get resourcebundle_get_error_code resourcebundle_get_error_message resourcebundle_locales restore_error_handler restore_exception_handler restore_include_path return rewind rewinddir rmdir round rpm_close rpm_get_tag rpm_is_valid rpm_open rpm_version rpmreader_arch rpmreader_archivesize rpmreader_basenames rpmreader_buildarchs rpmreader_buildhost rpmreader_buildtime rpmreader_cachectime rpmreader_cachepkgmtime rpmreader_cachepkgpath rpmreader_cachepkgsize rpmreader_changelogname rpmreader_changelogtext rpmreader_changelogtime rpmreader_classdict rpmreader_conflictflags rpmreader_conflictname rpmreader_conflictversion rpmreader_cookie rpmreader_copyright rpmreader_dependsdict rpmreader_description rpmreader_dirindexes rpmreader_dirnames rpmreader_distribution rpmreader_disturl rpmreader_epoch rpmreader_excludearch rpmreader_excludeos rpmreader_exclusivearch rpmreader_exclusiveos rpmreader_fileclass rpmreader_filecolors rpmreader_filecontexts rpmreader_filedependsn rpmreader_filedependsx rpmreader_filedevices rpmreader_fileflags rpmreader_filegroupname rpmreader_fileinodes rpmreader_filelangs rpmreader_filelinktos rpmreader_filemd5s rpmreader_filemodes rpmreader_f Line truncated
"soap_ssl_method_sslv3 soap_ssl_method_tls soap_use_xsi_array_type soap_wait_one_way_calls sock_dgram sock_raw sock_rdm sock_seqpacket sock_stream socket_accept socket_addrinuse socket_bind socket_clear_error socket_close socket_cmsg_space socket_connect socket_create socket_create_listen socket_create_pair socket_e2big socket_eacces socket_eaddrinuse socket_eaddrnotavail socket_eadv socket_eafnosupport socket_eagain socket_ealready socket_ebade socket_ebadf socket_ebadfd socket_ebadmsg socket_ebadr socket_ebadrqc socket_ebadslt socket_ebusy socket_echrng socket_ecomm socket_econnaborted socket_econnrefused socket_econnreset socket_edestaddrreq socket_ediscon socket_edquot socket_eduot socket_eexist socket_efault socket_ehostdown socket_ehostunreach socket_eidrm socket_einprogress socket_eintr socket_einval socket_eio socket_eisconn socket_eisdir socket_eisnam socket_el2hlt socket_el2nsync socket_el3hlt socket_el3rst socket_elnrng socket_eloop socket_emediumtype socket_emfile socket_emlink socket_emsgsize socket_emultihop socket_enametoolong socket_enetdown socket_enetreset socket_enetunreach socket_enfile socket_enoano socket_enobufs socket_enocsi socket_enodata socket_enodev socket_enoent socket_enolck socket_enolink socket_enomedium socket_enomem socket_enomsg socket_enonet socket_enoprotoopt socket_enospc socket_enosr socket_enostr socket_enosys socket_enotblk socket_enotconn socket_enotdir socket_enotempty socket_enotsock socket_enotty socket_enotuniq socket_enxio socket_eopnotsupp socket_eperm socket_epfnosupport socket_epipe socket_eproclim socket_eproto socket_eprotonosupport socket_eprotoopt socket_eprototype socket_eremchg socket_eremote socket_eremoteio socket_erestart socket_erofs socket_eshutdown socket_esocktnosupport socket_espipe socket_esrmnt socket_estale socket_estrpipe socket_etime socket_etimedout socket_etoomanyrefs socket_etoomyrefs socket_eunatch socket_eusers socket_ewouldblock socket_exdev socket_exfull socket_get_option socket_get_status socket_getopt socket_getpeername socket_getsockname socket_host_not_found socket_import_stream socket_last_error socket_listen socket_no_address socket_no_data socket_no_recovery socket_notinitialised socket_read socket_recv socket_recvfrom socket_recvmsg socket_select socket_send socket_sendmsg socket_sendto socket_set_block socket_set_blocking socket_set_nonblock socket_set_option socket_set_timeout socket_setopt socket_shutdown socket_strerror socket_sysnotready socket_try_again socket_vernotsupported socket_write sol_socket sol_tcp sol_udp somaxconn sort sort_asc sort_desc sort_flag_case sort_locale_string sort_natural sort_numeric sort_regular sort_string sortarrival sortcc sortdate sortfrom sortsize sortsubject sortto soundex spl_autoload spl_autoload_call spl_autoload_extensions spl_autoload_functions spl_autoload_register spl_autoload_unregister spl_classes spl_object_hash split spliti sprintf sql_best_rowid sql_bigint sql_binary sql_bit sql_char sql_concur_lock sql_concur_read_only sql_concur_rowver sql_concur_values sql_concurrency sql_cur_use_driver sql_cur_use_if_needed sql_cur_use_odbc sql_cursor_dynamic sql_cursor_forward_only sql_cursor_keyset_driven sql_cursor_static sql_cursor_type sql_date sql_decimal sql_double sql_ensure sql_fetch_first sql_fetch_next sql_float sql_index_all sql_index_unique sql_integer sql_keyset_size sql_longvarbinary sql_longvarchar sql_no_nulls sql_nullable sql_numeric sql_odbc_cursors sql_quick sql_real sql_regcase sql_rowver sql_scope_currow sql_scope_session sql_scope_transaction sql_smallint sql_time sql_timestamp sql_tinyint sql_type_date sql_type_time sql_type_timestamp sql_varbinary sql_varchar sql_wchar sql_wlongvarchar sql_wvarchar sqlbit sqlchar sqlflt4 sqlflt8 sqlint1 sqlint2 sqlint4 sqlite3_assoc sqlite3_blob sqlite3_both sqlite3_float sqlite3_integer sqlite3_null sqlite3_num sqlite3_open_create sqlite3_open_readonly sqlite3_open_readwrite sqlite3_text sqlite_abort sqlite_array_query sqlite_assoc sqlite_auth sqlite_both sqlite_busy sqlite_busy_timeout sqlite_cantopen sqlite_changes sqlite_close sqlite_column sqlite_constraint sqlite_corrupt sqlite_create_aggregate sqlite_create_function sqlite_current sqlite_done sqlite_empty sqlite_error sqlite_error_string sqlite_escape_string sqlite_exec sqlite_factory sqlite_fetch_all sqlite_fetch_array sqlite_fetch_column_types sqlite_fetch_object sqlite_fetch_single sqlite_fetch_string sqlite_field_name sqlite_format sqlite_full sqlite_has_more sqlite_has_prev sqlite_internal sqlite_interrupt sqlite_ioerr sqlite_key sqlite_last_error sqlite_last_insert_rowid sqlite_libencoding sqlite_libversion sqlite_locked sqlite_mismatch sqlite_misuse sqlite_next sqlite_nolfs sqlite_nomem sqlite_notadb sqlite_notfound sqlite_num sqlite_num_fields sqlite_num_rows sqlite_ok sqlite_open sqlite_perm sqlite_popen sqlite_prev sqlite_protocol sqlite_query sqlite_readonly sqlite_rewind sqlite_row sqlite_schema sqlite_seek sqlite_single_query sqlite_toobig sqlit Line truncated
"str_ireplace str_pad str_pad_both str_pad_left str_pad_right str_repeat str_replace str_rot13 str_shuffle str_split str_word_count strcasecmp strchr strcmp strcoll strcspn stream_bucket_append stream_bucket_make_writeable stream_bucket_new stream_bucket_prepend stream_buffer_full stream_buffer_line stream_buffer_none stream_cast_as_stream stream_cast_for_select stream_client_async_connect stream_client_connect stream_client_persistent stream_context_create stream_context_get_default stream_context_get_options stream_context_get_params stream_context_set_default stream_context_set_option stream_context_set_params stream_copy_to_stream stream_crypto_method_any_client stream_crypto_method_any_server stream_crypto_method_sslv23_client stream_crypto_method_sslv23_server stream_crypto_method_sslv2_client stream_crypto_method_sslv2_server stream_crypto_method_sslv3_client stream_crypto_method_sslv3_server stream_crypto_method_tls_client stream_crypto_method_tls_server stream_crypto_method_tlsv1_0_client stream_crypto_method_tlsv1_0_server stream_crypto_method_tlsv1_1_client stream_crypto_method_tlsv1_1_server stream_crypto_method_tlsv1_2_client stream_crypto_method_tlsv1_2_server stream_encoding stream_enforce_safe_mode stream_filter_all stream_filter_append stream_filter_prepend stream_filter_read stream_filter_register stream_filter_remove stream_filter_write stream_get_contents stream_get_filters stream_get_line stream_get_meta_data stream_get_transports stream_get_wrappers stream_ignore_url stream_ipproto_icmp stream_ipproto_ip stream_ipproto_raw stream_ipproto_tcp stream_ipproto_udp stream_is_local stream_is_url stream_meta_access stream_meta_group stream_meta_group_name stream_meta_owner stream_meta_owner_name stream_meta_touch stream_mkdir_recursive stream_must_seek stream_notification_callback stream_notify_auth_required stream_notify_auth_result stream_notify_completed stream_notify_connect stream_notify_failure stream_notify_file_size_is stream_notify_mime_type_is stream_notify_progress stream_notify_redirected stream_notify_resolve stream_notify_severity_err stream_notify_severity_info stream_notify_severity_warn stream_oob stream_option_blocking stream_option_read_buffer stream_option_read_timeout stream_option_write_buffer stream_peek stream_pf_inet stream_pf_inet6 stream_pf_unix stream_register_wrapper stream_report_errors stream_resolve_include_path stream_select stream_server_bind stream_server_listen stream_set_blocking stream_set_chunk_size stream_set_read_buffer stream_set_timeout stream_set_write_buffer stream_shut_rd stream_shut_rdwr stream_shut_wr stream_sock_dgram stream_sock_raw stream_sock_rdm stream_sock_seqpacket stream_sock_stream stream_socket_accept stream_socket_client stream_socket_enable_crypto stream_socket_get_name stream_socket_pair stream_socket_recvfrom stream_socket_sendto stream_socket_server stream_socket_shutdown stream_supports_lock stream_url_stat_link stream_url_stat_quiet stream_use_path stream_wrapper_register stream_wrapper_restore stream_wrapper_unregister strftime string strip_tags stripcslashes stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime strtoupper strtr strval substr substr_compare substr_count substr_replace suhosin_patch suhosin_patch_version summary_trace sunfuncs_ret_double sunfuncs_ret_string sunfuncs_ret_timestamp svn_add svn_auth_get_parameter svn_auth_param_config svn_auth_param_config_dir svn_auth_param_default_password svn_auth_param_default_username svn_auth_param_dont_store_passwords svn_auth_param_no_auth_cache svn_auth_param_non_interactive svn_auth_param_server_group svn_auth_param_ssl_server_cert_info svn_auth_param_ssl_server_failures svn_auth_set_parameter svn_blame svn_cat svn_checkout svn_cleanup svn_client_version svn_commit svn_delete svn_diff svn_export svn_fs_abort_txn svn_fs_apply_text svn_fs_begin_txn2 svn_fs_change_node_prop svn_fs_check_path svn_fs_config_fs_type svn_fs_contents_changed svn_fs_copy svn_fs_delete svn_fs_dir_entries svn_fs_file_contents svn_fs_file_length svn_fs_is_dir svn_fs_is_file svn_fs_make_dir svn_fs_make_file svn_fs_node_created_rev svn_fs_node_prop svn_fs_props_changed svn_fs_revision_prop svn_fs_revision_root svn_fs_txn_root svn_fs_type_bdb svn_fs_type_fsfs svn_fs_youngest_rev svn_import svn_log svn_ls svn_mkdir svn_node_dir svn_node_file svn_node_none svn_node_unknown svn_prop_revision_author svn_prop_revision_date svn_prop_revision_log svn_prop_revision_orig_date svn_repos_create svn_repos_fs svn_repos_fs_begin_txn_for_commit svn_repos_fs_commit_txn svn_repos_hotcopy svn_repos_open svn_repos_recover svn_revert svn_revision_head svn_status svn_update svn_wc_status_added svn_wc_status_conflicted svn_wc_status_deleted svn_wc_status_external svn_wc_status_ignored svn_wc_status_incomplete svn_wc_status_merged svn_wc_status_missing svn_wc_status_modified svn_wc_statu Line truncated
"tidy_tag_optgroup tidy_tag_option tidy_tag_p tidy_tag_param tidy_tag_plaintext tidy_tag_pre tidy_tag_q tidy_tag_rb tidy_tag_rbc tidy_tag_rp tidy_tag_rt tidy_tag_rtc tidy_tag_ruby tidy_tag_s tidy_tag_samp tidy_tag_script tidy_tag_select tidy_tag_server tidy_tag_servlet tidy_tag_small tidy_tag_spacer tidy_tag_span tidy_tag_strike tidy_tag_strong tidy_tag_style tidy_tag_sub tidy_tag_sup tidy_tag_table tidy_tag_tbody tidy_tag_td tidy_tag_textarea tidy_tag_tfoot tidy_tag_th tidy_tag_thead tidy_tag_title tidy_tag_tr tidy_tag_tt tidy_tag_u tidy_tag_ul tidy_tag_unknown tidy_tag_var tidy_tag_wbr tidy_tag_xmp tidy_warning_count time time_nanosleep time_sleep_until timezone_abbreviations_list timezone_identifiers_list timezone_location_get timezone_name_from_abbr timezone_name_get timezone_offset_get timezone_open timezone_transitions_get timezone_version_get timing_trace tmpfile token_get_all token_name touch trader_acos trader_ad trader_add trader_adosc trader_adx trader_adxr trader_apo trader_aroon trader_aroonosc trader_asin trader_atan trader_atr trader_avgprice trader_bbands trader_beta trader_bop trader_cci trader_cdl2crows trader_cdl3blackcrows trader_cdl3inside trader_cdl3linestrike trader_cdl3outside trader_cdl3starsinsouth trader_cdl3whitesoldiers trader_cdlabandonedbaby trader_cdladvanceblock trader_cdlbelthold trader_cdlbreakaway trader_cdlclosingmarubozu trader_cdlconcealbabyswall trader_cdlcounterattack trader_cdldarkcloudcover trader_cdldoji trader_cdldojistar trader_cdldragonflydoji trader_cdlengulfing trader_cdleveningdojistar trader_cdleveningstar trader_cdlgapsidesidewhite trader_cdlgravestonedoji trader_cdlhammer trader_cdlhangingman trader_cdlharami trader_cdlharamicross trader_cdlhighwave trader_cdlhikkake trader_cdlhikkakemod trader_cdlhomingpigeon trader_cdlidentical3crows trader_cdlinneck trader_cdlinvertedhammer trader_cdlkicking trader_cdlkickingbylength trader_cdlladderbottom trader_cdllongleggeddoji trader_cdllongline trader_cdlmarubozu trader_cdlmatchinglow trader_cdlmathold trader_cdlmorningdojistar trader_cdlmorningstar trader_cdlonneck trader_cdlpiercing trader_cdlrickshawman trader_cdlrisefall3methods trader_cdlseparatinglines trader_cdlshootingstar trader_cdlshortline trader_cdlspinningtop trader_cdlstalledpattern trader_cdlsticksandwich trader_cdltakuri trader_cdltasukigap trader_cdlthrusting trader_cdltristar trader_cdlunique3river trader_cdlupsidegap2crows trader_cdlxsidegap3methods trader_ceil trader_cmo trader_compatibility_default trader_compatibility_metastock trader_correl trader_cos trader_cosh trader_dema trader_div trader_dx trader_ema trader_err_alloc_err trader_err_bad_object trader_err_bad_param trader_err_func_not_found trader_err_group_not_found trader_err_input_not_all_initialize trader_err_internal_error trader_err_invalid_handle trader_err_invalid_list_type trader_err_invalid_param_function trader_err_invalid_param_holder trader_err_invalid_param_holder_type trader_err_lib_not_initialize trader_err_not_supported trader_err_out_of_range_end_index trader_err_out_of_range_start_index trader_err_output_not_all_initialize trader_err_success trader_err_unknown_error trader_errno trader_exp trader_floor trader_func_unst_adx trader_func_unst_adxr trader_func_unst_all trader_func_unst_atr trader_func_unst_cmo trader_func_unst_dx trader_func_unst_ema trader_func_unst_ht_dcperiod trader_func_unst_ht_dcphase trader_func_unst_ht_phasor trader_func_unst_ht_sine trader_func_unst_ht_trendline trader_func_unst_ht_trendmode trader_func_unst_kama trader_func_unst_mama trader_func_unst_mfi trader_func_unst_minus_di trader_func_unst_minus_dm trader_func_unst_natr trader_func_unst_none trader_func_unst_plus_di trader_func_unst_plus_dm trader_func_unst_rsi trader_func_unst_stochrsi trader_func_unst_t3 trader_get_compat trader_get_unstable_period trader_ht_dcperiod trader_ht_dcphase trader_ht_phasor trader_ht_sine trader_ht_trendline trader_ht_trendmode trader_kama trader_linearreg trader_linearreg_angle trader_linearreg_intercept trader_linearreg_slope trader_ln trader_log10 trader_ma trader_ma_type_dema trader_ma_type_ema trader_ma_type_kama trader_ma_type_mama trader_ma_type_sma trader_ma_type_t3 trader_ma_type_tema trader_ma_type_trima trader_ma_type_wma trader_macd trader_macdext trader_macdfix trader_mama trader_mavp trader_max trader_maxindex trader_medprice trader_mfi trader_midpoint trader_midprice trader_min trader_minindex trader_minmax trader_minmaxindex trader_minus_di trader_minus_dm trader_mom trader_mult trader_natr trader_obv trader_plus_di trader_plus_dm trader_ppo trader_real_max trader_real_min trader_roc trader_rocp trader_rocr trader_rocr100 trader_rsi trader_sar trader_sarext trader_set_compat trader_set_unstable_period trader_sin trader_sinh trader_sma trader_sqrt trader_stddev trader_stoch trader_stochf trader_stochrsi trader_sub trader_sum trader_t3 trader_tan trader_tanh trader_tema trader_trange trader_trima trader_trix trader_tsf trader_typp Line truncated
"variant_add variant_and variant_cast variant_cat variant_cmp variant_date_from_timestamp variant_date_to_timestamp variant_div variant_eqv variant_fix variant_get_type variant_idiv variant_imp variant_int variant_mod variant_mul variant_neg variant_not variant_or variant_pow variant_round variant_set variant_set_type variant_sub variant_xor version_compare vfprintf virtual void vpopmail_add_alias_domain vpopmail_add_alias_domain_ex vpopmail_add_domain vpopmail_add_domain_ex vpopmail_add_user vpopmail_alias_add vpopmail_alias_del vpopmail_alias_del_domain vpopmail_alias_get vpopmail_alias_get_all vpopmail_auth_user vpopmail_del_domain vpopmail_del_domain_ex vpopmail_del_user vpopmail_error vpopmail_passwd vpopmail_set_user_quota vprintf vsprintf vt_array vt_bool vt_bstr vt_byref vt_cy vt_date vt_decimal vt_dispatch vt_empty vt_error vt_i1 vt_i2 vt_i4 vt_int vt_null vt_r4 vt_r8 vt_ui1 vt_ui2 vt_ui4 vt_uint vt_unknown vt_variant wddx_add_vars wddx_deserialize wddx_packet_end wddx_packet_start wddx_serialize_value wddx_serialize_vars while win32_above_normal_priority_class win32_below_normal_priority_class win32_continue_service win32_create_service win32_delete_service win32_error_access_denied win32_error_circular_dependency win32_error_database_does_not_exist win32_error_dependent_services_running win32_error_duplicate_service_name win32_error_failed_service_controller_connect win32_error_insufficient_buffer win32_error_invalid_data win32_error_invalid_handle win32_error_invalid_level win32_error_invalid_name win32_error_invalid_parameter win32_error_invalid_service_account win32_error_invalid_service_control win32_error_path_not_found win32_error_service_already_running win32_error_service_cannot_accept_ctrl win32_error_service_database_locked win32_error_service_dependency_deleted win32_error_service_dependency_fail win32_error_service_disabled win32_error_service_does_not_exist win32_error_service_exists win32_error_service_logon_failed win32_error_service_marked_for_delete win32_error_service_no_thread win32_error_service_not_active win32_error_service_request_timeout win32_error_shutdown_in_progress win32_get_last_control_message win32_high_priority_class win32_idle_priority_class win32_no_error win32_normal_priority_class win32_pause_service win32_ps_list_procs win32_ps_stat_mem win32_ps_stat_proc win32_query_service_status win32_realtime_priority_class win32_service_accept_pause_continue win32_service_accept_preshutdown win32_service_accept_shutdown win32_service_accept_stop win32_service_auto_start win32_service_continue_pending win32_service_control_continue win32_service_control_interrogate win32_service_control_pause win32_service_control_preshutdown win32_service_control_shutdown win32_service_control_stop win32_service_demand_start win32_service_disabled win32_service_error_ignore win32_service_error_normal win32_service_interactive_process win32_service_pause_pending win32_service_paused win32_service_running win32_service_runs_in_system_process win32_service_start_pending win32_service_stop_pending win32_service_stopped win32_service_win32_own_process win32_service_win32_own_process_interactive win32_set_service_status win32_start_service win32_start_service_ctrl_dispatcher win32_stop_service wincache_fcache_fileinfo wincache_fcache_meminfo wincache_lock wincache_ocache_fileinfo wincache_ocache_meminfo wincache_refresh_if_changed wincache_rplist_fileinfo wincache_rplist_meminfo wincache_scache_info wincache_scache_meminfo wincache_ucache_add wincache_ucache_cas wincache_ucache_clear wincache_ucache_dec wincache_ucache_delete wincache_ucache_exists wincache_ucache_get wincache_ucache_inc wincache_ucache_info wincache_ucache_meminfo wincache_ucache_set wincache_unlock wnohang wordwrap wsdl_cache_both wsdl_cache_disk wsdl_cache_memory wsdl_cache_none wuntraced x509_purpose_any x509_purpose_crl_sign x509_purpose_ns_ssl_server x509_purpose_smime_encrypt x509_purpose_smime_sign x509_purpose_ssl_client x509_purpose_ssl_server xattr_create xattr_dontfollow xattr_get xattr_list xattr_remove xattr_replace xattr_root xattr_set xattr_supported xdiff_file_bdiff xdiff_file_bdiff_size xdiff_file_bpatch xdiff_file_diff xdiff_file_diff_binary xdiff_file_merge3 xdiff_file_patch xdiff_file_patch_binary xdiff_file_rabdiff xdiff_patch_normal xdiff_patch_reverse xdiff_string_bdiff xdiff_string_bdiff_size xdiff_string_bpatch xdiff_string_diff xdiff_string_diff_binary xdiff_string_merge3 xdiff_string_patch xdiff_string_patch_binary xdiff_string_rabdiff xhprof_disable xhprof_enable xhprof_sample_disable xhprof_sample_enable xml_attribute_cdata xml_attribute_decl_node xml_attribute_entity xml_attribute_enumeration xml_attribute_id xml_attribute_idref xml_attribute_idrefs xml_attribute_nmtoken xml_attribute_nmtokens xml_attribute_node xml_attribute_notation xml_cdata_section_node xml_comment_node xml_document_frag_node xml_document_node xml_document_type_node xml_dtd_node xml_element_decl_node xml_elem Line truncated
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.WindowsPowerShell, KeyWords = "break continue do else elseif filter for foreach function if in return switch until where while"}, // Name: instre1
new ScintillaKeyWords {KeyWordSetIndex = 1, LexerType = LexerType.WindowsPowerShell, KeyWords = "add-content add-history add-member add-pssnapin clear-content clear-item clear-itemproperty clear-variable compare-object convertfrom-securestring convert-path convertto-html convertto-securestring copy-item copy-itemproperty export-alias export-clixml export-console export-csv foreach-object format-custom format-list format-table format-wide get-acl get-alias get-authenticodesignature get-childitem get-command get-content get-credential get-culture get-date get-eventlog get-executionpolicy get-help get-history get-host get-item get-itemproperty get-location get-member get-pfxcertificate get-process get-psdrive get-psprovider get-pssnapin get-service get-tracesource get-uiculture get-unique get-variable get-wmiobject group-object import-alias import-clixml import-csv invoke-expression invoke-history invoke-item join-path measure-command measure-object move-item move-itemproperty new-alias new-item new-itemproperty new-object new-psdrive new-service new-timespan new-variable out-default out-file out-host out-null out-printer out-string pop-location push-location read-host remove-item remove-itemproperty remove-psdrive remove-pssnapin remove-variable rename-item rename-itemproperty resolve-path restart-service resume-service select-object select-string set-acl set-alias set-authenticodesignature set-content set-date set-executionpolicy set-item set-itemproperty set-location set-psdebug set-service set-tracesource set-variable sort-object split-path start-service start-sleep start-transcript stop-process stop-service stop-transcript suspend-service tee-object test-path trace-command update-formatdata update-typedata where-object write-debug write-error write-host write-output write-progress write-verbose write-warning"}, // Name: instre2
new ScintillaKeyWords {KeyWordSetIndex = 2, LexerType = LexerType.WindowsPowerShell, KeyWords = "ac asnp clc cli clp clv cpi cpp cvpa diff epal epcsv fc fl foreach ft fw gal gc gci gcm gdr ghy gi gl gm gp gps group gsv gsnp gu gv gwmi iex ihy ii ipal ipcsv mi mp nal ndr ni nv oh rdr ri rni rnp rp rsnp rv rvpa sal sasv sc select si sl sleep sort sp spps spsv sv tee where write cat cd clear cp h history kill lp ls mount mv popd ps pushd pwd r rm rmdir echo cls chdir copy del dir erase move rd ren set type"}, // Name: type1
new ScintillaKeyWords {KeyWordSetIndex = 3, LexerType = LexerType.WindowsPowerShell, KeyWords = "component description example externalhelp forwardhelpcategory forwardhelptargetname functionality inputs link notes outputs parameter remotehelprunspace role synopsis"}, // Name: type4
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.Python, KeyWords = "and as assert break class continue def del elif else except exec False finally for from global if import in is lambda None not or pass print raise return True try while with yield async await"}, // Name: instre1
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.SQL, KeyWords = "abs absolute access acos add add_months adddate admin after aggregate all allocate alter and any app_name are array as asc ascii asin assertion at atan atn2 audit authid authorization autonomous_transaction avg before begin benchmark between bfilename bigint bin binary binary_checksum binary_integer bit bit_count bit_and bit_or blob body boolean both breadth bulk by call cascade cascaded case cast catalog ceil ceiling char char_base character charindex chartorowid check checksum checksum_agg chr class clob close cluster coalesce col_length col_name collate collation collect column comment commit completion compress concat concat_ws connect connection constant constraint constraints constructorcreate contains containsable continue conv convert corr corresponding cos cot count count_big covar_pop covar_samp create cross cube cume_dist current current_date current_path current_role current_time current_timestamp current_user currval cursor cycle data datalength databasepropertyex date date_add date_format date_sub dateadd datediff datename datepart datetime day db_id db_name deallocate dec declare decimal decode default deferrable deferred degrees delete dense_rank depth deref desc describe descriptor destroy destructor deterministic diagnostics dictionary disconnect difference distinct do domain double drop dump dynamic each else elsif empth encode encrypt end end-exec equals escape every except exception exclusive exec execute exists exit exp export_set extends external extract false fetch first first_value file float floor file_id file_name filegroup_id filegroup_name filegroupproperty fileproperty for forall foreign format formatmessage found freetexttable from from_days fulltextcatalog fulltextservice function general get get_lock getdate getansinull getutcdate global go goto grant greatest group grouping having heap hex hextoraw host host_id host_name hour ident_incr ident_seed ident_current identified identity if ifnull ignore immediate in increment index index_col indexproperty indicator initcap initial initialize initially inner inout input insert instr instrb int integer interface intersect interval into is is_member is_srvrolemember is_null is_numeric isdate isnull isolation iterate java join key lag language large last last_day last_value lateral lcase lead leading least left len length lengthb less level like limit limited ln lpad local localtime localtimestamp locator lock log log10 long loop lower ltrim make_ref map match max maxextents merge mid min minus minute mlslabel mod mode modifies modify module month months_between names national natural naturaln nchar nclob new new_time newid next next_day nextval no noaudit nocompress nocopy none not nowait null nullif number number_base numeric nvl nvl2 nvarchar object object_id object_name object_property ocirowid oct of off offline old on online only opaque open operator operation option or ord order ordinalityorganization others out outer output package pad parameter parameters partial partition path pctfree percent_rank pi pls_integer positive positiven postfix pow power pragma precision prefix preorder prepare preserve primary prior private privileges procedure public radians raise rand range rank ratio_to_export raw rawtohex read reads real record recursive ref references referencing reftohex relative release release_lock rename repeat replace resource restrict result return returns reverse revoke right rollback rollup round routine row row_number rowid rowidtochar rowlabel rownum rows rowtype rpad rtrim savepoint schema scroll scope search second section seddev_samp select separate sequence session session_user set sets share sign sin sinh size smallint some soundex space specific specifictype sql sqlcode sqlerrm sqlexception sqlstate sqlwarning sqrt start state statement static std stddev stdev_pop strcmp structure subdate substr substrb substring substring_index subtype successful sum synonym sys_context sys_guid sysdate system_user table tan tanh temporary terminate than then time timestamp timezone_abbr timezone_minute timezone_hour timezone_region tinyint to to_char to_date to_days to_number to_single_byte trailing transaction translate translation treat trigger trim true trunc truncate type ucase uid under union unique uniqueidentifier unknown unnest update upper usage use user userenv using validate value values var_pop var_samp varbinary varchar varchar2 variable variance varying view vsize when whenever where with without while work write year zone autoincrement"}, // Name: instre1, self added: 'autoincrement'..
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.YAML, KeyWords = "true false yes no"}, // Name: instre1
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.Java, KeyWords = "instanceof assert if else switch case default break goto return for while do continue new throw throws try catch finally this super extends implements import true false null"}, // Name: instre1
new ScintillaKeyWords {KeyWordSetIndex = 1, LexerType = LexerType.Java, KeyWords = "package transient strictfp void char short int long double float const static volatile byte boolean class interface native private protected public final abstract synchronized enum"}, // Name: type1
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.JavaScript, KeyWords = "abstract async await boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for foreach from function goto if implements import in instanceof int interface let long native new null of package private protected public return short static super switch synchronized this throw throws transient try typeof var void volatile while with true false prototype yield"}, // Name: instre1
new ScintillaKeyWords {KeyWordSetIndex = 1, LexerType = LexerType.JavaScript, KeyWords = "Array Date eval hasOwnProperty Infinity isFinite isNaN isPrototypeOf Math NaN Number Object prototype String toString undefined valueOf"}, // Name: type1
new ScintillaKeyWords {KeyWordSetIndex = 2, LexerType = LexerType.JavaScript, KeyWords = "alert all anchor anchors area assign blur button checkbox clearInterval clearTimeout clientInformation close closed confirm constructor crypto decodeURI decodeURIComponent defaultStatus document element elements embed embeds encodeURI encodeURIComponent escape event fileUpload focus form forms frame innerHeight innerWidth layer layers link location mimeTypes navigate navigator frames frameRate hidden history image images offscreenBuffering onblur onclick onerror onfocus onkeydown onkeypress onkeyup onmouseover onload onmouseup onmousedown onsubmit open opener option outerHeight outerWidth packages pageXOffset pageYOffset parent parseFloat parseInt password pkcs11 plugin prompt propertyIsEnum radio reset screenX screenY scroll secure select self setInterval setTimeout status submit taint text textarea top unescape untaint window"}, // Name: instre2
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.Css, KeyWords = "-khtml-background-clip -khtml-background-origin -khtml-background-size -khtml-border-bottom-left-radius -khtml-border-bottom-right-radius -khtml-border-radius -khtml-border-top-left-radius -khtml-border-top-right-radius -khtml-opacity -moz-animation -moz-animation-delay -moz-animation-direction -moz-animation-duration -moz-animation-fill-mode -moz-animation-iteration-count -moz-animation-name -moz-animation-play-state -moz-animation-timing-function -moz-appearance -moz-background-clip -moz-background-inline-policy -moz-background-origin -moz-background-size -moz-binding -moz-border-bottom-colors -moz-border-end -moz-border-end-color -moz-border-end-style -moz-border-end-width -moz-border-image -moz-border-left-colors -moz-border-radius -moz-border-radius-bottomleft -moz-border-radius-bottomright -moz-border-radius-topleft -moz-border-radius-topright -moz-border-right-colors -moz-border-start -moz-border-start-color -moz-border-start-style -moz-border-start-width -moz-border-top-colors -moz-box-align -moz-box-direction -moz-box-flex -moz-box-flex-group -moz-box-flexgroup -moz-box-ordinal-group -moz-box-orient -moz-box-pack -moz-box-shadow -moz-box-sizing -moz-column-count -moz-column-gap -moz-column-rule -moz-column-rule-color -moz-column-rule-style -moz-column-rule-width -moz-column-width -moz-float-edge -moz-force-broken-image-icon -moz-image-region -moz-linear-gradient -moz-margin-end -moz-margin-start -moz-opacity -moz-outline -moz-outline-color -moz-outline-offset -moz-outline-radius -moz-outline-radius-bottomleft -moz-outline-radius-bottomright -moz-outline-radius-topleft -moz-outline-radius-topright -moz-outline-style -moz-outline-width -moz-padding-end -moz-padding-start -moz-radial-gradient -moz-stack-sizing -moz-text-decoration-color -moz-text-decoration-line -moz-text-decoration-style -moz-transform -moz-transform-origin -moz-transition -moz-transition-delay -moz-transition-duration -moz-transition-property -moz-transition-timing-function -moz-user-focus -moz-user-input -moz-user-modify -moz-user-select -moz-window-shadow -ms-filter -ms-transform -ms-transform-origin -o-transform -webkit-animation -webkit-animation-delay -webkit-animation-direction -webkit-animation-duration -webkit-animation-fill-mode -webkit-animation-iteration-count -webkit-animation-name -webkit-animation-play-state -webkit-animation-timing-function -webkit-appearance -webkit-backface-visibility -webkit-background-clip -webkit-background-composite -webkit-background-origin -webkit-background-size -webkit-border-bottom-left-radius -webkit-border-bottom-right-radius -webkit-border-horizontal-spacing -webkit-border-image -webkit-border-radius -webkit-border-top-left-radius -webkit-border-top-right-radius -webkit-border-vertical-spacing -webkit-box-align -webkit-box-direction -webkit-box-flex -webkit-box-flex-group -webkit-box-lines -webkit-box-ordinal-group -webkit-box-orient -webkit-box-pack -webkit-box-reflect -webkit-box-shadow -webkit-box-sizing -webkit-column-break-after -webkit-column-break-before -webkit-column-break-inside -webkit-column-count -webkit-column-gap -webkit-column-rule -webkit-column-rule-color -webkit-column-rule-style -webkit-column-rule-width -webkit-column-width -webkit-columns -webkit-dashboard-region -webkit-font-smoothing -webkit-gradient -webkit-line-break -webkit-linear-gradient -webkit-margin-bottom-collapse -webkit-margin-collapse -webkit-margin-start -webkit-margin-top-collapse -webkit-marquee -webkit-marquee-direction -webkit-marquee-increment -webkit-marquee-repetition -webkit-marquee-speed -webkit-marquee-style -webkit-mask -webkit-mask-attachment -webkit-mask-box-image -webkit-mask-clip -webkit-mask-composite -webkit-mask-image -webkit-mask-origin -webkit-mask-position -webkit-mask-position-x -webkit-mask-position-y -webkit-mask-repeat -webkit-mask-size -webkit-nbsp-mode -webkit-padding-start -webkit-perspective -webkit-perspective-origin -webkit-radial-gradient -webkit-rtl-ordering -webkit-tap-highlight-color -webkit-text-fill-color -webkit-text-security -webkit-text-size-adjust -webkit-text-stroke -webkit-text-stroke-color -webkit-text-stroke-width -webkit-touch-callout -webkit-transform -webkit-transform-origin -webkit-transform-origin-x -webkit-transform-origin-y -webkit-transform-origin-z -webkit-transform-style -webkit-transition -webkit-transition-delay -webkit-transition-duration -webkit-transition-property -webkit-transition-timing-function -webkit-user-drag -webkit-user-modify -webkit-user-select align-content align-items align-self alignment-adjust alignment-baseline all animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function appearance azimuth backface-visibility background background-attachment background-blend-mode background-break background-clip background-color backgr Line truncated
new ScintillaKeyWords {KeyWordSetIndex = 1, LexerType = LexerType.Css, KeyWords = "active after before check checked disabled empty enabled first first-child first-letter first-line first-of-type focus hover indeterminate invalid lang last-child last-of-type left link not nth-child nth-last-child nth-of-type nth-last-of-type only-child only-of-type optional read-only read-write required right root selection target valid visited"}, // Name: instre2
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.VbDotNet, KeyWords = "addhandler addressof alias and andalso as boolean by byref byte byval call case catch cbool cbyte cchar cdate cdbl cdec char cint class clng cobj const continue csbyte cshort csng cstr ctype cuint culng cushort date decimal declare default delegate dim directcast do double each else elseif end endif enum erase error event exit false finally for friend function get gettype global gosub goto handles if implements imports in inherits integer interface is isnot let lib like long loop me mod module mustinherit mustoverride mybase myclass namespace narrowing new next not nothing notinheritable notoverridable object of on operator option optional or orelse out overloads overridable overrides paramarray partial private property protected public raiseevent readonly redim rem removehandler resume return sbyte select set shadows shared short single static step stop strict string structure sub synclock then throw to true try trycast typeof uinteger ulong ushort using variant wend when while widening with withevents writeonly xor attribute begin currency implement load lset rset type unload aggregate ansi assembly async auto await binary compare custom distinct equals explicit from group into isfalse istrue iterator join key mid off order preserve skip take text unicode until where yield"}, // Name: instre1
new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.Json, KeyWords = "false null true"}, // Name: instre1
new ScintillaKeyWords {KeyWordSetIndex = 1, LexerType = LexerType.Json, KeyWords = "@id @context @type @value @language @container @list @set @reverse @index @base @vocab @graph"}, // Name: instre1
// new ScintillaKeyWords {KeyWordSetIndex = 0, LexerType = LexerType.xxx, KeyWords = ""},
});
}
}
@@ -0,0 +1,145 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
namespace VPKSoft.ScintillaLexers
{
/// <summary>
/// A class containing the <see cref="LexerType"/> enumeration values.
/// </summary>
public class LexerEnumerations
{
/// <summary>
/// An enumeration of currently supported Scintilla lexers.
/// </summary>
public enum LexerType
{
/// <summary>
/// An unknown language and / or file.
/// </summary>
Unknown = 0, // previously: 0
/// <summary>
/// The C# programming language.
/// </summary>
Cs = 1, // previously: 1
/// <summary>
/// The C++ programming language.
/// </summary>
Cpp = 2, // previously: 2
/// <summary>
/// The eXtensible Markup Language.
/// </summary>
Xml = 3, // previously: 4
/// <summary>
/// A plain text document.
/// </summary>
Text = 4, // previously: 8
/// <summary>
/// The NSIS (Nullsoft Scriptable Install System).
/// </summary>
Nsis = 5, // previously: 16
/// <summary>
/// The Structured Query Language (SQL).
/// </summary>
SQL = 6, // previously: 32
/// <summary>
/// A batch script file.
/// </summary>
Batch = 7, // previously: 64
/// <summary>
/// A lexer for the Pascal programming language.
/// </summary>
Pascal = 8, // previously: 128
/// <summary>
/// A lexer for the PHP programming language.
/// </summary>
PHP = 9, // previously: 256
/// <summary>
/// A lexer type for the HTML (Hypertext Markup Language).
/// </summary>
HTML = 10, // previously: 512
/// <summary>
/// A lexer type for the Windows PowerShell scripting language.
/// </summary>
WindowsPowerShell = 11,
/// <summary>
/// An INI file lexer.
/// </summary>
INI = 12,
/// <summary>
/// A lexer for the Python programming language.
/// </summary>
Python = 13,
/// <summary>
/// A lexer for the YAML Ain't Markup Language.
/// </summary>
YAML = 14,
/// <summary>
/// A lexer for the Java programming language.
/// </summary>
Java = 15,
/// <summary>
/// A lexer for the JavaScript scripting language.
/// </summary>
JavaScript = 16,
/// <summary>
/// A lexer for the Cascading Style Sheets (CSS).
/// </summary>
Css = 17,
/// <summary>
/// A lexer for the Inno Setup.
/// </summary>
InnoSetup = 18,
/// <summary>
/// The Visual Basic .NET programming language.
/// </summary>
VbDotNet = 19,
/// <summary>
/// The JavaScript Object Notation (JSON) data format.
/// </summary>
Json,
}
}
}
@@ -0,0 +1,300 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
// (C)::https://github.com/jacobslusser/ScintillaNET
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using ScintillaNET;
using VPKSoft.ScintillaLexers.CreateSpecificLexer;
using VPKSoft.ScintillaLexers.HelperClasses;
using VPKSoft.ScintillaLexers.ScintillaNotepadPlusPlus;
using static VPKSoft.ScintillaLexers.LexerEnumerations;
// (C)::https://github.com/notepad-plus-plus/notepad-plus-plus
// (C)::https://notepad-plus-plus.org
// (C)::https://github.com/jacobslusser/ScintillaNET
// (C)::https://www.scintilla.org
namespace VPKSoft.ScintillaLexers
{
/// <summary>
/// A class for setting a lexer for a Scintilla class instance.
/// </summary>
public static class ScintillaLexers
{
/// <summary>
/// Gets or sets the value of a LexerColors class instance.
/// </summary>
public static LexerColors.LexerColors LexerColors { get; private set; } = new LexerColors.LexerColors();
/// <summary>
/// Creates the lexer from XML file used by the Notepad++ software.
/// </summary>
/// <param name="scintilla">The <see cref="Scintilla"/> which lexer style to set.</param>
/// <param name="lexerType">Type of the lexer.</param>
/// <param name="fileName">A file name to get the lexer type from.</param>
/// <returns><c>true</c> if the operation was successful, <c>false</c> otherwise.</returns>
public static bool CreateLexerFromFile(Scintilla scintilla, LexerType lexerType,
string fileName)
{
return CreateLexerFromFile(scintilla, lexerType, fileName, true, true, true, true, true);
}
/// <summary>
/// Creates the lexer from XML file used by the Notepad++ software.
/// </summary>
/// <param name="scintilla">The <see cref="Scintilla"/> which lexer style to set.</param>
/// <param name="fileName">A file name to get the lexer type from.</param>
/// <param name="definitionFile">A XML file to load the lexer style from.</param>
/// <returns><c>true</c> if the operation was successful, <c>false</c> otherwise.</returns>
public static bool CreateLexerFromFile(Scintilla scintilla, string fileName, string definitionFile)
{
return CreateLexerFromFile(scintilla, LexerFileExtensions.LexerTypeFromFileName(fileName), definitionFile, true, true, true, true, true);
}
/// <summary>
/// Creates the lexer from XML file used by the Notepad++ software.
/// </summary>
/// <param name="scintilla">The <see cref="Scintilla"/> which lexer style to set.</param>
/// <param name="fileName">A file name to get the lexer type from.</param>
/// <param name="definitionFile">A XML file to load the lexer style from.</param>
/// <param name="useGlobalOverride">A flag indicating whether the style "Global override" should be set for the lexer from the XML document.</param>
/// <param name="font">A flag indicating whether to use the defined font name from the XML document or not.</param>
/// <returns><c>true</c> if the operation was successful, <c>false</c> otherwise.</returns>
public static bool CreateLexerFromFile(Scintilla scintilla, string fileName, string definitionFile, bool useGlobalOverride, bool font)
{
return CreateLexerFromFile(scintilla, LexerFileExtensions.LexerTypeFromFileName(fileName), definitionFile, useGlobalOverride, font, true, true, true);
}
/// <summary>
/// Creates the lexer from XML file used by the Notepad++ software.
/// </summary>
/// <param name="scintilla">The <see cref="Scintilla"/> which lexer style to set.</param>
/// <param name="lexerType">Type of the lexer.</param>
/// <param name="fileName">A file name to get the lexer type from.</param>
/// <param name="useGlobalOverride">A flag indicating whether the style "Global override" should be set for the lexer from the XML document.</param>
/// <param name="font">A flag indicating whether to use the defined font name from the XML document or not.</param>
/// <returns><c>true</c> if the operation was successful, <c>false</c> otherwise.</returns>
public static bool CreateLexerFromFile(Scintilla scintilla, LexerType lexerType,
string fileName, bool useGlobalOverride, bool font)
{
return CreateLexerFromFile(scintilla, lexerType, fileName, useGlobalOverride, font, true, true, true);
}
/// <summary>
/// Creates the lexer from XML file used by the Notepad++ software.
/// </summary>
/// <param name="scintilla">The <see cref="Scintilla"/> which lexer style to set.</param>
/// <param name="fileName">A file name to get the lexer type from.</param>
/// <param name="definitionFile">A XML file to load the lexer style from.</param>
/// <param name="useGlobalOverride">A flag indicating whether the style "Global override" should be set for the lexer from the XML document.</param>
/// <param name="font">A flag indicating whether to use the defined font name from the XML document or not.</param>
/// <param name="useWhiteSpace">A flag indicating whether to color the white space symbol.</param>
/// <param name="useSelectionColors">A flag indicating whether to color the selection.</param>
/// <param name="useMarginColors">A flag indicating whether to color the margin.</param>
/// <returns><c>true</c> if the operation was successful, <c>false</c> otherwise.</returns>
public static bool CreateLexerFromFile(Scintilla scintilla, string fileName, string definitionFile,
bool useGlobalOverride, bool font, bool useWhiteSpace, bool useSelectionColors,
bool useMarginColors)
{
return CreateLexerFromFile(scintilla, LexerFileExtensions.LexerTypeFromFileName(fileName), definitionFile, useGlobalOverride, font, useWhiteSpace, useSelectionColors, useMarginColors);
}
/// <summary>
/// Creates the lexer from XML file used by the Notepad++ software.
/// </summary>
/// <param name="scintilla">The <see cref="Scintilla"/> which lexer style to set.</param>
/// <param name="lexerType">Type of the lexer.</param>
/// <param name="fileName">A file name to get the lexer type from.</param>
/// <param name="useGlobalOverride">A flag indicating whether the style "Global override" should be set for the lexer from the XML document.</param>
/// <param name="font">A flag indicating whether to use the defined font name from the XML document or not.</param>
/// <param name="useWhiteSpace">A flag indicating whether to color the white space symbol.</param>
/// <param name="useSelectionColors">A flag indicating whether to color the selection.</param>
/// <param name="useMarginColors">A flag indicating whether to color the margin.</param>
/// <returns><c>true</c> if the operation was successful, <c>false</c> otherwise.</returns>
public static bool CreateLexerFromFile(Scintilla scintilla, LexerType lexerType,
string fileName, bool useGlobalOverride, bool font, bool useWhiteSpace, bool useSelectionColors,
bool useMarginColors)
{
try
{
XDocument document = XDocument.Load(fileName);
ScintillaNotepadPlusPlusStyles.SetGlobalDefaultStyles(document, scintilla, useGlobalOverride, font);
ScintillaNotepadPlusPlusStyles.LoadScintillaStyleFromNotepadPlusXml(document, scintilla, useWhiteSpace,
useSelectionColors, useMarginColors);
ScintillaNotepadPlusPlusStyles.LoadLexerStyleFromNotepadPlusXml(document, scintilla,
lexerType); // TODO::Font?
var lexerTypeDetected = LexerTypeName.GetLexerXmlName(lexerType);
//scintilla.Lexer = lexerTypeDetected;
scintilla.LexerName = lexerTypeDetected;
ScintillaKeyWords.SetKeywords(scintilla, lexerType);
LexerFoldProperties.SetFoldProperties(scintilla, lexerType);
ScintillaNotepadPlusPlusStyles.SetFolding(document, scintilla);
System.Diagnostics.Debug.WriteLine(scintilla.DescribeKeywordSets());
return true;
}
catch
{
return false;
}
}
/// <summary>
/// Creates the lexer for a given Scintilla class instance with a given language type enumeration.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="fileName">A file name to get the lexer type from.</param>
/// <returns>True if the given lexer was found; otherwise false (a work in progress).</returns>
public static bool CreateLexer(Scintilla scintilla, string fileName)
{
return CreateLexer(scintilla, LexerFileExtensions.LexerTypeFromFileName(fileName));
}
/// <summary>
/// Creates the lexer for a given Scintilla class instance with a given language type enumeration.
/// </summary>
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
/// <param name="lexerType">Type of the lexer / programming language.</param>
/// <returns>True if the given lexer was found; otherwise false (a work in progress).</returns>
public static bool CreateLexer(Scintilla scintilla, LexerType lexerType, bool foldOn = true)
{
if (lexerType == LexerType.Cs)
{
return CreateLexerCs.CreateCsLexer(scintilla, LexerColors,foldOn);
}
if (lexerType == LexerType.Xml)
{
return CreateLexerXml.CreateXmlLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.Cpp)
{
return CreateLexerCpp.CreateCppLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.Text || lexerType == LexerType.Unknown)
{
return CreateLexerNull.CreateNullLexer(scintilla);
}
if (lexerType == LexerType.Nsis)
{
return CreateLexerNsis.CreateNsisLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.InnoSetup)
{
return CreateLexerInnoSetup.CreateInnoSetupLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.SQL)
{
return CreateLexerSql.CreateSqlLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.Batch)
{
return CreateLexerBatch.CreateBatchLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.Pascal)
{
return CreateLexerPascal.CreatePascalLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.PHP)
{
return CreateLexerPhp.CreatePhpLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.HTML)
{
return CreateLexerHtml.CreateHtmlLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.WindowsPowerShell)
{
return CreateLexerPowerShell.CreatePowerShellLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.INI)
{
return CreateLexerIni.CreateIniLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.Python)
{
return CreateLexerPython.CreatePythonLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.YAML)
{
return CreateLexerYaml.CreateYamlLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.Java)
{
return CreateLexerJava.CreateJavaLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.JavaScript)
{
return CreateLexerJavaScript.CreateJavaScriptLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.Css)
{
return CreateLexerCss.CreateCssLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.VbDotNet)
{
return CreateLexerVb.CreateVbLexer(scintilla, LexerColors, foldOn);
}
if (lexerType == LexerType.Json)
{
return CreateLexerJson.CreateJsonLexer(scintilla, LexerColors, foldOn);
}
// a lexer wasn't found..
return false;
}
}
}
@@ -0,0 +1,214 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System.Drawing;
using System.Linq;
using System.Xml.Linq;
namespace VPKSoft.ScintillaLexers.ScintillaNotepadPlusPlus
{
/// <summary>
/// A helper class to get the mark colors from the Notepad++ software XML lexer definition file.
/// </summary>
public class MarkColors
{
/// <summary>
/// Gets or sets the smart high highlighting foreground color.
/// </summary>
public Color SmartHighLightingForeground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the smart high highlighting background color.
/// </summary>
public Color SmartHighLightingBackground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the incremental highlight all foreground color.
/// </summary>
public Color IncrementalHighlightAllForeground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the incremental highlight all background color.
/// </summary>
public Color IncrementalHighlightAllBackground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the mark one foreground color.
/// </summary>
public Color MarkOneForeground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the mark one background color.
/// </summary>
public Color MarkOneBackground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the mark two foreground color.
/// </summary>
public Color MarkTwoForeground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the mark two background color.
/// </summary>
public Color MarkTwoBackground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the mark three foreground color.
/// </summary>
public Color MarkThreeForeground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the mark three background color.
/// </summary>
public Color MarkThreeBackground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the mark four foreground color.
/// </summary>
public Color MarkFourForeground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the mark four background color.
/// </summary>
public Color MarkFourBackground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the mark five foreground color.
/// </summary>
public Color MarkFiveForeground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the mark five background color.
/// </summary>
public Color MarkFiveBackground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the current line background color.
/// </summary>
public Color CurrentLineBackground { get; set; } = Color.Empty;
/// <summary>
/// Gets or sets the current line background color.
/// </summary>
public Color CurrentLineForeground { get; set; } = Color.Empty;
/// <summary>
/// Gets the color definitions from a XML style definition file.
/// </summary>
/// <param name="fileName">The name of the file.</param>
/// <returns>An instance to this (<see cref="MarkColors"/>) class.</returns>
public static MarkColors FromFile(string fileName)
{
return FromXDocument(XDocument.Load(fileName));
}
/// <summary>
/// Gets the color definitions from a XDocument style definition instance.
/// </summary>
/// <param name="document">The XDocument to document to get the styles from.</param>
/// <returns>An instance to this (<see cref="MarkColors"/>) class.</returns>
public static MarkColors FromXDocument(XDocument document)
{
try
{
MarkColors result = new MarkColors();
var nodes = document.Descendants(XName.Get("WidgetStyle")).Where(f =>
f.Attribute("name")?.Value == "Current line background colour" ||
f.Attribute("name")?.Value == "Smart HighLighting" ||
f.Attribute("name")?.Value == "Incremental highlight all" ||
f.Attribute("name")?.Value == "Mark Style 1" ||
f.Attribute("name")?.Value == "Mark Style 2" ||
f.Attribute("name")?.Value == "Mark Style 3" ||
f.Attribute("name")?.Value == "Mark Style 4" ||
f.Attribute("name")?.Value == "Mark Style 5");
foreach (var node in nodes)
{
var style = XmlStyleNotepadPlusPlusHelper.FromXElement(node);
if (style.Name == "Mark Style 1")
{
result.MarkOneForeground = style.ColorForeground;
result.MarkOneBackground = style.ColorBackground;
}
if (style.Name == "Mark Style 2")
{
result.MarkTwoForeground = style.ColorForeground;
result.MarkTwoBackground = style.ColorBackground;
}
if (style.Name == "Mark Style 3")
{
result.MarkThreeForeground = style.ColorForeground;
result.MarkThreeBackground = style.ColorBackground;
}
if (style.Name == "Mark Style 4")
{
result.MarkFourForeground = style.ColorForeground;
result.MarkFourBackground = style.ColorBackground;
}
if (style.Name == "Mark Style 5")
{
result.MarkFiveForeground = style.ColorForeground;
result.MarkFiveBackground = style.ColorBackground;
}
if (style.Name == "Smart HighLighting")
{
result.SmartHighLightingForeground = style.ColorForeground;
result.SmartHighLightingBackground = style.ColorBackground;
}
if (style.Name == "Incremental highlight all")
{
result.IncrementalHighlightAllForeground = style.ColorForeground;
result.IncrementalHighlightAllBackground = style.ColorBackground;
}
if (style.Name == "Incremental highlight all")
{
result.IncrementalHighlightAllForeground = style.ColorForeground;
result.IncrementalHighlightAllBackground = style.ColorBackground;
}
if (style.Name == "Current line background colour")
{
result.CurrentLineForeground = style.ColorForeground;
result.CurrentLineBackground = style.ColorBackground;
}
}
return result;
}
catch
{
return new MarkColors();
}
}
}
}
@@ -0,0 +1,301 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System.Drawing;
using System.Linq;
using System.Xml.Linq;
using ScintillaNET;
using VPKSoft.ScintillaLexers.CreateSpecificLexer;
using VPKSoft.ScintillaLexers.HelperClasses;
namespace VPKSoft.ScintillaLexers.ScintillaNotepadPlusPlus
{
/// <summary>
/// A class for loading global styles for the <see cref="Scintilla"/> from
/// </summary>
public class ScintillaNotepadPlusPlusStyles
{
/// <summary>
/// Sets the global and default styles for the given <see cref="Scintilla"/> instance depending on the other parameters.
/// </summary>
/// <param name="document">A XML document containing the lexer style data.</param>
/// <param name="scintilla">The scintilla instance of which style to set.</param>
/// <param name="useGlobalOverride">if set to <c>true</c> the "Global override" style is read from the <paramref name="document"/>.</param>
/// <param name="font">If set to <c>true</c> the font name and size is read from the <paramref name="document"/>..</param>
/// <returns><c>true</c> if the operation was successful, <c>false</c> otherwise.</returns>
public static bool SetGlobalDefaultStyles(XDocument document, Scintilla scintilla, bool useGlobalOverride, bool font)
{
try
{
scintilla.StyleResetDefault();
var globalStyle =
document.Descendants(XName.Get("WidgetStyle")).FirstOrDefault(f =>
f.Attribute("name") != null &&
f.Attribute("name").Value == "Global override");
if (globalStyle != null && useGlobalOverride)
{
SetStyle(scintilla, XmlStyleNotepadPlusPlusHelper.FromXElement(globalStyle), font);
}
var defaultStyle =
document.Descendants(XName.Get("WidgetStyle")).FirstOrDefault(f =>
f.Attribute("name") != null &&
f.Attribute("name").Value == "Default Style");
SetStyle(scintilla, XmlStyleNotepadPlusPlusHelper.FromXElement(defaultStyle), font);
scintilla.StyleClearAll();
return true;
}
catch
{
return false;
}
}
/// <summary>
/// Sets the folding of a <see cref="Scintilla"/> based on the "Fold" style defined in the XML document.
/// </summary>
/// <param name="document">The XML document to read the folding style from.</param>
/// <param name="scintilla">The instance to a scintilla of which folding style to set.</param>
/// <returns><c>true</c> if the operation was successful, <c>false</c> otherwise.</returns>
public static bool SetFolding(XDocument document, Scintilla scintilla)
{
try
{
var foldStyle = // <WidgetStyle name="Fold"...
document.Descendants(XName.Get("WidgetStyle")).FirstOrDefault(f =>
f.Attribute("name") != null &&
f.Attribute("name").Value == "Fold");
if (foldStyle == null)
{
return false;
}
var style = XmlStyleNotepadPlusPlusHelper.FromXElement(foldStyle);
// the default colors as in the example.. (C)::https://github.com/jacobslusser/ScintillaNET/wiki/Automatic-Code-Folding
// Instruct the lexer to calculate folding..
LexerFoldProperties.FoldDefault(scintilla);
// Configure a margin to display folding symbols
scintilla.Margins[2].Type = MarginType.Symbol;
scintilla.Margins[2].Mask = Marker.MaskFolders;
scintilla.Margins[2].Sensitive = true;
scintilla.Margins[2].Width = 20;
// Set colors for all folding markers
for (int i = 25; i <= 31; i++)
{
scintilla.Markers[i].SetForeColor(style.ColorBackground);
scintilla.Markers[i].SetBackColor(style.ColorForeground);
}
// Configure folding markers with respective symbols
scintilla.Markers[Marker.Folder].Symbol = MarkerSymbol.BoxPlus;
scintilla.Markers[Marker.FolderOpen].Symbol = MarkerSymbol.BoxMinus;
scintilla.Markers[Marker.FolderEnd].Symbol = MarkerSymbol.BoxPlusConnected;
scintilla.Markers[Marker.FolderMidTail].Symbol = MarkerSymbol.TCorner;
scintilla.Markers[Marker.FolderOpenMid].Symbol = MarkerSymbol.BoxMinusConnected;
scintilla.Markers[Marker.FolderSub].Symbol = MarkerSymbol.VLine;
scintilla.Markers[Marker.FolderTail].Symbol = MarkerSymbol.LCorner;
// Enable automatic folding
scintilla.AutomaticFold = (AutomaticFold.Show | AutomaticFold.Click | AutomaticFold.Change);
return true;
}
catch
{
return false;
}
}
/// <summary>
/// Sets the style of a given <see cref="Scintilla"/> with a given style.
/// </summary>
/// <param name="scintilla">The scintilla instance of which style to set.</param>
/// <param name="style">The style to set for the <paramref name="scintilla"/>.</param>
/// <param name="font">If set to <c>true</c> the font is also set from the given style.</param>
private static void SetStyle(Scintilla scintilla, XmlStyleNotepadPlusPlusHelper style, bool font)
{
if (style.ColorForeground != Color.Empty)
{
scintilla.Styles[style.StyleId].ForeColor = style.ColorForeground;
}
if (style.ColorBackground != Color.Empty)
{
scintilla.Styles[style.StyleId].BackColor = style.ColorBackground;
}
scintilla.Styles[style.StyleId].Italic = style.Italic;
scintilla.Styles[style.StyleId].Bold = style.Bold;
if (font)
{
scintilla.Styles[style.StyleId].Font = style.FontName;
scintilla.Styles[style.StyleId].Size = style.FontSize;
}
}
/// <summary>
/// Loads the Scintilla global styles from a Notepad++ style definition XML file.
/// </summary>
/// <param name="document">The XML document to read the global style from.</param>
/// <param name="scintilla">The Scintilla of which global styles to set.</param>
/// <param name="useWhiteSpace">A flag indicating whether to color the white space symbol.</param>
/// <param name="useSelectionColors">A flag indicating whether to color the selection.</param>
/// <param name="useMarginColors">A flag indicating whether to color the margin.</param>
/// <returns><c>true</c> if the operations was successful, <c>false</c> otherwise.</returns>
public static bool LoadScintillaStyleFromNotepadPlusXml(XDocument document, Scintilla scintilla,
bool useWhiteSpace, bool useSelectionColors, bool useMarginColors)
{
try
{
var nodes = document.Descendants(XName.Get("WidgetStyle"));
// loop through the color definition elements..
foreach (var node in nodes)
{
var style = XmlStyleNotepadPlusPlusHelper.FromXElement(node);
if (style.Name == "Indent guideline style" ||
style.Name == "Brace highlight style" ||
style.Name == "Bad brace colour" ||
style.Name == "Find Mark Style" || // unknown (?): 31
style.Name == "Line number margin" || // unknown (?): 33
style.Name == "Smart HighLighting" || // unknown (?): 29
style.Name == "Mark Style 1" || // unknown (?): 25
style.Name == "Mark Style 2" || // unknown (?): 24
style.Name == "Mark Style 3" || // unknown (?): 23
style.Name == "Mark Style 4" || // unknown (?): 22
style.Name == "Mark Style 5" || // unknown (?): 21
style.Name == "Incremental highlight all" || // unknown (?): 28
style.Name == "Tags match highlighting" || // unknown (?): 27
style.Name == "ags attribute") // unknown (?): 26
{
if (style.ColorForeground != Color.Empty)
{
scintilla.Styles[style.StyleId].ForeColor = style.ColorForeground;
}
if (style.ColorBackground != Color.Empty)
{
scintilla.Styles[style.StyleId].BackColor = style.ColorBackground;
}
scintilla.Styles[style.StyleId].Italic = style.Italic;
scintilla.Styles[style.StyleId].Bold = style.Bold;
}
else if (style.Name == "Current line background colour")
{
scintilla.CaretLineBackColor = style.ColorBackground;
}
else if (style.Name == "Selected text colour")
{
scintilla.SetSelectionForeColor(useSelectionColors, style.ColorForeground);
scintilla.SetSelectionBackColor(useSelectionColors, style.ColorBackground);
}
else if (style.Name == "Caret colour")
{
scintilla.CaretForeColor = style.ColorForeground;
//scintilla.Styles[style.StyleId].BackColor = style.ColorBackground;
//scintilla.Styles[style.StyleId].ForeColor = style.ColorBackground;
// caret background color not supported? StyleID: 2069
}
else if (style.Name == "Edge colour")
{
scintilla.EdgeColor = style.ColorForeground;
}
else if (style.Name == "Fold margin") // <WidgetStyle name="Fold margin"..
{
scintilla.SetFoldMarginHighlightColor(useMarginColors, style.ColorForeground);
scintilla.SetFoldMarginColor(useMarginColors, style.ColorBackground);
}
else if (style.Name == "White space symbol") // <WidgetStyle name="White space symbol"..
{
scintilla.SetWhitespaceForeColor(useWhiteSpace, style.ColorForeground);
scintilla.SetWhitespaceBackColor(useWhiteSpace, style.ColorBackground);
}
}
return true;
}
catch
{
return false;
}
}
/// <summary>
/// Gets the styles for a <see cref="Scintilla"/> from the Notepad++'s XML style files for a given lexer.
/// </summary>
/// <param name="document">The XML document to read the lexer style from.</param>
/// <param name="scintilla">The <see cref="Scintilla"/> which lexer style to set.</param>
/// <param name="lexerType">A <see cref="LexerEnumerations.LexerType"/> enumeration.</param>
/// <returns><c>true</c> if the operations was successful, <c>false</c> otherwise.</returns>
public static bool LoadLexerStyleFromNotepadPlusXml(XDocument document, Scintilla scintilla,
LexerEnumerations.LexerType lexerType)
{
try
{
var nodes = document.Descendants(XName.Get("LexerType")).Where(f =>
f.Attribute("name")?.Value == LexerTypeName.GetLexerXmlName(lexerType)).Descendants();
// loop through the color definition elements..
foreach (var node in nodes)
{
var style = XmlStyleNotepadPlusPlusHelper.FromXElement(node);
if (style.ColorForeground != Color.Empty)
{
scintilla.Styles[style.StyleId].ForeColor = style.ColorForeground;
}
if (style.ColorBackground != Color.Empty)
{
scintilla.Styles[style.StyleId].BackColor = style.ColorBackground;
}
scintilla.Styles[style.StyleId].Bold = style.Bold;
scintilla.Styles[style.StyleId].Italic = style.Italic;
}
return true;
}
catch
{
// an error occurred so return false..
return false;
}
}
}
}
@@ -0,0 +1,149 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System.Drawing;
using System.Xml.Linq;
namespace VPKSoft.ScintillaLexers.ScintillaNotepadPlusPlus
{
/// <summary>
/// A helper class for Notepad++ XML style definition files.
/// </summary>
public class XmlStyleNotepadPlusPlusHelper
{
/// <summary>
/// Gets or sets the name of the style definition.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the style definition defines a fond as bold.
/// </summary>
public bool Bold { get; set;}
/// <summary>
/// Gets or sets a value indicating whether the style definition defines a fond as italic.
/// </summary>
public bool Italic { get; set;}
/// <summary>
/// Gets or sets the style identifier from a style definition.
/// </summary>
public int StyleId { get; set; }
/// <summary>
/// Gets or sets the foreground color of a font from a style definition.
/// </summary>
public Color ColorForeground { get; set; }
/// <summary>
/// Gets or sets the background color of a font from a style definition.
/// </summary>
public Color ColorBackground { get; set; }
/// <summary>
/// Gets or sets the name of the font from a style definition.
/// </summary>
public string FontName { get; set; }
/// <summary>
/// Gets or sets the size of the font from a style definition.
/// </summary>
public int FontSize { get; set; }
/// <summary>
/// Gets the attribute value of a given <see cref="XElement"/>.
/// </summary>
/// <param name="element">The element to get the attribute from.</param>
/// <param name="attributeName">Name of the attribute.</param>
/// <param name="defaultValue">The default value for the attribute in case the attribute is null or the value is empty.</param>
/// <returns>The <see cref="XAttribute"/> value based on given parameters if successful; otherwise <paramref name="defaultValue"/>.</returns>
private static string GetAttributeValue(XElement element, string attributeName, string defaultValue = "")
{
var attribute = element.Attribute(attributeName);
if (attribute == null)
{
return defaultValue;
}
if (attribute.Value.Trim() != string.Empty)
{
return attribute.Value.Trim();
}
return defaultValue;
}
/// <summary>
/// Gets the attribute value of a given <see cref="XElement"/> as a <see cref="Color"/>.
/// </summary>
/// <param name="element">The element to get the color attribute from.</param>
/// <param name="attributeName">Name of the attribute.</param>
/// <returns>A color if the operation was successful; otherwise Color.Empty.</returns>
private static Color GetAttributeAsColor(XElement element, string attributeName)
{
var attribute = element.Attribute(attributeName);
if (attribute == null)
{
return Color.Empty;
}
if (attribute.Value.Trim() == string.Empty)
{
return Color.Empty;
}
try
{
return ColorTranslator.FromHtml("#" + element.Attribute(attributeName)?.Value);
}
catch
{
return Color.Empty;
}
}
/// <summary>
/// Creates a new instance of this class based on the given <see cref="XElement"/>
/// </summary>
/// <param name="element">The element to get the style definition from.</param>
/// <returns>A <see cref="XmlStyleNotepadPlusPlusHelper"/> class instance filled with the style definition data.</returns>
public static XmlStyleNotepadPlusPlusHelper FromXElement(XElement element)
{
return new XmlStyleNotepadPlusPlusHelper
{
Name = GetAttributeValue(element, "name", "None"),
Bold = int.Parse(GetAttributeValue(element, "fontStyle", "0")) == 1,
Italic = int.Parse(GetAttributeValue(element, "fontStyle", "0")) == 2,
StyleId = int.Parse(GetAttributeValue(element, "styleID", "0")),
ColorForeground = GetAttributeAsColor(element, "fgColor"),
ColorBackground = GetAttributeAsColor(element, "bgColor"),
FontName = GetAttributeValue(element, "fontName", "Consolas"),
FontSize = int.Parse(GetAttributeValue(element, "fontSize", "10")),
};
}
}
}
@@ -0,0 +1,131 @@
using ICSharpCode.TextEditor.Document;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JackWangCUMT.WinForm
{
/// <summary>
/// The class to generate the foldings, it implements ICSharpCode.TextEditor.Document.IFoldingStrategy
/// </summary>
public class MingFolding : IFoldingStrategy
{
/// <summary>
/// Generates the foldings for our document.
/// </summary>
/// <param name="document">The current document.</param>
/// <param name="fileName">The filename of the document.</param>
/// <param name="parseInformation">Extra parse information, not used in this sample.</param>
/// <returns>A list of FoldMarkers.</returns>
public List<FoldMarker> GenerateFoldMarkers(IDocument document, string fileName, object parseInformation)
{
List<FoldMarker> list = new List<FoldMarker>();
//stack 先进先出
var startLines = new Stack<int>();
// Create foldmarkers for the whole document, enumerate through every line.
for (int i = 0; i < document.TotalNumberOfLines; i++)
{
// Get the text of current line.
string text = document.GetText(document.GetLineSegment(i));
var text_trim = text.Trim();
if (text_trim.StartsWith("#region")) // Look for method starts
{
startLines.Push(i);
}
if (text_trim.StartsWith("#endregion")) // Look for method endings
{
int start = startLines.Pop();
// Add a new FoldMarker to the list.
// document = the current document
// start = the start line for the FoldMarker
// document.GetLineSegment(start).Length = the ending of the current line = the start column of our foldmarker.
// i = The current line = end line of the FoldMarker.
// 7 = The end column
list.Add(new FoldMarker(document, start, document.GetLineSegment(start).Length, i, 57, FoldType.Region, "..."));
}
//支持嵌套 {}
if (text_trim.StartsWith("{") || text_trim.EndsWith("{")) // Look for method starts
{
startLines.Push(i);
}
if (text_trim.StartsWith("}") || text_trim.EndsWith("},")) // Look for method endings
{
if (startLines.Count > 0)
{
int start = startLines.Pop();
list.Add(new FoldMarker(document, start, document.GetLineSegment(start).Length, i, 57, FoldType.TypeBody, "...}"));
}
}
if (text_trim.StartsWith("[")|| text_trim.EndsWith("[")) // Look for method starts
{
startLines.Push(i);
}
if (text_trim.StartsWith("]") || text_trim.EndsWith("],")) // Look for method endings
{
if (startLines.Count > 0)
{
int start = startLines.Pop();
list.Add(new FoldMarker(document, start, document.GetLineSegment(start).Length, i, 57, FoldType.TypeBody, "...]"));
}
}
if (text_trim.StartsWith("<html>")) // Look for method starts
{
startLines.Push(i);
}
if (text_trim.StartsWith("</html>")) // Look for method endings
{
if (startLines.Count > 0)
{
int start = startLines.Pop();
list.Add(new FoldMarker(document, start, document.GetLineSegment(start).Length, i, 57, FoldType.TypeBody, "</html>"));
}
}
if (text_trim.StartsWith("<head>")) // Look for method starts
{
startLines.Push(i);
}
if (text_trim.StartsWith("</head>")) // Look for method endings
{
if (startLines.Count > 0)
{
int start = startLines.Pop();
list.Add(new FoldMarker(document, start, document.GetLineSegment(start).Length, i, 57, FoldType.TypeBody, "</head>"));
}
}
if (text_trim.StartsWith("<div>") || text_trim.StartsWith("<div ")) // Look for method starts
{
startLines.Push(i);
}
if (text_trim.StartsWith("</div>")) // Look for method endings
{
if (startLines.Count > 0)
{
int start = startLines.Pop();
list.Add(new FoldMarker(document, start, document.GetLineSegment(start).Length, i, 57, FoldType.TypeBody, "</div>"));
}
}
// /// <summary>
if (text_trim.StartsWith("/// <summary>")) // Look for method starts
{
startLines.Push(i);
}
if (text_trim.StartsWith("/// <returns>")) // Look for method endings
{
int start = startLines.Pop();
//获取注释文本(包括空格)
string display = document.GetText(document.GetLineSegment(start + 1).Offset, document.GetLineSegment(start + 1).Length);
//remove ///
display = display.Trim().TrimStart('/');
list.Add(new FoldMarker(document, start, document.GetLineSegment(start).Length, i, 57, FoldType.TypeBody, display));
}
}
return list;
}
}
}
@@ -0,0 +1,49 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
namespace ScintillaDiff.Enumerations
{
/// <summary>
/// An enumeration for the character change type in case the character level comparison is set in the <see cref="ScintillaDiffControl"/>.
/// </summary>
public enum CharChangedType
{
/// <summary>
/// The character was modified.
/// </summary>
Modified,
/// <summary>
/// The character was added.
/// </summary>
Added,
/// <summary>
/// The character was removed.
/// </summary>
Removed,
}
}
@@ -0,0 +1,134 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System.Drawing;
using ScintillaNET;
namespace ScintillaDiff
{
/// <summary>
/// A helper class to highlight words with a given color.
/// </summary>
public class Highlight
{
/// <summary>
/// Highlights a given range with a given color and given alpha values of the <see cref="Scintilla"/> control.
/// </summary>
/// <param name="scintilla">The scintilla of which words to highlight.</param>
/// <param name="num">The indicator number for the <paramref name="scintilla"/>.Indicators 0-7 could be in use by a lexer so use a higher value.</param>
/// <param name="start">The starting position of the highlight area.</param>
/// <param name="length">The length of the highlight area.</param>
/// <param name="color">The color to use for the highlight.</param>
/// <param name="alpha">The transparency value of the indicator.</param>
/// <param name="outlineAlpha">The transparency value of the indicator outline.</param>
/// <note>(C): https://github.com/jacobslusser/ScintillaNET/wiki/Find-and-Highlight-Words</note>
public static void HighlightRange(Scintilla scintilla, int num, int start, int length, Color color, byte alpha = 255, byte outlineAlpha = 255)
{
// Remove all uses of our indicator
scintilla.IndicatorCurrent = num;
// Update indicator appearance
scintilla.Indicators[num].Style = IndicatorStyle.StraightBox;
scintilla.Indicators[num].Under = true;
scintilla.Indicators[num].ForeColor = color;
scintilla.Indicators[num].OutlineAlpha = alpha;
scintilla.Indicators[num].Alpha = outlineAlpha;
// Mark the search position with the current indicator..
scintilla.IndicatorFillRange(start, length);
}
/// <summary>
/// Highlights an entire line
/// </summary>
/// <param name="scintilla">The scintilla of which contains the line to highlight.</param>
/// <param name="lineIndex">The index of the line to be highlighted within the scintilla.</param>
/// <param name="changeType">The type of change has been made, indicating which color to highlight the line with.</param>
public static void HighlightLine(Scintilla scintilla, int lineIndex, int changeType)
{
int start = scintilla.Lines[lineIndex].Position;
int length = scintilla.Lines[lineIndex].Length;
scintilla.StartStyling(start);
scintilla.SetStyling(length, changeType);
}
/// <summary>
/// Clears the given style form a <see cref="Scintilla"/>.
/// </summary>
/// <param name="scintilla">The scintilla to clear the style from.</param>
/// <param name="num">The number of the style to clear.</param>
// ReSharper disable once UnusedMember.Global
public static void ClearStyle(Scintilla scintilla, int num)
{
scintilla.IndicatorCurrent = num;
scintilla.IndicatorClearRange(0, scintilla.TextLength);
}
/// <summary>
/// Clears the given styles form a <see cref="Scintilla"/>.
/// </summary>
/// <param name="scintilla">The scintilla to clear the styles from.</param>
/// <param name="numbers">The numbers of the styles to clear.</param>
public static void ClearStyle(Scintilla scintilla, params int[] numbers)
{
foreach (var number in numbers)
{
ClearStyle(scintilla, number);
}
}
/// <summary>
/// Clears the style from a specified area of the <see cref="Scintilla"/> control.
/// </summary>
/// <param name="scintilla">The scintilla to clear the style from.</param>
/// <param name="line">The line from where to clear the style from.</param>
/// <param name="pos">The position in the line to clear the style from.</param>
/// <param name="length">The length of the text to clear the style from.</param>
/// <param name="number">The number of the style to clear.</param>
public static void ClearStyleArea(Scintilla scintilla, int line, int pos, int length, int number)
{
scintilla.IndicatorCurrent = number;
scintilla.IndicatorClearRange(scintilla.Lines[line].Position + pos, length);
}
/// <summary>
/// Clears the styles from a specified area of the <see cref="Scintilla"/> control.
/// </summary>
/// <param name="scintilla">The scintilla to clear the styles from.</param>
/// <param name="line">The line from where to clear the styles from.</param>
/// <param name="pos">The position in the line to clear the styles from.</param>
/// <param name="length">The length of the text to clear the styles from.</param>
/// <param name="numbers">The numbers of the styles to clear.</param>
public static void ClearStyleArea(Scintilla scintilla, int line, int pos, int length, params int[] numbers)
{
foreach (var number in numbers)
{
ClearStyleArea(scintilla, line, pos, length, number);
}
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,128 @@
using ScintillaNET;
namespace ScintillaDiff
{
partial class ScintillaDiffControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.scMain = new System.Windows.Forms.SplitContainer();
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit();
this.scMain.Panel1.SuspendLayout();
this.scMain.Panel2.SuspendLayout();
this.scMain.SuspendLayout();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// scMain
//
this.scMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.scMain.Location = new System.Drawing.Point(0, 0);
this.scMain.Name = "scMain";
//
// scMain.Panel1
//
this.scMain.Panel1.Controls.Add(this.panel1);
//
// scMain.Panel2
//
this.scMain.Panel2.Controls.Add(this.panel2);
this.scMain.Size = new System.Drawing.Size(918, 454);
this.scMain.SplitterDistance = 434;
this.scMain.TabIndex = 0;
//
// panel1
//
this.panel1.Controls.Add(this.label1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(434, 23);
this.panel1.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(7, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 12);
this.label1.TabIndex = 0;
this.label1.Text = "文本1";
//
// panel2
//
this.panel2.Controls.Add(this.label2);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(480, 23);
this.panel2.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(7, 5);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 12);
this.label2.TabIndex = 1;
this.label2.Text = "文本2";
//
// ScintillaDiffControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.scMain);
this.Name = "ScintillaDiffControl";
this.Size = new System.Drawing.Size(918, 454);
this.Load += new System.EventHandler(this.ScintillaDiffControl_Load);
this.SizeChanged += new System.EventHandler(this.ScintillaDiffer_SizeChanged);
this.scMain.Panel1.ResumeLayout(false);
this.scMain.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.scMain)).EndInit();
this.scMain.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer scMain;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,50 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
namespace ScintillaDiff
{
/// <summary>
/// A class holding enumeration for the diff style.
/// </summary>
public static class ScintillaDiffStyles
{
/// <summary>
/// An enumeration indicating the diff style used by the <see cref="ScintillaDiffControl"/> control.
/// </summary>
public enum DiffStyle
{
/// <summary>
/// The difference is displayed as a list.
/// </summary>
DiffList,
/// <summary>
/// The difference is displayed side by side.
/// </summary>
DiffSideBySide,
}
}
}
@@ -0,0 +1,125 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using ScintillaNET;
namespace ScintillaDiff
{
/// <summary>
/// An inherited class from the <see cref="Scintilla"/> which can synchronize vertical scroll bar position with another <see cref="Scintilla"/> control.
/// Implements the <see cref="ScintillaNET.Scintilla" />
/// </summary>
/// <seealso cref="ScintillaNET.Scintilla" />
public class ScrollSyncScintilla : Scintilla
{
// ReSharper disable once CommentTypo
/// <summary>
/// The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar.
/// This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control.
/// <remarks>
/// https://docs.microsoft.com/en-us/windows/desktop/controls/wm-vscroll
/// </remarks>
/// </summary>
// ReSharper disable once InconsistentNaming
private const int WM_VSCROLL = 0x115;
// ReSharper disable once CommentTypo
/// <summary>
/// The WM_HSCROLL message is sent to a window when a scroll event occurs in the window's standard horizontal scroll bar.
/// This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control.
/// <remarks>
/// https://docs.microsoft.com/en-us/windows/desktop/controls/wm-hscroll
/// </remarks>
/// </summary>
// ReSharper disable once InconsistentNaming
private const int WM_HSCROLL = 0x114;
/// <summary>
/// The WM_MOUSEWHEEL message is Sent to the focus window when the mouse wheel is rotated.
/// <remarks>
/// https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-mousewheel
/// </remarks>
/// </summary>
// ReSharper disable once InconsistentNaming
private const int WM_MOUSEWHEEL = 0x20a;
/// <summary>
/// The SendMessage Win32 function is used to send a specified message to a window or windows.
/// <remarks>
/// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendmessage
/// </remarks>
/// </summary>
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
/// <summary>
/// Processes Windows messages.
/// </summary>
/// <param name="m">The Windows Message to process.</param>
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_MOUSEWHEEL)
{
// two casts to make this work with 32 bit and 64 bit params
var wp = new IntPtr((int)(long)m.WParam < 0 ? 1 : 0);
SendMessage(this.Handle, WM_VSCROLL, wp, new IntPtr(0));
return;
}
base.WndProc(ref m);
// vertical scrolling
if (m.Msg == WM_VSCROLL && ScrollSync != null)
{
// get the first visible line of this control..
int scrollTop = FirstVisibleLine;
// set the value to the other Scintilla control..
ScrollSync.FirstVisibleLine = scrollTop;
}
// horizontal scrolling
if (m.Msg == WM_HSCROLL && ScrollSync != null)
{
// get the leftmost pixel
int scrollLeft = XOffset;
// set the value to the other Scintilla control..
ScrollSync.XOffset = scrollLeft;
}
}
/// <summary>
/// Gets or sets the <see cref="Scintilla"/> to synchronize the vertical scroll bar with.
/// </summary>
[Browsable(true)]
[Category("Miscellaneous")]
[Description("Gets or sets the Scintilla to synchronize the vertical scroll bar with.")]
public Scintilla ScrollSync { get; set; }
}
}
@@ -0,0 +1,48 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ScintillaNET;
namespace ScintillaDiff
{
/// <summary>
/// A class used by the <see cref="ScintillaDiffControl"/> when external styling update is needed.
/// Implements the <see cref="System.EventArgs" />
/// </summary>
/// <seealso cref="System.EventArgs" />
public class StyleRefreshEventArgs: EventArgs
{
/// <summary>
/// Gets the scintilla requesting for external style update.
/// </summary>
public Scintilla Scintilla { get; internal set; }
}
}
@@ -0,0 +1,60 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using ScintillaDiff.Enumerations;
namespace ScintillaDiff.UtilityClasses
{
/// <summary>
/// A class to hold character level change values.
/// </summary>
public class CharacterChangeType
{
/// <summary>
/// Gets or sets the index of the line.
/// </summary>
/// <value>The index of the line.</value>
public int LineIndex { get; set; }
/// <summary>
/// Gets or sets the position in the <see cref="LineIndex"/>.
/// </summary>
/// <value>The position in the <see cref="LineIndex"/>.</value>
public int Position { get; set; }
/// <summary>
/// Gets or sets the length of the character change area.
/// </summary>
/// <value>The length of the character change area.</value>
public int Length { get; set; }
/// <summary>
/// Gets or sets the type of the change within the character area.
/// </summary>
/// <value>The type of the change within the character area.</value>
public CharChangedType ChangeType { get; set; }
}
}
@@ -0,0 +1,59 @@
#region License
/*
MIT License
Copyright(c) 2020 Petteri Kautonen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
namespace ScintillaDiff.UtilityClasses
{
/// <summary>
/// A class for a generic modifiable pair.
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
/// <typeparam name="TValue">The type of the value.</typeparam>
public class Pair<TKey, TValue>
{
/// <summary>
/// Initializes a new instance of the <see cref="Pair{TKey, TValue}"/> class.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
public Pair(TKey key, TValue value)
{
Key = key;
Value = value;
}
/// <summary>
/// Gets or sets the key.
/// </summary>
/// <value>The key.</value>
public TKey Key { get; set; }
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
public TValue Value { get; set; }
}
}
+312
View File
@@ -0,0 +1,312 @@
using FluentFTP;
using FluentFTP.Client.BaseClient;
using GameBackup3H3.DbOp;
using ryCommon;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Net;
using System.Text;
#pragma warning disable CA1031 // 不捕获常规异常类型
namespace FTPop
{
/// <summary>
/// FTP管理
/// </summary>
public class FTPFluentFTP : IFTP, IDisposable
{
private bool disposed = false;
FtpClient conn;
public string CurRemoteFolder { get; private set; } = "";
FTPInfo _ftpinfo;
private Encoding GetEncoding()
{
if (_ftpinfo.Encoding == "UTF8")
{ return Encoding.UTF8; }
else
{ return Encoding.GetEncoding(_ftpinfo.Encoding); }
}
private void AppendText(string text, Color color)
{
}
/// <summary>
/// 打开FTP
/// </summary>
/// <param name="ftpinfo"></param>
public int Open(FTPInfo ftpinfo)
{
if(ftpinfo==null)
{
return -1;
}
_ftpinfo = ftpinfo;
conn = new FtpClient
{
Host = _ftpinfo.IP,
Port = _ftpinfo.Port,
Credentials = new NetworkCredential(_ftpinfo.UserName, _ftpinfo.Pwd)
};
conn.Config.ConnectTimeout = 35000;
conn.Config.DataConnectionConnectTimeout = 35000;
conn.Config.DataConnectionReadTimeout = 35000;
conn.Config.ReadTimeout = 35000;
conn.Config.DataConnectionType = FtpDataConnectionType.AutoPassive;
conn.Config.SslProtocols = System.Security.Authentication.SslProtocols.Tls12;
try
{
if (_ftpinfo.Encrypt > 0)
{
conn.Config.EncryptionMode = _ftpinfo.Encrypt == 2 ? FtpEncryptionMode.Explicit : FtpEncryptionMode.Implicit;
conn.Config.ValidateAnyCertificate = true;
conn.ValidateCertificate += new FtpSslValidation(OnValidateCertificate);
}
conn.Config.DataConnectionEncryption = true;
conn.Connect();
if (conn.IsConnected)
{
ChangeWorkingDirectory("");
//conn.DataConnectionType = FtpDataConnectionType.PASV;
//var ss= conn.GetListing();
}
}
catch(Exception ex)
{
return -2;
}
return conn.IsConnected?1:0;
}
private void AsyncMethod()
{
//var kk = await conn.GetListingAsync();
}
private static void OnValidateCertificate(BaseFtpClient control, FtpSslValidationEventArgs e)
{
if (e.PolicyErrors != System.Net.Security.SslPolicyErrors.None)
{
// invalid cert, do you want to accept it?
e.Accept = true;
}
else
{
e.Accept = true;
}
}
private bool ChangeWorkingDirectory(string Path)
{
if (Path == null || Path.Length == 0)
{
AppendText("Status : Directory Was Not Found\n", Color.Red);
return false;
}
conn.SetWorkingDirectory(Path);
CurRemoteFolder = Path;
AppendText("Status : Current Working Directory is " + CurRemoteFolder + "\n", Color.Red);
return true;
}
/// <summary>
/// 关闭FTP
/// </summary>
/// <returns></returns>
public int Close()
{
conn.Disconnect();
conn.Dispose();
return 1;
}
/// <summary>
/// 移除文件
/// </summary>
/// <param name="remotePath"></param>
/// <returns></returns>
public int RemoveFiles(string remotePath)
{
conn.DeleteFile(remotePath);
return 1;
}
/// <summary>
/// 移动文件
/// </summary>
/// <param name="fromPath"></param>
/// <param name="toPath"></param>
/// <returns></returns>
public int MoveFile(string fromPath, string toPath)
{
conn.Rename(fromPath, toPath);
return 1;
}
/// <summary>
/// 文件是否存在
/// </summary>
/// <param name="remotePath"></param>
/// <returns></returns>
public bool FileExists(string remotePath)
{
return conn.FileExists(remotePath);
}
/// <summary>
/// 文件大小
/// </summary>
/// <param name="remotePath"></param>
/// <returns></returns>
public Int64 FileSize(string remotePath)
{
try
{
return conn.GetFileSize(remotePath);
}
catch { return -1; }
}
/// <summary>
/// 文件最后修改时间
/// </summary>
/// <param name="remotePath"></param>
/// <returns></returns>
public DateTime FileLastWriteTime(string remotePath)
{
try
{
return conn.GetModifiedTime(remotePath);
}
catch { return new DateTime(2000,1,1); }
}
/// <summary>
/// 文件信息
/// </summary>
/// <param name="remotePath"></param>
/// <returns></returns>
public RemoteFileInfo GetFileInfo(string remotePath)
{
try
{
return new RemoteFileInfo()
{
LastWriteTime = conn.GetModifiedTime(remotePath),
Length = conn.GetFileSize(remotePath),
Name = System.IO.Path.GetFileName(remotePath),
IsDirectory = conn.DirectoryExists(remotePath)
};
}
catch
{
return new RemoteFileInfo();
}
}
/// <summary>
/// 显示文件夹列表
/// </summary>
/// <param name="CurFolder"></param>
/// <returns></returns>
public List<RemoteFileInfo> ListDirectory(string CurFolder)
{
//var aa = conn.GetNameListing(CurFolder) ;
List<RemoteFileInfo> list = new List<RemoteFileInfo>();
conn.Encoding = GetEncoding();
var list_conn= conn.GetListing(CurFolder.TrimEnd('/'));
//var list_conn2 = conn.GetNameListing();
for (int i = 0; i < list_conn.Length; i++)
{
var item = list_conn[i];
list.Add(new RemoteFileInfo()
{
FullName = item.FullName,
IsDirectory = item.Type== FtpObjectType.Directory,
Name = item.Name,
Length = item.Size,
LastWriteTime = item.Modified
});
}
return list;
}
/// <summary>
/// 上传
/// </summary>
/// <param name="localPath"></param>
/// <param name="remotePath"></param>
/// <returns></returns>
public int Upload(string localPath, string remotePath)
{
try
{
Action<FtpProgress> progress = delegate (FtpProgress p)
{
var progress2 = new FileTransferProgressEventArgs()
{
Cancel = false,
LocalPath = localPath,
FileProgress = p.Progress/100d,
IsComplete=p.Progress==100,
Speed=p.TransferSpeed
};
FileTransferProgress?.Invoke(this, progress2);
//if (progress2.Cancel) {p.=true ; }
if (p.Progress == 1)
{
// all done!
}
else
{
// percent done = (p.Progress * 100)
}
};
// upload a file with progress tracking
var result= conn.UploadFile(localPath, remotePath, FtpRemoteExists.Overwrite, true, FtpVerify.None, progress);
if (result == FtpStatus.Success)
{
if (FileSize(remotePath) != RyFiles.GetFileSize(localPath))
{
ErrorMsg = "文件上传不完整";
return -1;
}
else
{
return 1;
}
}
return -2;
}
catch (Exception ex)
{
ErrorMsg = ex.Message;
return -1;
}
}
public string ErrorMsg { get; set; } = "";
/// <summary>
/// 文件传输事件
/// </summary>
public event FileTransferProgressEventHandler FileTransferProgress;
~FTPFluentFTP()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!this.disposed)
{
Close();
// If disposing equals true, dispose all managed
// and unmanaged resources.
if (disposing)
{
// Dispose managed resources.
}
// Release unmanaged resources. If disposing is false,
// only the following code is executed.
// Note that this is not thread safe.
// Another thread could start disposing the object
// after the managed resources are disposed,
// but before the disposed flag is set to true.
// If thread safety is necessary, it must be
// implemented by the client.
}
disposed = true;
}
}
}
Loaded 100 of 349 files, more files were not shown because too many files have changed in this diff. Show more